Gentoo Archives: gentoo-commits

From: Aaron Bauman <bman@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/python/
Date: Sat, 01 Dec 2018 00:45:51
Message-Id: 1543625084.1ec1ad927519b2ed395ae7254f721b7dc9a0db45.bman@gentoo
1 commit: 1ec1ad927519b2ed395ae7254f721b7dc9a0db45
2 Author: Aaron Bauman <bman <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 1 00:44:44 2018 +0000
4 Commit: Aaron Bauman <bman <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 1 00:44:44 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1ec1ad92
7
8 dev-lang/python: drop vulnerable
9
10 Signed-off-by: Aaron Bauman <bman <AT> gentoo.org>
11
12 dev-lang/python/Manifest | 2 -
13 dev-lang/python/python-2.7.14-r1.ebuild | 363 -------------------------------
14 dev-lang/python/python-2.7.14-r2.ebuild | 367 --------------------------------
15 3 files changed, 732 deletions(-)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 6bd4f45d838..e280e2dba6b 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -1,4 +1,3 @@
22 -DIST Python-2.7.14.tar.xz 12576112 BLAKE2B e03c4134cfdd88678acc26f383130a598ce4de908ab6bb9ee00e9235de3e0fcb9e653fec86f39db64fb895ef797d33736524655c5b94fab2cde2544b966b2cfb SHA512 78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9
23 DIST Python-2.7.15.tar.xz 12642436 BLAKE2B d8783a48ea26695e8d4677397a08194c738d7e4bc8ecaddaab609ad1fd5a1ca07701f707fe38d259f6bd44a39171ef95e7530f3df4bcb4d94abc4d21d7e2d489 SHA512 27ea43eb45fc68f3d2469d5f07636e10801dee11635a430ec8ec922ed790bb426b072da94df885e4dfa1ea8b7a24f2f56dd92f9b0f51e162330f161216bd6de6
24 DIST Python-3.4.5.tar.xz 14516820 BLAKE2B f9ddabd2df2241089d07756d3a8ba1c70096bee60d7cdef84041edbb20c488c3a573762441a4b7f543dbc0ce403ce84ff7d02e7d25699917bd014ab96deead85 SHA512 b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c
25 DIST Python-3.4.6.tar.xz 14473592 BLAKE2B 4af4f8e6f5c6831b50e99dd9eef47617f14903dc709f53f833c64726b003e9f84f75be80ba8059dcada2b2f262d65875f70d8c53a163546e51f9a715c68f4f20 SHA512 f6785cf6a99a8a27823baefe59cc20e34cbec01bb444c8600e7f49b5437159d5137f9d80fce26e219846d71bfe98f68bc6f0c87719a34db0050a4eaca95959ac
26 @@ -10,7 +9,6 @@ DIST Python-3.6.4.tar.xz 16992824 BLAKE2B 2347a70bb25468221178b1542ddd4376f136a5
27 DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
28 DIST Python-3.6.6.tar.xz 17156744 BLAKE2B fa4333149f84570cc4a0d1ec76c819610888750a51268b9db7d05df7d9c11e5ed72daff5d81b404015d9c678cb034d8a32034262ce73629ee8f96772853a706c SHA512 c71f87c5906e770322a14cacad228655659f782207db826320449d12bf86091c3662f317e1773158dec52f8b052eaedfb4c03b561cc2a6cfcd381597fd2d2b04
29 DIST Python-3.7.0.tar.xz 16922100 BLAKE2B cd2afd9ad1847ca793bc64ecb637906c35e0c8da8392d626cce3ebf19be5ccde1e6dcc499b933359cb24dcdbd024b3aaa916f96ed893b1f52d9825e404f27e5f SHA512 8bb11233fb67ee9ab8ed1b72f8fdc62f66e26a6beaaeb92448bce681cf065269833b1658d3ed2459127f25ba43adb0eab73cf27c59834a2a803fb529b4216739
30 -DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
31 DIST python-gentoo-patches-2.7.15.tar.xz 16208 BLAKE2B 5739c2b3a236d48f8e33f0fe6515bfe7a8f99096f6223b402653988feac2513d37d26b6e40e5e049852f42657358170e468ca60097e0e2294e760787c12ad591 SHA512 687fd008d1d41b1e65ce5417f6f6aba84ffd42f7af44ef97c03a7806b28e6888f8df043a0c15187a8b229cc17642853e6feb25494db97f4d10f8a66f8ebcbcca
32 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
33 DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06 SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
34
35 diff --git a/dev-lang/python/python-2.7.14-r1.ebuild b/dev-lang/python/python-2.7.14-r1.ebuild
36 deleted file mode 100644
37 index 46a254fb031..00000000000
38 --- a/dev-lang/python/python-2.7.14-r1.ebuild
39 +++ /dev/null
40 @@ -1,363 +0,0 @@
41 -# Copyright 1999-2018 Gentoo Authors
42 -# Distributed under the terms of the GNU General Public License v2
43 -
44 -EAPI="5"
45 -WANT_LIBTOOL="none"
46 -
47 -inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
48 -
49 -MY_P="Python-${PV}"
50 -PATCHSET_VERSION="2.7.14-0"
51 -
52 -DESCRIPTION="An interpreted, interactive, object-oriented programming language"
53 -HOMEPAGE="https://www.python.org/"
54 -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
55 - https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
56 -
57 -LICENSE="PSF-2"
58 -SLOT="2.7"
59 -KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd"
60 -IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
61 -
62 -# Do not add a dependency on dev-lang/python to this ebuild.
63 -# If you need to apply a patch which requires python for bootstrapping, please
64 -# run the bootstrap code on your dev box and include the results in the
65 -# patchset. See bug 447752.
66 -
67 -RDEPEND="app-arch/bzip2:0=
68 - >=sys-libs/zlib-1.1.3:0=
69 - virtual/libffi:=
70 - virtual/libintl
71 - berkdb? ( || (
72 - sys-libs/db:5.3
73 - sys-libs/db:5.1
74 - sys-libs/db:4.8
75 - sys-libs/db:4.7
76 - sys-libs/db:4.6
77 - sys-libs/db:4.5
78 - sys-libs/db:4.4
79 - sys-libs/db:4.3
80 - sys-libs/db:4.2
81 - ) )
82 - gdbm? ( sys-libs/gdbm:0=[berkdb] )
83 - ncurses? ( >=sys-libs/ncurses-5.2:0= )
84 - readline? ( >=sys-libs/readline-4.1:0= )
85 - sqlite? ( >=dev-db/sqlite-3.3.8:3= )
86 - ssl? (
87 - !libressl? ( dev-libs/openssl:0= )
88 - libressl? ( dev-libs/libressl:0= )
89 - )
90 - tk? (
91 - >=dev-lang/tcl-8.0:0=
92 - >=dev-lang/tk-8.0:0=
93 - dev-tcltk/blt:0=
94 - dev-tcltk/tix
95 - )
96 - xml? ( >=dev-libs/expat-2.1 )
97 - !!<sys-apps/portage-2.1.9"
98 -DEPEND="${RDEPEND}
99 - virtual/pkgconfig
100 - >=sys-devel/autoconf-2.65
101 - !sys-devel/gcc[libffi(-)]"
102 -RDEPEND+=" !build? ( app-misc/mime-types )
103 - doc? ( dev-python/python-docs:${SLOT} )"
104 -PDEPEND=">=app-eselect/eselect-python-20140125-r1"
105 -
106 -S="${WORKDIR}/${MY_P}"
107 -
108 -pkg_setup() {
109 - if use berkdb; then
110 - ewarn "'bsddb' module is out-of-date and no longer maintained inside"
111 - ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
112 - ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
113 - ewarn "is provided by dev-python/bsddb3."
114 - else
115 - if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
116 - ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
117 - ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
118 - ewarn "You might need to migrate your databases."
119 - fi
120 - fi
121 -}
122 -
123 -src_prepare() {
124 - # Ensure that internal copies of expat, libffi and zlib are not used.
125 - rm -r Modules/expat || die
126 - rm -r Modules/_ctypes/libffi* || die
127 - rm -r Modules/zlib || die
128 -
129 - if tc-is-cross-compiler; then
130 - local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
131 - fi
132 -
133 - EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
134 -
135 - # Fix for cross-compiling.
136 - epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
137 - epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
138 - epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
139 - epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
140 - epatch "${FILESDIR}/2.7-disable-nis.patch"
141 - epatch "${FILESDIR}/python-2.7-libressl-compatibility.patch"
142 -
143 - epatch_user
144 -
145 - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
146 - Lib/distutils/command/install.py \
147 - Lib/distutils/sysconfig.py \
148 - Lib/site.py \
149 - Lib/sysconfig.py \
150 - Lib/test/test_site.py \
151 - Makefile.pre.in \
152 - Modules/Setup.dist \
153 - Modules/getpath.c \
154 - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
155 -
156 - eautoreconf
157 -}
158 -
159 -src_configure() {
160 - # dbm module can be linked against berkdb or gdbm.
161 - # Defaults to gdbm when both are enabled, #204343.
162 - local disable
163 - use berkdb || use gdbm || disable+=" dbm"
164 - use berkdb || disable+=" _bsddb"
165 - use gdbm || disable+=" gdbm"
166 - use ncurses || disable+=" _curses _curses_panel"
167 - use readline || disable+=" readline"
168 - use sqlite || disable+=" _sqlite3"
169 - use ssl || export PYTHON_DISABLE_SSL="1"
170 - use tk || disable+=" _tkinter"
171 - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
172 - export PYTHON_DISABLE_MODULES="${disable}"
173 -
174 - if ! use xml; then
175 - ewarn "You have configured Python without XML support."
176 - ewarn "This is NOT a recommended configuration as you"
177 - ewarn "may face problems parsing any XML documents."
178 - fi
179 -
180 - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
181 - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
182 - fi
183 -
184 - if [[ "$(gcc-major-version)" -ge 4 ]]; then
185 - append-flags -fwrapv
186 - fi
187 -
188 - filter-flags -malign-double
189 -
190 - # https://bugs.gentoo.org/show_bug.cgi?id=50309
191 - if is-flagq -O3; then
192 - is-flagq -fstack-protector-all && replace-flags -O3 -O2
193 - use hardened && replace-flags -O3 -O2
194 - fi
195 -
196 - if tc-is-cross-compiler; then
197 - # Force some tests that try to poke fs paths.
198 - export ac_cv_file__dev_ptc=no
199 - export ac_cv_file__dev_ptmx=yes
200 - fi
201 -
202 - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
203 - tc-export CXX
204 - # The configure script fails to use pkg-config correctly.
205 - # http://bugs.python.org/issue15506
206 - export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
207 -
208 - # Set LDFLAGS so we link modules with -lpython2.7 correctly.
209 - # Needed on FreeBSD unless Python 2.7 is already installed.
210 - # Please query BSD team before removing this!
211 - append-ldflags "-L."
212 -
213 - local dbmliborder
214 - if use gdbm; then
215 - dbmliborder+="${dbmliborder:+:}gdbm"
216 - fi
217 - if use berkdb; then
218 - dbmliborder+="${dbmliborder:+:}bdb"
219 - fi
220 -
221 - BUILD_DIR="${WORKDIR}/${CHOST}"
222 - mkdir -p "${BUILD_DIR}" || die
223 - cd "${BUILD_DIR}" || die
224 -
225 - ECONF_SOURCE="${S}" OPT="" \
226 - econf \
227 - --with-fpectl \
228 - --enable-shared \
229 - $(use_enable ipv6) \
230 - $(use_with threads) \
231 - $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
232 - --infodir='${prefix}/share/info' \
233 - --mandir='${prefix}/share/man' \
234 - --with-computed-gotos \
235 - --with-dbmliborder="${dbmliborder}" \
236 - --with-libc="" \
237 - --enable-loadable-sqlite-extensions \
238 - --with-system-expat \
239 - --with-system-ffi \
240 - --without-ensurepip
241 -
242 - if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
243 - eerror "configure has detected that the sem_open function is broken."
244 - eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
245 - die "Broken sem_open function (bug 496328)"
246 - fi
247 -}
248 -
249 -src_compile() {
250 - # Avoid invoking pgen for cross-compiles.
251 - touch Include/graminit.h Python/graminit.c
252 -
253 - cd "${BUILD_DIR}" || die
254 - emake
255 -
256 - # Work around bug 329499. See also bug 413751 and 457194.
257 - if has_version dev-libs/libffi[pax_kernel]; then
258 - pax-mark E python
259 - else
260 - pax-mark m python
261 - fi
262 -}
263 -
264 -src_test() {
265 - # Tests will not work when cross compiling.
266 - if tc-is-cross-compiler; then
267 - elog "Disabling tests due to crosscompiling."
268 - return
269 - fi
270 -
271 - cd "${BUILD_DIR}" || die
272 -
273 - # Skip failing tests.
274 - local skipped_tests="distutils gdb"
275 -
276 - for test in ${skipped_tests}; do
277 - mv "${S}"/Lib/test/test_${test}.py "${T}"
278 - done
279 -
280 - # Daylight saving time problem
281 - # https://bugs.python.org/issue22067
282 - # https://bugs.gentoo.org/610628
283 - local -x TZ=UTC
284 -
285 - # Rerun failed tests in verbose mode (regrtest -w).
286 - emake test EXTRATESTOPTS="-w" < /dev/tty
287 - local result="$?"
288 -
289 - for test in ${skipped_tests}; do
290 - mv "${T}/test_${test}.py" "${S}"/Lib/test
291 - done
292 -
293 - elog "The following tests have been skipped:"
294 - for test in ${skipped_tests}; do
295 - elog "test_${test}.py"
296 - done
297 -
298 - elog "If you would like to run them, you may:"
299 - elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
300 - elog "and run the tests separately."
301 -
302 - if [[ "${result}" -ne 0 ]]; then
303 - die "emake test failed"
304 - fi
305 -}
306 -
307 -src_install() {
308 - local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
309 -
310 - cd "${BUILD_DIR}" || die
311 - emake DESTDIR="${D}" altinstall
312 -
313 - sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
314 -
315 - # Fix collisions between different slots of Python.
316 - mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
317 - mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
318 - mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
319 - rm -f "${ED}usr/bin/smtpd.py"
320 -
321 - use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
322 - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
323 - use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
324 - use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
325 -
326 - use threads || rm -r "${libdir}/multiprocessing" || die
327 - use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
328 -
329 - dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
330 -
331 - if use examples; then
332 - insinto /usr/share/doc/${PF}/examples
333 - doins -r "${S}"/Tools
334 - fi
335 - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
336 - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
337 - emake --no-print-directory -s -f - 2>/dev/null)
338 - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
339 -
340 - newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
341 - newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
342 - sed \
343 - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
344 - -e "s:@PYDOC@:pydoc${SLOT}:" \
345 - -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
346 -
347 - # for python-exec
348 - local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
349 -
350 - # if not using a cross-compiler, use the fresh binary
351 - if ! tc-is-cross-compiler; then
352 - local -x PYTHON=./python
353 - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
354 - else
355 - vars=( PYTHON "${vars[@]}" )
356 - fi
357 -
358 - python_export "python${SLOT}" "${vars[@]}"
359 - echo "EPYTHON='${EPYTHON}'" > epython.py || die
360 - python_domodule epython.py
361 -
362 - # python-exec wrapping support
363 - local pymajor=${SLOT%.*}
364 - mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
365 - # python and pythonX
366 - ln -s "../../../bin/python${SLOT}" \
367 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
368 - ln -s "python${pymajor}" \
369 - "${D}${PYTHON_SCRIPTDIR}/python" || die
370 - # python-config and pythonX-config
371 - ln -s "../../../bin/python${SLOT}-config" \
372 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
373 - ln -s "python${pymajor}-config" \
374 - "${D}${PYTHON_SCRIPTDIR}/python-config" || die
375 - # 2to3, pydoc, pyvenv
376 - ln -s "../../../bin/2to3-${SLOT}" \
377 - "${D}${PYTHON_SCRIPTDIR}/2to3" || die
378 - ln -s "../../../bin/pydoc${SLOT}" \
379 - "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
380 - # idle
381 - if use tk; then
382 - ln -s "../../../bin/idle${SLOT}" \
383 - "${D}${PYTHON_SCRIPTDIR}/idle" || die
384 - fi
385 -}
386 -
387 -eselect_python_update() {
388 - if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
389 - eselect python update
390 - fi
391 -
392 - if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
393 - eselect python update --python${PV%%.*}
394 - fi
395 -}
396 -
397 -pkg_postinst() {
398 - eselect_python_update
399 -}
400 -
401 -pkg_postrm() {
402 - eselect_python_update
403 -}
404
405 diff --git a/dev-lang/python/python-2.7.14-r2.ebuild b/dev-lang/python/python-2.7.14-r2.ebuild
406 deleted file mode 100644
407 index cc59a512433..00000000000
408 --- a/dev-lang/python/python-2.7.14-r2.ebuild
409 +++ /dev/null
410 @@ -1,367 +0,0 @@
411 -# Copyright 1999-2018 Gentoo Authors
412 -# Distributed under the terms of the GNU General Public License v2
413 -
414 -EAPI="5"
415 -WANT_LIBTOOL="none"
416 -
417 -inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
418 -
419 -MY_P="Python-${PV}"
420 -PATCHSET_VERSION="2.7.14-0"
421 -
422 -DESCRIPTION="An interpreted, interactive, object-oriented programming language"
423 -HOMEPAGE="https://www.python.org/"
424 -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
425 - https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
426 -
427 -LICENSE="PSF-2"
428 -SLOT="2.7"
429 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
430 -IUSE="-berkdb bluetooth build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
431 -
432 -# Do not add a dependency on dev-lang/python to this ebuild.
433 -# If you need to apply a patch which requires python for bootstrapping, please
434 -# run the bootstrap code on your dev box and include the results in the
435 -# patchset. See bug 447752.
436 -
437 -RDEPEND="app-arch/bzip2:0=
438 - >=sys-libs/zlib-1.1.3:0=
439 - virtual/libffi:=
440 - virtual/libintl
441 - berkdb? ( || (
442 - sys-libs/db:5.3
443 - sys-libs/db:5.1
444 - sys-libs/db:4.8
445 - sys-libs/db:4.7
446 - sys-libs/db:4.6
447 - sys-libs/db:4.5
448 - sys-libs/db:4.4
449 - sys-libs/db:4.3
450 - sys-libs/db:4.2
451 - ) )
452 - gdbm? ( sys-libs/gdbm:0=[berkdb] )
453 - ncurses? ( >=sys-libs/ncurses-5.2:0= )
454 - readline? ( >=sys-libs/readline-4.1:0= )
455 - sqlite? ( >=dev-db/sqlite-3.3.8:3= )
456 - ssl? (
457 - !libressl? ( dev-libs/openssl:0= )
458 - libressl? ( dev-libs/libressl:0= )
459 - )
460 - tk? (
461 - >=dev-lang/tcl-8.0:0=
462 - >=dev-lang/tk-8.0:0=
463 - dev-tcltk/blt:0=
464 - dev-tcltk/tix
465 - )
466 - xml? ( >=dev-libs/expat-2.1 )
467 - !!<sys-apps/portage-2.1.9"
468 -# bluetooth requires headers from bluez
469 -DEPEND="${RDEPEND}
470 - bluetooth? ( net-wireless/bluez )
471 - virtual/pkgconfig
472 - >=sys-devel/autoconf-2.65
473 - !sys-devel/gcc[libffi(-)]"
474 -RDEPEND+=" !build? ( app-misc/mime-types )
475 - doc? ( dev-python/python-docs:${SLOT} )"
476 -PDEPEND=">=app-eselect/eselect-python-20140125-r1"
477 -
478 -S="${WORKDIR}/${MY_P}"
479 -
480 -pkg_setup() {
481 - if use berkdb; then
482 - ewarn "'bsddb' module is out-of-date and no longer maintained inside"
483 - ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
484 - ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
485 - ewarn "is provided by dev-python/bsddb3."
486 - else
487 - if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
488 - ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
489 - ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
490 - ewarn "You might need to migrate your databases."
491 - fi
492 - fi
493 -}
494 -
495 -src_prepare() {
496 - # Ensure that internal copies of expat, libffi and zlib are not used.
497 - rm -r Modules/expat || die
498 - rm -r Modules/_ctypes/libffi* || die
499 - rm -r Modules/zlib || die
500 -
501 - if tc-is-cross-compiler; then
502 - local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
503 - fi
504 -
505 - EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
506 -
507 - # Fix for cross-compiling.
508 - epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
509 - epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
510 - epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
511 - epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
512 - epatch "${FILESDIR}/2.7-disable-nis.patch"
513 - epatch "${FILESDIR}/python-2.7-libressl-compatibility.patch"
514 -
515 - epatch_user
516 -
517 - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
518 - Lib/distutils/command/install.py \
519 - Lib/distutils/sysconfig.py \
520 - Lib/site.py \
521 - Lib/sysconfig.py \
522 - Lib/test/test_site.py \
523 - Makefile.pre.in \
524 - Modules/Setup.dist \
525 - Modules/getpath.c \
526 - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
527 -
528 - eautoreconf
529 -}
530 -
531 -src_configure() {
532 - # dbm module can be linked against berkdb or gdbm.
533 - # Defaults to gdbm when both are enabled, #204343.
534 - local disable
535 - use berkdb || use gdbm || disable+=" dbm"
536 - use berkdb || disable+=" _bsddb"
537 - # disable automagic bluetooth headers detection
538 - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
539 - use gdbm || disable+=" gdbm"
540 - use ncurses || disable+=" _curses _curses_panel"
541 - use readline || disable+=" readline"
542 - use sqlite || disable+=" _sqlite3"
543 - use ssl || export PYTHON_DISABLE_SSL="1"
544 - use tk || disable+=" _tkinter"
545 - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
546 - export PYTHON_DISABLE_MODULES="${disable}"
547 -
548 - if ! use xml; then
549 - ewarn "You have configured Python without XML support."
550 - ewarn "This is NOT a recommended configuration as you"
551 - ewarn "may face problems parsing any XML documents."
552 - fi
553 -
554 - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
555 - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
556 - fi
557 -
558 - if [[ "$(gcc-major-version)" -ge 4 ]]; then
559 - append-flags -fwrapv
560 - fi
561 -
562 - filter-flags -malign-double
563 -
564 - # https://bugs.gentoo.org/show_bug.cgi?id=50309
565 - if is-flagq -O3; then
566 - is-flagq -fstack-protector-all && replace-flags -O3 -O2
567 - use hardened && replace-flags -O3 -O2
568 - fi
569 -
570 - if tc-is-cross-compiler; then
571 - # Force some tests that try to poke fs paths.
572 - export ac_cv_file__dev_ptc=no
573 - export ac_cv_file__dev_ptmx=yes
574 - fi
575 -
576 - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
577 - tc-export CXX
578 - # The configure script fails to use pkg-config correctly.
579 - # http://bugs.python.org/issue15506
580 - export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
581 -
582 - # Set LDFLAGS so we link modules with -lpython2.7 correctly.
583 - # Needed on FreeBSD unless Python 2.7 is already installed.
584 - # Please query BSD team before removing this!
585 - append-ldflags "-L."
586 -
587 - local dbmliborder
588 - if use gdbm; then
589 - dbmliborder+="${dbmliborder:+:}gdbm"
590 - fi
591 - if use berkdb; then
592 - dbmliborder+="${dbmliborder:+:}bdb"
593 - fi
594 -
595 - BUILD_DIR="${WORKDIR}/${CHOST}"
596 - mkdir -p "${BUILD_DIR}" || die
597 - cd "${BUILD_DIR}" || die
598 -
599 - ECONF_SOURCE="${S}" OPT="" \
600 - econf \
601 - --with-fpectl \
602 - --enable-shared \
603 - $(use_enable ipv6) \
604 - $(use_with threads) \
605 - $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
606 - --infodir='${prefix}/share/info' \
607 - --mandir='${prefix}/share/man' \
608 - --with-computed-gotos \
609 - --with-dbmliborder="${dbmliborder}" \
610 - --with-libc="" \
611 - --enable-loadable-sqlite-extensions \
612 - --with-system-expat \
613 - --with-system-ffi \
614 - --without-ensurepip
615 -
616 - if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
617 - eerror "configure has detected that the sem_open function is broken."
618 - eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
619 - die "Broken sem_open function (bug 496328)"
620 - fi
621 -}
622 -
623 -src_compile() {
624 - # Avoid invoking pgen for cross-compiles.
625 - touch Include/graminit.h Python/graminit.c
626 -
627 - cd "${BUILD_DIR}" || die
628 - emake
629 -
630 - # Work around bug 329499. See also bug 413751 and 457194.
631 - if has_version dev-libs/libffi[pax_kernel]; then
632 - pax-mark E python
633 - else
634 - pax-mark m python
635 - fi
636 -}
637 -
638 -src_test() {
639 - # Tests will not work when cross compiling.
640 - if tc-is-cross-compiler; then
641 - elog "Disabling tests due to crosscompiling."
642 - return
643 - fi
644 -
645 - cd "${BUILD_DIR}" || die
646 -
647 - # Skip failing tests.
648 - local skipped_tests="distutils gdb"
649 -
650 - for test in ${skipped_tests}; do
651 - mv "${S}"/Lib/test/test_${test}.py "${T}"
652 - done
653 -
654 - # Daylight saving time problem
655 - # https://bugs.python.org/issue22067
656 - # https://bugs.gentoo.org/610628
657 - local -x TZ=UTC
658 -
659 - # Rerun failed tests in verbose mode (regrtest -w).
660 - emake test EXTRATESTOPTS="-w" < /dev/tty
661 - local result="$?"
662 -
663 - for test in ${skipped_tests}; do
664 - mv "${T}/test_${test}.py" "${S}"/Lib/test
665 - done
666 -
667 - elog "The following tests have been skipped:"
668 - for test in ${skipped_tests}; do
669 - elog "test_${test}.py"
670 - done
671 -
672 - elog "If you would like to run them, you may:"
673 - elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
674 - elog "and run the tests separately."
675 -
676 - if [[ "${result}" -ne 0 ]]; then
677 - die "emake test failed"
678 - fi
679 -}
680 -
681 -src_install() {
682 - local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
683 -
684 - cd "${BUILD_DIR}" || die
685 - emake DESTDIR="${D}" altinstall
686 -
687 - sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
688 -
689 - # Fix collisions between different slots of Python.
690 - mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
691 - mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
692 - mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
693 - rm -f "${ED}usr/bin/smtpd.py"
694 -
695 - use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
696 - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
697 - use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
698 - use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
699 -
700 - use threads || rm -r "${libdir}/multiprocessing" || die
701 - use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
702 -
703 - dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
704 -
705 - if use examples; then
706 - insinto /usr/share/doc/${PF}/examples
707 - doins -r "${S}"/Tools
708 - fi
709 - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
710 - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
711 - emake --no-print-directory -s -f - 2>/dev/null)
712 - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
713 -
714 - newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
715 - newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
716 - sed \
717 - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
718 - -e "s:@PYDOC@:pydoc${SLOT}:" \
719 - -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
720 -
721 - # for python-exec
722 - local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
723 -
724 - # if not using a cross-compiler, use the fresh binary
725 - if ! tc-is-cross-compiler; then
726 - local -x PYTHON=./python
727 - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
728 - else
729 - vars=( PYTHON "${vars[@]}" )
730 - fi
731 -
732 - python_export "python${SLOT}" "${vars[@]}"
733 - echo "EPYTHON='${EPYTHON}'" > epython.py || die
734 - python_domodule epython.py
735 -
736 - # python-exec wrapping support
737 - local pymajor=${SLOT%.*}
738 - mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
739 - # python and pythonX
740 - ln -s "../../../bin/python${SLOT}" \
741 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
742 - ln -s "python${pymajor}" \
743 - "${D}${PYTHON_SCRIPTDIR}/python" || die
744 - # python-config and pythonX-config
745 - ln -s "../../../bin/python${SLOT}-config" \
746 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
747 - ln -s "python${pymajor}-config" \
748 - "${D}${PYTHON_SCRIPTDIR}/python-config" || die
749 - # 2to3, pydoc, pyvenv
750 - ln -s "../../../bin/2to3-${SLOT}" \
751 - "${D}${PYTHON_SCRIPTDIR}/2to3" || die
752 - ln -s "../../../bin/pydoc${SLOT}" \
753 - "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
754 - # idle
755 - if use tk; then
756 - ln -s "../../../bin/idle${SLOT}" \
757 - "${D}${PYTHON_SCRIPTDIR}/idle" || die
758 - fi
759 -}
760 -
761 -eselect_python_update() {
762 - if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
763 - eselect python update
764 - fi
765 -
766 - if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
767 - eselect python update --python${PV%%.*}
768 - fi
769 -}
770 -
771 -pkg_postinst() {
772 - eselect_python_update
773 -}
774 -
775 -pkg_postrm() {
776 - eselect_python_update
777 -}