Gentoo Archives: gentoo-commits

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