Gentoo Archives: gentoo-commits

From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: ChangeLog python-2.6.5-r2.ebuild python-3.1.2-r3.ebuild
Date: Sat, 01 May 2010 21:54:45
Message-Id: 20100501215438.AEFF02C15C@corvid.gentoo.org
1 arfrever 10/05/01 21:54:38
2
3 Modified: ChangeLog
4 Added: python-2.6.5-r2.ebuild python-3.1.2-r3.ebuild
5 Log:
6 2.6.5-r2:
7 Don't add GENTOO_PYTHON_WRAPPER_SCRIPT_PATH to os.environ (bug #315919).
8 Fix failure of test_zlib with zlib 1.2.4 (Python issue #8193).
9 Backport some fixes from 2.6 branch.
10
11 3.1.2-r3:
12 Don't add GENTOO_PYTHON_WRAPPER_SCRIPT_PATH to os.environ (bug #315919).
13 Backport some fixes from 3.1 branch.
14 Use EAPI="3".
15 (Portage version: HEAD/cvs/Linux x86_64)
16
17 Revision Changes Path
18 1.465 dev-lang/python/ChangeLog
19
20 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?rev=1.465&view=markup
21 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?rev=1.465&content-type=text/plain
22 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?r1=1.464&r2=1.465
23
24 Index: ChangeLog
25 ===================================================================
26 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
27 retrieving revision 1.464
28 retrieving revision 1.465
29 diff -u -r1.464 -r1.465
30 --- ChangeLog 11 Apr 2010 21:22:49 -0000 1.464
31 +++ ChangeLog 1 May 2010 21:54:37 -0000 1.465
32 @@ -1,6 +1,21 @@
33 # ChangeLog for dev-lang/python
34 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
35 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.464 2010/04/11 21:22:49 arfrever Exp $
36 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.465 2010/05/01 21:54:37 arfrever Exp $
37 +
38 +*python-3.1.2-r3 (01 May 2010)
39 +
40 + 01 May 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@g.o>
41 + +python-3.1.2-r3.ebuild:
42 + Don't add GENTOO_PYTHON_WRAPPER_SCRIPT_PATH to os.environ (bug #315919).
43 + Backport some fixes from 3.1 branch. Use EAPI="3".
44 +
45 +*python-2.6.5-r2 (01 May 2010)
46 +
47 + 01 May 2010; Arfrever Frehtes Taifersar Arahesis <arfrever@g.o>
48 + +python-2.6.5-r2.ebuild:
49 + Don't add GENTOO_PYTHON_WRAPPER_SCRIPT_PATH to os.environ (bug #315919).
50 + Fix failure of test_zlib with zlib 1.2.4 (Python issue #8193). Backport
51 + some fixes from 2.6 branch.
52
53 *python-3.1.2-r2 (11 Apr 2010)
54
55
56
57
58 1.1 dev-lang/python/python-2.6.5-r2.ebuild
59
60 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.6.5-r2.ebuild?rev=1.1&view=markup
61 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.6.5-r2.ebuild?rev=1.1&content-type=text/plain
62
63 Index: python-2.6.5-r2.ebuild
64 ===================================================================
65 # Copyright 1999-2010 Gentoo Foundation
66 # Distributed under the terms of the GNU General Public License v2
67 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.5-r2.ebuild,v 1.1 2010/05/01 21:54:38 arfrever Exp $
68
69 EAPI="2"
70
71 inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
72
73 MY_P="Python-${PV}"
74 S="${WORKDIR}/${MY_P}"
75
76 PATCHSET_REVISION="3"
77
78 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
79 HOMEPAGE="http://www.python.org/"
80 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
81 mirror://gentoo/python-gentoo-patches-${PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
82
83 LICENSE="PSF-2.2"
84 SLOT="2.6"
85 PYTHON_ABI="${SLOT}"
86 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
87 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
88
89 # NOTE: dev-python/{elementtree,celementtree,pysqlite}
90 # do not conflict with the ones in python proper. - liquidx
91
92 RDEPEND=">=app-admin/eselect-python-20091230
93 >=sys-libs/zlib-1.1.3
94 virtual/libffi
95 virtual/libintl
96 !build? (
97 berkdb? ( || (
98 sys-libs/db:4.7
99 sys-libs/db:4.6
100 sys-libs/db:4.5
101 sys-libs/db:4.4
102 sys-libs/db:4.3
103 sys-libs/db:4.2
104 ) )
105 doc? ( dev-python/python-docs:${SLOT} )
106 gdbm? ( sys-libs/gdbm )
107 ncurses? (
108 >=sys-libs/ncurses-5.2
109 readline? ( >=sys-libs/readline-4.1 )
110 )
111 sqlite? ( >=dev-db/sqlite-3 )
112 ssl? ( dev-libs/openssl )
113 tk? ( >=dev-lang/tk-8.0 )
114 xml? ( >=dev-libs/expat-2 )
115 )"
116 DEPEND="${RDEPEND}
117 dev-util/pkgconfig
118 !sys-devel/gcc[libffi]"
119 RDEPEND+=" !build? ( app-misc/mime-types )"
120 PDEPEND="app-admin/python-updater"
121
122 PROVIDE="virtual/python"
123
124 pkg_setup() {
125 if use berkdb; then
126 ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python. It has"
127 ewarn "been additionally removed in Python 3. You should use external, still maintained \"bsddb3\""
128 ewarn "module provided by dev-python/bsddb3 which supports both Python 2 and Python 3."
129 fi
130 }
131
132 src_prepare() {
133 # Ensure that internal copies of expat, libffi and zlib are not used.
134 rm -fr Modules/expat
135 rm -fr Modules/_ctypes/libffi*
136 rm -fr Modules/zlib
137
138 if ! tc-is-cross-compiler; then
139 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
140 fi
141
142 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
143
144 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
145 Lib/distutils/command/install.py \
146 Lib/distutils/sysconfig.py \
147 Lib/site.py \
148 Makefile.pre.in \
149 Modules/Setup.dist \
150 Modules/getpath.c \
151 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
152
153 # Fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
154 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
155 [[ "${ARCH}" == "hppa" ]] && sed -e "s/utimes //" -i "${S}/configure"
156
157 if ! use wininst; then
158 # Remove Microsoft Windows executables.
159 rm Lib/distutils/command/wininst-*.exe
160 fi
161
162 # Fix OtherFileTests.testStdin() not to assume
163 # that stdin is a tty for bug #248081.
164 sed -e "s:'osf1V5':'osf1V5' and sys.stdin.isatty():" -i Lib/test/test_file.py || die "sed failed"
165
166 eautoreconf
167 }
168
169 src_configure() {
170 # Disable extraneous modules with extra dependencies.
171 if use build; then
172 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
173 export PYTHON_DISABLE_SSL="1"
174 else
175 # dbm module can be linked against berkdb or gdbm.
176 # Defaults to gdbm when both are enabled, #204343.
177 local disable
178 use berkdb || use gdbm || disable+=" dbm"
179 use berkdb || disable+=" _bsddb"
180 use gdbm || disable+=" gdbm"
181 use ncurses || disable+=" _curses _curses_panel"
182 use readline || disable+=" readline"
183 use sqlite || disable+=" _sqlite3"
184 use ssl || export PYTHON_DISABLE_SSL="1"
185 use tk || disable+=" _tkinter"
186 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
187 export PYTHON_DISABLE_MODULES="${disable}"
188
189 if ! use xml; then
190 ewarn "You have configured Python without XML support."
191 ewarn "This is NOT a recommended configuration as you"
192 ewarn "may face problems parsing any XML documents."
193 fi
194 fi
195
196 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
197 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
198 fi
199
200 if [[ "$(gcc-major-version)" -ge 4 ]]; then
201 append-flags -fwrapv
202 fi
203
204 filter-flags -malign-double
205
206 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
207
208 # https://bugs.gentoo.org/show_bug.cgi?id=50309
209 if is-flag -O3; then
210 is-flag -fstack-protector-all && replace-flags -O3 -O2
211 use hardened && replace-flags -O3 -O2
212 fi
213
214 if tc-is-cross-compiler; then
215 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
216 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
217 emake python Parser/pgen || die "cross-make failed"
218 mv python hostpython
219 mv Parser/pgen Parser/hostpgen
220 make distclean
221 sed -i \
222 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
223 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
224 Makefile.pre.in || die "sed failed"
225 fi
226
227 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
228 tc-export CXX
229
230 # Set LDFLAGS so we link modules with -lpython2.6 correctly.
231 # Needed on FreeBSD unless Python 2.6 is already installed.
232 # Please query BSD team before removing this!
233 append-ldflags "-L."
234
235 OPT="" econf \
236 --with-fpectl \
237 --enable-shared \
238 $(use_enable ipv6) \
239 $(use_with threads) \
240 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
241 --infodir='${prefix}/share/info' \
242 --mandir='${prefix}/share/man' \
243 --with-libc="" \
244 --with-system-ffi
245 }
246
247 src_compile() {
248 emake EXTRA_CFLAGS="${CFLAGS}" || die "emake failed"
249 }
250
251 src_test() {
252 # Tests will not work when cross compiling.
253 if tc-is-cross-compiler; then
254 elog "Disabling tests due to crosscompiling."
255 return
256 fi
257
258 # Byte compiling should be enabled here.
259 # Otherwise test_import fails.
260 python_enable_pyc
261
262 # Skip all tests that fail during emerge but pass without emerge:
263 # (See bug #67970)
264 local skip_tests="distutils httpservers minidom pyexpat sax tcl"
265
266 # test_ctypes fails with PAX kernel (bug #234498).
267 host-is-pax && skip_tests+=" ctypes"
268
269 for test in ${skip_tests}; do
270 mv "${S}/Lib/test/test_${test}.py" "${T}"
271 done
272
273 # Rerun failed tests in verbose mode (regrtest -w).
274 EXTRATESTOPTS="-w" make test || die "make test failed"
275
276 for test in ${skip_tests}; do
277 mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
278 done
279
280 elog "The following tests have been skipped:"
281 for test in ${skip_tests}; do
282 elog "test_${test}.py"
283 done
284
285 elog "If you would like to run them, you may:"
286 elog "cd ${EPREFIX}$(python_get_libdir)/test"
287 elog "and run the tests separately."
288
289 python_disable_pyc
290 }
291
292 src_install() {
293 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
294
295 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
296
297 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
298
299 # Fix collisions between different slots of Python.
300 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
301 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
302 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
303 mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
304 rm -f "${ED}usr/bin/smtpd.py"
305
306 if use build; then
307 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,idlelib,lib-tk,sqlite3,test}
308 else
309 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test}
310 use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,test/test_bsddb*}
311 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
312 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk}
313 fi
314
315 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
316
317 prep_ml_includes $(python_get_includedir)
318
319 if use examples; then
320 insinto /usr/share/doc/${PF}/examples
321 doins -r "${S}/Tools" || die "doins failed"
322 fi
323
324 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
325 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
326
327 # Do not install empty directory.
328 rmdir "${ED}$(python_get_libdir)/lib-old"
329 }
330
331 pkg_preinst() {
332 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
333 python_updater_warning="1"
334 fi
335 }
336
337 eselect_python_update() {
338 local eselect_python_options=
339 [[ "$(eselect python show)" == "python2."* ]] && eselect_python_options="--python2"
340
341 # Create python2 symlink.
342 eselect python update --python2 > /dev/null
343
344 eselect python update ${eselect_python_options}
345 }
346
347 pkg_postinst() {
348 eselect_python_update
349
350 python_mod_optimize -x "(site-packages|test)" $(python_get_libdir)
351
352 if [[ "${python_updater_warning}" == "1" ]]; then
353 ewarn
354 ewarn "\e[1;31m************************************************************************\e[0m"
355 ewarn
356 ewarn "You have just upgraded from an older version of Python."
357 ewarn "You should run 'python-updater \${options}' to rebuild Python modules."
358 ewarn
359 ewarn "\e[1;31m************************************************************************\e[0m"
360 ewarn
361 ebeep 12
362 fi
363 }
364
365 pkg_postrm() {
366 eselect_python_update
367
368 python_mod_cleanup $(python_get_libdir)
369 }
370
371
372
373 1.1 dev-lang/python/python-3.1.2-r3.ebuild
374
375 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-3.1.2-r3.ebuild?rev=1.1&view=markup
376 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-3.1.2-r3.ebuild?rev=1.1&content-type=text/plain
377
378 Index: python-3.1.2-r3.ebuild
379 ===================================================================
380 # Copyright 1999-2010 Gentoo Foundation
381 # Distributed under the terms of the GNU General Public License v2
382 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.1.2-r3.ebuild,v 1.1 2010/05/01 21:54:38 arfrever Exp $
383
384 EAPI="3"
385
386 inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs
387
388 MY_P="Python-${PV}"
389 S="${WORKDIR}/${MY_P}"
390
391 PATCHSET_REVISION="4"
392
393 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
394 HOMEPAGE="http://www.python.org/"
395 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
396 mirror://gentoo/python-gentoo-patches-${PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
397
398 LICENSE="PSF-2.2"
399 SLOT="3.1"
400 PYTHON_ABI="${SLOT}"
401 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
402 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
403
404 RDEPEND=">=app-admin/eselect-python-20091230
405 >=sys-libs/zlib-1.1.3
406 virtual/libffi
407 virtual/libintl
408 !build? (
409 doc? ( dev-python/python-docs:${SLOT} )
410 gdbm? ( sys-libs/gdbm )
411 ncurses? (
412 >=sys-libs/ncurses-5.2
413 readline? ( >=sys-libs/readline-4.1 )
414 )
415 sqlite? ( >=dev-db/sqlite-3 )
416 ssl? ( dev-libs/openssl )
417 tk? ( >=dev-lang/tk-8.0 )
418 xml? ( >=dev-libs/expat-2 )
419 )"
420 DEPEND="${RDEPEND}
421 dev-util/pkgconfig
422 !sys-devel/gcc[libffi]"
423 RDEPEND+=" !build? ( app-misc/mime-types )"
424 PDEPEND=">=app-admin/python-updater-0.8
425 || ( dev-lang/python:2.7 dev-lang/python:2.6 )"
426
427 PROVIDE="virtual/python"
428
429 src_prepare() {
430 # Ensure that internal copies of expat, libffi and zlib are not used.
431 rm -fr Modules/expat
432 rm -fr Modules/_ctypes/libffi*
433 rm -fr Modules/zlib
434
435 if ! tc-is-cross-compiler; then
436 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
437 fi
438
439 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
440
441 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
442 Lib/distutils/command/install.py \
443 Lib/distutils/sysconfig.py \
444 Lib/site.py \
445 Makefile.pre.in \
446 Modules/Setup.dist \
447 Modules/getpath.c \
448 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
449
450 # Fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
451 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
452 [[ "${ARCH}" == "hppa" ]] && sed -e "s/utimes //" -i "${S}/configure"
453
454 if ! use wininst; then
455 # Remove Microsoft Windows executables.
456 rm Lib/distutils/command/wininst-*.exe
457 fi
458
459 # Fix OtherFileTests.testStdin() not to assume
460 # that stdin is a tty for bug #248081.
461 sed -e "s:'osf1V5':'osf1V5' and sys.stdin.isatty():" -i Lib/test/test_file.py || die "sed failed"
462
463 eautoreconf
464 }
465
466 src_configure() {
467 # Disable extraneous modules with extra dependencies.
468 if use build; then
469 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
470 export PYTHON_DISABLE_SSL="1"
471 else
472 local disable
473 use gdbm || disable+=" gdbm"
474 use ncurses || disable+=" _curses _curses_panel"
475 use readline || disable+=" readline"
476 use sqlite || disable+=" _sqlite3"
477 use ssl || export PYTHON_DISABLE_SSL="1"
478 use tk || disable+=" _tkinter"
479 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
480 export PYTHON_DISABLE_MODULES="${disable}"
481
482 if ! use xml; then
483 ewarn "You have configured Python without XML support."
484 ewarn "This is NOT a recommended configuration as you"
485 ewarn "may face problems parsing any XML documents."
486 fi
487 fi
488
489 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
490 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
491 fi
492
493 if [[ "$(gcc-major-version)" -ge 4 ]]; then
494 append-flags -fwrapv
495 fi
496
497 filter-flags -malign-double
498
499 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
500
501 # https://bugs.gentoo.org/show_bug.cgi?id=50309
502 if is-flag -O3; then
503 is-flag -fstack-protector-all && replace-flags -O3 -O2
504 use hardened && replace-flags -O3 -O2
505 fi
506
507 if tc-is-cross-compiler; then
508 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
509 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
510 emake python Parser/pgen || die "cross-make failed"
511 mv python hostpython
512 mv Parser/pgen Parser/hostpgen
513 make distclean
514 sed -i \
515 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
516 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
517 Makefile.pre.in || die "sed failed"
518 fi
519
520 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
521 tc-export CXX
522
523 # Set LDFLAGS so we link modules with -lpython3.1 correctly.
524 # Needed on FreeBSD unless Python 3.1 is already installed.
525 # Please query BSD team before removing this!
526 append-ldflags "-L."
527
528 local dbmliborder
529 if use gdbm; then
530 dbmliborder+="${dbmliborder:+:}gdbm"
531 fi
532
533 OPT="" econf \
534 --with-fpectl \
535 --enable-shared \
536 $(use_enable ipv6) \
537 $(use_with threads) \
538 $(use_with wide-unicode) \
539 --infodir='${prefix}/share/info' \
540 --mandir='${prefix}/share/man' \
541 --with-computed-gotos \
542 --with-dbmliborder="${dbmliborder}" \
543 --with-libc="" \
544 --with-system-ffi
545 }
546
547 src_compile() {
548 emake EXTRA_CFLAGS="${CFLAGS}" || die "emake failed"
549 }
550
551 src_test() {
552 # Tests will not work when cross compiling.
553 if tc-is-cross-compiler; then
554 elog "Disabling tests due to crosscompiling."
555 return
556 fi
557
558 # Byte compiling should be enabled here.
559 # Otherwise test_import fails.
560 python_enable_pyc
561
562 # Skip all tests that fail during emerge but pass without emerge:
563 # (See bug #67970)
564 local skip_tests="distutils"
565
566 # test_ctypes fails with PAX kernel (bug #234498).
567 host-is-pax && skip_tests+=" ctypes"
568
569 for test in ${skip_tests}; do
570 mv "${S}/Lib/test/test_${test}.py" "${T}"
571 done
572
573 # Rerun failed tests in verbose mode (regrtest -w).
574 EXTRATESTOPTS="-w" make test || die "make test failed"
575
576 for test in ${skip_tests}; do
577 mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
578 done
579
580 elog "The following tests have been skipped:"
581 for test in ${skip_tests}; do
582 elog "test_${test}.py"
583 done
584
585 elog "If you would like to run them, you may:"
586 elog "cd ${EPREFIX}$(python_get_libdir)/test"
587 elog "and run the tests separately."
588
589 python_disable_pyc
590 }
591
592 src_install() {
593 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
594
595 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
596
597 # Fix collisions between different slots of Python.
598 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
599 mv "${ED}usr/bin/pydoc3" "${ED}usr/bin/pydoc${SLOT}"
600 mv "${ED}usr/bin/idle3" "${ED}usr/bin/idle${SLOT}"
601 rm -f "${ED}usr/bin/smtpd.py"
602
603 if use build; then
604 rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter}
605 else
606 use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test"
607 use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*}
608 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*}
609 fi
610
611 use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing"
612
613 prep_ml_includes $(python_get_includedir)
614
615 if use examples; then
616 insinto /usr/share/doc/${PF}/examples
617 doins -r "${S}/Tools" || die "doins failed"
618 fi
619
620 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
621 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
622 }
623
624 pkg_preinst() {
625 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
626 python_updater_warning="1"
627 fi
628 }
629
630 eselect_python_update() {
631 local eselect_python_options=
632 [[ "$(eselect python show)" == "python2."* ]] && eselect_python_options="--python2"
633
634 # Create python3 symlink.
635 eselect python update --python3 > /dev/null
636
637 eselect python update ${eselect_python_options}
638 }
639
640 pkg_postinst() {
641 eselect_python_update
642
643 python_mod_optimize -x "(site-packages|test)" $(python_get_libdir)
644
645 if [[ "$(eselect python show)" == "python2."* ]]; then
646 ewarn
647 ewarn "WARNING!"
648 ewarn "Many Python modules have not been ported yet to Python 3.*."
649 ewarn "Python 3 has not been activated and Python wrapper is still configured to use Python 2."
650 ewarn "You can manually activate Python ${SLOT} using \`eselect python set python${SLOT}\`."
651 ewarn "It is recommended to currently have Python wrapper configured to use Python 2."
652 ewarn "Having Python wrapper configured to use Python 3 is unsupported."
653 ewarn
654 ebeep 6
655 fi
656
657 if [[ "${python_updater_warning}" == "1" ]]; then
658 ewarn
659 ewarn "\e[1;31m************************************************************************\e[0m"
660 ewarn
661 ewarn "You have just upgraded from an older version of Python."
662 ewarn "You should run 'python-updater \${options}' to rebuild Python modules."
663 ewarn
664 ewarn "\e[1;31m************************************************************************\e[0m"
665 ewarn
666 ebeep 12
667 fi
668 }
669
670 pkg_postrm() {
671 eselect_python_update
672
673 python_mod_cleanup $(python_get_libdir)
674 }