Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: python-2.7.7.ebuild python-3.4.1.ebuild ChangeLog
Date: Sat, 28 Jun 2014 23:39:38
Message-Id: 20140628233933.725FE2004E@flycatcher.gentoo.org
1 floppym 14/06/28 23:39:33
2
3 Modified: ChangeLog
4 Added: python-2.7.7.ebuild python-3.4.1.ebuild
5 Log:
6 Version bumps.
7
8 (Portage version: 2.2.10/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)
9
10 Revision Changes Path
11 1.762 dev-lang/python/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.762&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.762&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?r1=1.761&r2=1.762
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
20 retrieving revision 1.761
21 retrieving revision 1.762
22 diff -u -r1.761 -r1.762
23 --- ChangeLog 15 Jun 2014 14:33:47 -0000 1.761
24 +++ ChangeLog 28 Jun 2014 23:39:33 -0000 1.762
25 @@ -1,6 +1,13 @@
26 # ChangeLog for dev-lang/python
27 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.761 2014/06/15 14:33:47 hattya Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.762 2014/06/28 23:39:33 floppym Exp $
30 +
31 +*python-2.7.7 (28 Jun 2014)
32 +*python-3.4.1 (28 Jun 2014)
33 +
34 + 28 Jun 2014; Mike Gilbert <floppym@g.o> +python-2.7.7.ebuild,
35 + +python-3.4.1.ebuild:
36 + Version bumps.
37
38 15 Jun 2014; Akinori Hattori <hattya@g.o> python-2.7.6.ebuild:
39 ia64 stable wrt bug #504742
40
41
42
43 1.1 dev-lang/python/python-2.7.7.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.7.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.7.ebuild?rev=1.1&content-type=text/plain
47
48 Index: python-2.7.7.ebuild
49 ===================================================================
50 # Copyright 1999-2014 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.7.ebuild,v 1.1 2014/06/28 23:39:33 floppym Exp $
53
54 EAPI="4"
55 WANT_AUTOMAKE="none"
56 WANT_LIBTOOL="none"
57
58 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
59
60 MY_P="Python-${PV}"
61 PATCHSET_VERSION="2.7.7-0"
62
63 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
64 HOMEPAGE="http://www.python.org/"
65 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
66 http://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
67
68 LICENSE="PSF-2"
69 SLOT="2.7"
70 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
71 IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
72
73 # Do not add a dependency on dev-lang/python to this ebuild.
74 # If you need to apply a patch which requires python for bootstrapping, please
75 # run the bootstrap code on your dev box and include the results in the
76 # patchset. See bug 447752.
77
78 RDEPEND="app-arch/bzip2
79 >=sys-libs/zlib-1.1.3
80 virtual/libffi
81 virtual/libintl
82 !build? (
83 berkdb? ( || (
84 sys-libs/db:5.3
85 sys-libs/db:5.2
86 sys-libs/db:5.1
87 sys-libs/db:5.0
88 sys-libs/db:4.8
89 sys-libs/db:4.7
90 sys-libs/db:4.6
91 sys-libs/db:4.5
92 sys-libs/db:4.4
93 sys-libs/db:4.3
94 sys-libs/db:4.2
95 ) )
96 gdbm? ( sys-libs/gdbm[berkdb] )
97 ncurses? (
98 >=sys-libs/ncurses-5.2
99 readline? ( >=sys-libs/readline-4.1 )
100 )
101 sqlite? ( >=dev-db/sqlite-3.3.8:3 )
102 ssl? ( dev-libs/openssl )
103 tk? (
104 >=dev-lang/tk-8.0
105 dev-tcltk/blt
106 dev-tcltk/tix
107 )
108 xml? ( >=dev-libs/expat-2.1 )
109 )
110 !!<sys-apps/portage-2.1.9"
111 DEPEND="${RDEPEND}
112 virtual/pkgconfig
113 >=sys-devel/autoconf-2.65
114 !sys-devel/gcc[libffi]"
115 RDEPEND+=" !build? ( app-misc/mime-types )
116 doc? ( dev-python/python-docs:${SLOT} )"
117 PDEPEND="app-admin/eselect-python
118 app-admin/python-updater"
119
120 S="${WORKDIR}/${MY_P}"
121
122 pkg_setup() {
123 if use berkdb; then
124 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
125 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
126 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
127 ewarn "is provided by dev-python/bsddb3."
128 else
129 if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
130 ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
131 ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
132 ewarn "You might need to migrate your databases."
133 fi
134 fi
135 }
136
137 src_prepare() {
138 # Ensure that internal copies of expat, libffi and zlib are not used.
139 rm -r Modules/expat || die
140 rm -r Modules/_ctypes/libffi* || die
141 rm -r Modules/zlib || die
142
143 if tc-is-cross-compiler; then
144 local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
145 fi
146
147 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
148
149 # Fix for cross-compiling.
150 epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
151
152 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
153 Lib/distutils/command/install.py \
154 Lib/distutils/sysconfig.py \
155 Lib/site.py \
156 Lib/sysconfig.py \
157 Lib/test/test_site.py \
158 Makefile.pre.in \
159 Modules/Setup.dist \
160 Modules/getpath.c \
161 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
162
163 epatch_user
164
165 eautoconf
166 eautoheader
167 }
168
169 src_configure() {
170 if use build; then
171 # Disable extraneous modules with extra dependencies.
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-flagq -O3; then
210 is-flagq -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 # Force some tests that try to poke fs paths.
216 export ac_cv_file__dev_ptc=no
217 export ac_cv_file__dev_ptmx=yes
218 fi
219
220 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
221 tc-export CXX
222 # The configure script fails to use pkg-config correctly.
223 # http://bugs.python.org/issue15506
224 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
225
226 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
227 # Needed on FreeBSD unless Python 2.7 is already installed.
228 # Please query BSD team before removing this!
229 append-ldflags "-L."
230
231 local dbmliborder
232 if use gdbm; then
233 dbmliborder+="${dbmliborder:+:}gdbm"
234 fi
235 if use berkdb; then
236 dbmliborder+="${dbmliborder:+:}bdb"
237 fi
238
239 BUILD_DIR="${WORKDIR}/${CHOST}"
240 mkdir -p "${BUILD_DIR}" || die
241 cd "${BUILD_DIR}" || die
242
243 ECONF_SOURCE="${S}" OPT="" \
244 econf \
245 --with-fpectl \
246 --enable-shared \
247 $(use_enable ipv6) \
248 $(use_with threads) \
249 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
250 --infodir='${prefix}/share/info' \
251 --mandir='${prefix}/share/man' \
252 --with-dbmliborder="${dbmliborder}" \
253 --with-libc="" \
254 --enable-loadable-sqlite-extensions \
255 --with-system-expat \
256 --with-system-ffi
257
258 if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
259 eerror "configure has detected that the sem_open function is broken."
260 eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
261 die "Broken sem_open function (bug 496328)"
262 fi
263 }
264
265 src_compile() {
266 # Avoid invoking pgen for cross-compiles.
267 touch Include/graminit.h Python/graminit.c
268
269 cd "${BUILD_DIR}" || die
270 emake
271
272 # Work around bug 329499. See also bug 413751 and 457194.
273 if has_version dev-libs/libffi[pax_kernel]; then
274 pax-mark E python
275 else
276 pax-mark m python
277 fi
278 }
279
280 src_test() {
281 # Tests will not work when cross compiling.
282 if tc-is-cross-compiler; then
283 elog "Disabling tests due to crosscompiling."
284 return
285 fi
286
287 cd "${BUILD_DIR}" || die
288
289 # Skip failing tests.
290 local skipped_tests="distutils gdb"
291
292 for test in ${skipped_tests}; do
293 mv "${S}"/Lib/test/test_${test}.py "${T}"
294 done
295
296 # Rerun failed tests in verbose mode (regrtest -w).
297 emake test EXTRATESTOPTS="-w" < /dev/tty
298 local result="$?"
299
300 for test in ${skipped_tests}; do
301 mv "${T}/test_${test}.py" "${S}"/Lib/test
302 done
303
304 elog "The following tests have been skipped:"
305 for test in ${skipped_tests}; do
306 elog "test_${test}.py"
307 done
308
309 elog "If you would like to run them, you may:"
310 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
311 elog "and run the tests separately."
312
313 if [[ "${result}" -ne 0 ]]; then
314 die "emake test failed"
315 fi
316 }
317
318 src_install() {
319 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
320
321 cd "${BUILD_DIR}" || die
322 emake DESTDIR="${D}" altinstall
323
324 sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
325
326 # Backwards compat with Gentoo divergence.
327 dosym python${SLOT}-config /usr/bin/python-config-${SLOT}
328
329 # Fix collisions between different slots of Python.
330 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
331 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
332 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
333 rm -f "${ED}usr/bin/smtpd.py"
334
335 if use build; then
336 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
337 else
338 use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
339 use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
340 use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
341 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
342 fi
343
344 use threads || rm -r "${libdir}/multiprocessing" || die
345 use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
346
347 dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
348
349 if use examples; then
350 insinto /usr/share/doc/${PF}/examples
351 doins -r "${S}"/Tools
352 fi
353 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
354 local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
355 emake --no-print-directory -s -f - 2>/dev/null)
356 newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
357
358 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
359 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
360 sed \
361 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
362 -e "s:@PYDOC@:pydoc${SLOT}:" \
363 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
364
365 # for python-exec
366 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
367
368 # if not using a cross-compiler, use the fresh binary
369 if ! tc-is-cross-compiler; then
370 local PYTHON=./python
371 local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
372 fi
373
374 echo "EPYTHON='${EPYTHON}'" > epython.py
375 python_domodule epython.py
376 }
377
378 pkg_preinst() {
379 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
380 python_updater_warning="1"
381 fi
382 }
383
384 eselect_python_update() {
385 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
386 eselect python update
387 fi
388
389 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
390 eselect python update --python${PV%%.*}
391 fi
392 }
393
394 pkg_postinst() {
395 eselect_python_update
396
397 if [[ "${python_updater_warning}" == "1" ]]; then
398 ewarn "You have just upgraded from an older version of Python."
399 ewarn "You should switch active version of Python ${PV%%.*} and run"
400 ewarn "'python-updater [options]' to rebuild Python modules."
401 fi
402 }
403
404 pkg_postrm() {
405 eselect_python_update
406 }
407
408
409
410 1.1 dev-lang/python/python-3.4.1.ebuild
411
412 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.4.1.ebuild?rev=1.1&view=markup
413 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.4.1.ebuild?rev=1.1&content-type=text/plain
414
415 Index: python-3.4.1.ebuild
416 ===================================================================
417 # Copyright 1999-2014 Gentoo Foundation
418 # Distributed under the terms of the GNU General Public License v2
419 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.4.1.ebuild,v 1.1 2014/06/28 23:39:33 floppym Exp $
420
421 EAPI="4"
422 WANT_AUTOMAKE="none"
423 WANT_LIBTOOL="none"
424
425 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
426
427 MY_P="Python-${PV/_/}"
428 PATCHSET_VERSION="3.4.1-0"
429
430 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
431 HOMEPAGE="http://www.python.org/"
432 SRC_URI="http://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
433 http://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
434
435 LICENSE="PSF-2"
436 SLOT="3.4"
437 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
438 IUSE="build elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk wininst +xml"
439
440 # Do not add a dependency on dev-lang/python to this ebuild.
441 # If you need to apply a patch which requires python for bootstrapping, please
442 # run the bootstrap code on your dev box and include the results in the
443 # patchset. See bug 447752.
444
445 RDEPEND="app-arch/bzip2
446 app-arch/xz-utils
447 >=sys-libs/zlib-1.1.3
448 virtual/libffi
449 virtual/libintl
450 !build? (
451 gdbm? ( sys-libs/gdbm[berkdb] )
452 ncurses? (
453 >=sys-libs/ncurses-5.2
454 readline? ( >=sys-libs/readline-4.1 )
455 )
456 sqlite? ( >=dev-db/sqlite-3.3.8:3 )
457 ssl? ( dev-libs/openssl )
458 tk? (
459 >=dev-lang/tk-8.0
460 dev-tcltk/blt
461 dev-tcltk/tix
462 )
463 xml? ( >=dev-libs/expat-2.1 )
464 )
465 !!<sys-apps/sandbox-2.6-r1"
466 DEPEND="${RDEPEND}
467 virtual/pkgconfig
468 >=sys-devel/autoconf-2.65
469 !sys-devel/gcc[libffi]"
470 RDEPEND+=" !build? ( app-misc/mime-types )"
471 PDEPEND="app-admin/eselect-python
472 app-admin/python-updater"
473
474 S="${WORKDIR}/${MY_P}"
475
476 src_prepare() {
477 # Ensure that internal copies of expat, libffi and zlib are not used.
478 rm -fr Modules/expat
479 rm -fr Modules/_ctypes/libffi*
480 rm -fr Modules/zlib
481
482 if tc-is-cross-compiler; then
483 # Invokes BUILDPYTHON, which is built for the host arch
484 local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
485 fi
486
487 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
488
489 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
490 Lib/distutils/command/install.py \
491 Lib/distutils/sysconfig.py \
492 Lib/site.py \
493 Lib/sysconfig.py \
494 Lib/test/test_site.py \
495 Makefile.pre.in \
496 Modules/Setup.dist \
497 Modules/getpath.c \
498 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
499
500 # Disable ABI flags.
501 sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed"
502
503 epatch_user
504
505 eautoconf
506 eautoheader
507 }
508
509 src_configure() {
510 if use build; then
511 # Disable extraneous modules with extra dependencies.
512 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
513 export PYTHON_DISABLE_SSL="1"
514 else
515 local disable
516 use gdbm || disable+=" gdbm"
517 use ncurses || disable+=" _curses _curses_panel"
518 use readline || disable+=" readline"
519 use sqlite || disable+=" _sqlite3"
520 use ssl || export PYTHON_DISABLE_SSL="1"
521 use tk || disable+=" _tkinter"
522 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
523 export PYTHON_DISABLE_MODULES="${disable}"
524
525 if ! use xml; then
526 ewarn "You have configured Python without XML support."
527 ewarn "This is NOT a recommended configuration as you"
528 ewarn "may face problems parsing any XML documents."
529 fi
530 fi
531
532 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
533 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
534 fi
535
536 if [[ "$(gcc-major-version)" -ge 4 ]]; then
537 append-flags -fwrapv
538 fi
539
540 filter-flags -malign-double
541
542 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
543
544 # https://bugs.gentoo.org/show_bug.cgi?id=50309
545 if is-flagq -O3; then
546 is-flagq -fstack-protector-all && replace-flags -O3 -O2
547 use hardened && replace-flags -O3 -O2
548 fi
549
550 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
551 tc-export CXX
552 # The configure script fails to use pkg-config correctly.
553 # http://bugs.python.org/issue15506
554 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
555
556 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
557 # Needed on FreeBSD unless Python 3.2 is already installed.
558 # Please query BSD team before removing this!
559 append-ldflags "-L."
560
561 local dbmliborder
562 if use gdbm; then
563 dbmliborder+="${dbmliborder:+:}gdbm"
564 fi
565
566 BUILD_DIR="${WORKDIR}/${CHOST}"
567 mkdir -p "${BUILD_DIR}" || die
568 cd "${BUILD_DIR}" || die
569
570 ECONF_SOURCE="${S}" OPT="" \
571 econf \
572 --with-fpectl \
573 --enable-shared \
574 $(use_enable ipv6) \
575 $(use_with threads) \
576 --infodir='${prefix}/share/info' \
577 --mandir='${prefix}/share/man' \
578 --with-computed-gotos \
579 --with-dbmliborder="${dbmliborder}" \
580 --with-libc="" \
581 --enable-loadable-sqlite-extensions \
582 --with-system-expat \
583 --with-system-ffi \
584 --without-ensurepip
585
586 if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
587 eerror "configure has detected that the sem_open function is broken."
588 eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
589 die "Broken sem_open function (bug 496328)"
590 fi
591 }
592
593 src_compile() {
594 # Avoid invoking pgen for cross-compiles.
595 touch Include/graminit.h Python/graminit.c || die
596
597 cd "${BUILD_DIR}" || die
598 emake CPPFLAGS="" CFLAGS="" LDFLAGS=""
599
600 # Work around bug 329499. See also bug 413751 and 457194.
601 if has_version dev-libs/libffi[pax_kernel]; then
602 pax-mark E python
603 else
604 pax-mark m python
605 fi
606 }
607
608 src_test() {
609 # Tests will not work when cross compiling.
610 if tc-is-cross-compiler; then
611 elog "Disabling tests due to crosscompiling."
612 return
613 fi
614
615 cd "${BUILD_DIR}" || die
616
617 # Skip failing tests.
618 local skipped_tests="gdb"
619
620 for test in ${skipped_tests}; do
621 mv "${S}"/Lib/test/test_${test}.py "${T}"
622 done
623
624 local -x PYTHONDONTWRITEBYTECODE=
625 emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
626 local result=$?
627
628 for test in ${skipped_tests}; do
629 mv "${T}/test_${test}.py" "${S}"/Lib/test
630 done
631
632 elog "The following tests have been skipped:"
633 for test in ${skipped_tests}; do
634 elog "test_${test}.py"
635 done
636
637 elog "If you would like to run them, you may:"
638 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
639 elog "and run the tests separately."
640
641 if [[ ${result} -ne 0 ]]; then
642 die "emake test failed"
643 fi
644 }
645
646 src_install() {
647 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
648
649 cd "${BUILD_DIR}" || die
650
651 emake DESTDIR="${D}" altinstall
652
653 sed \
654 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
655 -e "s/\(PY_LDFLAGS=\).*/\1/" \
656 -i "${libdir}/config-${SLOT}/Makefile" || die "sed failed"
657
658 # Backwards compat with Gentoo divergence.
659 dosym python${SLOT}-config /usr/bin/python-config-${SLOT}
660
661 # Fix collisions between different slots of Python.
662 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
663
664 if use build; then
665 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,sqlite3,test,tkinter}
666 else
667 use elibc_uclibc && rm -fr "${libdir}/test"
668 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
669 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
670 fi
671
672 use threads || rm -fr "${libdir}/multiprocessing"
673 use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
674
675 dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
676
677 if use examples; then
678 insinto /usr/share/doc/${PF}/examples
679 find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
680 doins -r "${S}"/Tools
681 fi
682 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
683 local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
684 emake --no-print-directory -s -f - 2>/dev/null)
685 newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
686
687 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
688 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
689 sed \
690 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
691 -e "s:@PYDOC@:pydoc${SLOT}:" \
692 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
693
694 # for python-exec
695 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
696
697 # if not using a cross-compiler, use the fresh binary
698 if ! tc-is-cross-compiler; then
699 local PYTHON=./python
700 local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
701 fi
702
703 echo "EPYTHON='${EPYTHON}'" > epython.py
704 python_domodule epython.py
705 }
706
707 pkg_preinst() {
708 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
709 python_updater_warning="1"
710 fi
711 }
712
713 eselect_python_update() {
714 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
715 eselect python update
716 fi
717
718 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
719 eselect python update --python${PV%%.*}
720 fi
721 }
722
723 pkg_postinst() {
724 eselect_python_update
725
726 if [[ "${python_updater_warning}" == "1" ]]; then
727 ewarn "You have just upgraded from an older version of Python."
728 ewarn
729 ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
730 fi
731 }
732
733 pkg_postrm() {
734 eselect_python_update
735 }