Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: python-2.7.3-r3.ebuild python-2.5.4-r5.ebuild python-3.2.3-r2.ebuild python-3.3.0-r1.ebuild python-3.1.5-r1.ebuild python-2.6.8-r1.ebuild ChangeLog
Date: Fri, 30 Nov 2012 13:25:30
Message-Id: 20121130132518.23B3820C65@flycatcher.gentoo.org
1 mgorny 12/11/30 13:25:18
2
3 Modified: ChangeLog
4 Added: python-2.7.3-r3.ebuild python-2.5.4-r5.ebuild
5 python-3.2.3-r2.ebuild python-3.3.0-r1.ebuild
6 python-3.1.5-r1.ebuild python-2.6.8-r1.ebuild
7 Log:
8 Introduce a cleaned up, -r1-quality Python ebuilds. Stop using python.eclass, install epython module for python-exec.
9
10 (Portage version: 2.2.0_alpha143/cvs/Linux x86_64, signed Manifest commit with key 42B9401D)
11
12 Revision Changes Path
13 1.622 dev-lang/python/ChangeLog
14
15 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.622&view=markup
16 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.622&content-type=text/plain
17 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?r1=1.621&r2=1.622
18
19 Index: ChangeLog
20 ===================================================================
21 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
22 retrieving revision 1.621
23 retrieving revision 1.622
24 diff -u -r1.621 -r1.622
25 --- ChangeLog 14 Oct 2012 14:48:25 -0000 1.621
26 +++ ChangeLog 30 Nov 2012 13:25:17 -0000 1.622
27 @@ -1,6 +1,19 @@
28 # ChangeLog for dev-lang/python
29 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
30 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.621 2012/10/14 14:48:25 armin76 Exp $
31 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.622 2012/11/30 13:25:17 mgorny Exp $
32 +
33 +*python-2.7.3-r3 (30 Nov 2012)
34 +*python-3.3.0-r1 (30 Nov 2012)
35 +*python-2.6.8-r1 (30 Nov 2012)
36 +*python-2.5.4-r5 (30 Nov 2012)
37 +*python-3.2.3-r2 (30 Nov 2012)
38 +*python-3.1.5-r1 (30 Nov 2012)
39 +
40 + 30 Nov 2012; Michał Górny <mgorny@g.o> +python-2.5.4-r5.ebuild,
41 + +python-2.6.8-r1.ebuild, +python-2.7.3-r3.ebuild, +python-3.1.5-r1.ebuild,
42 + +python-3.2.3-r2.ebuild, +python-3.3.0-r1.ebuild:
43 + Introduce a cleaned up, -r1-quality Python ebuilds. Stop using python.eclass,
44 + install epython module for python-exec.
45
46 14 Oct 2012; Raúl Porcel <armin76@g.o> python-3.1.5.ebuild:
47 ia64/m68k/s390/sh/sparc stable
48
49
50
51 1.1 dev-lang/python/python-2.7.3-r3.ebuild
52
53 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild?rev=1.1&view=markup
54 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild?rev=1.1&content-type=text/plain
55
56 Index: python-2.7.3-r3.ebuild
57 ===================================================================
58 # Copyright 1999-2012 Gentoo Foundation
59 # Distributed under the terms of the GNU General Public License v2
60 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r3.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
61
62 EAPI="2"
63 WANT_AUTOMAKE="none"
64 WANT_LIBTOOL="none"
65
66 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
67
68 MY_P="Python-${PV}"
69 PATCHSET_REVISION="1"
70
71 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
72 HOMEPAGE="http://www.python.org/"
73 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
74 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
75
76 LICENSE="PSF-2"
77 SLOT="2.7"
78 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
79 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
80
81 RDEPEND="app-arch/bzip2
82 >=sys-libs/zlib-1.1.3
83 virtual/libffi
84 virtual/libintl
85 !build? (
86 berkdb? ( || (
87 sys-libs/db:4.8
88 sys-libs/db:4.7
89 sys-libs/db:4.6
90 sys-libs/db:4.5
91 sys-libs/db:4.4
92 sys-libs/db:4.3
93 sys-libs/db:4.2
94 ) )
95 gdbm? ( sys-libs/gdbm[berkdb] )
96 ncurses? (
97 >=sys-libs/ncurses-5.2
98 readline? ( >=sys-libs/readline-4.1 )
99 )
100 sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] )
101 ssl? ( dev-libs/openssl )
102 tk? (
103 >=dev-lang/tk-8.0
104 dev-tcltk/blt
105 )
106 xml? ( >=dev-libs/expat-2.1 )
107 )
108 !!<sys-apps/portage-2.1.9"
109 DEPEND="${RDEPEND}
110 virtual/pkgconfig
111 >=sys-devel/autoconf-2.65
112 !sys-devel/gcc[libffi]"
113 RDEPEND+=" !build? ( app-misc/mime-types )
114 doc? ( dev-python/python-docs:${SLOT} )"
115 PDEPEND="app-admin/eselect-python
116 app-admin/python-updater"
117
118 S="${WORKDIR}/${MY_P}"
119
120 pkg_setup() {
121 if use berkdb; then
122 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
123 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
124 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
125 ewarn "is provided by dev-python/bsddb3."
126 else
127 if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
128 ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
129 ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
130 ewarn "You might need to migrate your databases."
131 fi
132 fi
133 }
134
135 src_prepare() {
136 # Ensure that internal copies of expat, libffi and zlib are not used.
137 rm -fr Modules/expat
138 rm -fr Modules/_ctypes/libffi*
139 rm -fr Modules/zlib
140
141 local excluded_patches
142 if ! tc-is-cross-compiler; then
143 excluded_patches="*_all_crosscompile.patch"
144 fi
145
146 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
147 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
148
149 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
150 Lib/distutils/command/install.py \
151 Lib/distutils/sysconfig.py \
152 Lib/site.py \
153 Lib/sysconfig.py \
154 Lib/test/test_site.py \
155 Makefile.pre.in \
156 Modules/Setup.dist \
157 Modules/getpath.c \
158 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
159
160 eautoconf
161 eautoheader
162 }
163
164 src_configure() {
165 if use build; then
166 # Disable extraneous modules with extra dependencies.
167 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
168 export PYTHON_DISABLE_SSL="1"
169 else
170 # dbm module can be linked against berkdb or gdbm.
171 # Defaults to gdbm when both are enabled, #204343.
172 local disable
173 use berkdb || use gdbm || disable+=" dbm"
174 use berkdb || disable+=" _bsddb"
175 use gdbm || disable+=" gdbm"
176 use ncurses || disable+=" _curses _curses_panel"
177 use readline || disable+=" readline"
178 use sqlite || disable+=" _sqlite3"
179 use ssl || export PYTHON_DISABLE_SSL="1"
180 use tk || disable+=" _tkinter"
181 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
182 export PYTHON_DISABLE_MODULES="${disable}"
183
184 if ! use xml; then
185 ewarn "You have configured Python without XML support."
186 ewarn "This is NOT a recommended configuration as you"
187 ewarn "may face problems parsing any XML documents."
188 fi
189 fi
190
191 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
192 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
193 fi
194
195 if [[ "$(gcc-major-version)" -ge 4 ]]; then
196 append-flags -fwrapv
197 fi
198
199 filter-flags -malign-double
200
201 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
202
203 # https://bugs.gentoo.org/show_bug.cgi?id=50309
204 if is-flagq -O3; then
205 is-flagq -fstack-protector-all && replace-flags -O3 -O2
206 use hardened && replace-flags -O3 -O2
207 fi
208
209 if tc-is-cross-compiler; then
210 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
211 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
212 emake python Parser/pgen || die "cross-make failed"
213 mv python hostpython
214 mv Parser/pgen Parser/hostpgen
215 make distclean
216 sed -i \
217 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
218 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
219 Makefile.pre.in || die "sed failed"
220 fi
221
222 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
223 tc-export CXX
224 # The configure script fails to use pkg-config correctly.
225 # http://bugs.python.org/issue15506
226 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
227
228 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
229 # Needed on FreeBSD unless Python 2.7 is already installed.
230 # Please query BSD team before removing this!
231 append-ldflags "-L."
232
233 local dbmliborder
234 if use gdbm; then
235 dbmliborder+="${dbmliborder:+:}gdbm"
236 fi
237 if use berkdb; then
238 dbmliborder+="${dbmliborder:+:}bdb"
239 fi
240
241 OPT="" econf \
242 --with-fpectl \
243 --enable-shared \
244 $(use_enable ipv6) \
245 $(use_with threads) \
246 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
247 --infodir='${prefix}/share/info' \
248 --mandir='${prefix}/share/man' \
249 --with-dbmliborder="${dbmliborder}" \
250 --with-libc="" \
251 --enable-loadable-sqlite-extensions \
252 --with-system-expat \
253 --with-system-ffi
254 }
255
256 src_compile() {
257 emake EPYTHON="python${PV%%.*}" || die "emake failed"
258
259 # Work around bug 329499. See also bug 413751.
260 pax-mark m python
261 }
262
263 src_test() {
264 # Tests will not work when cross compiling.
265 if tc-is-cross-compiler; then
266 elog "Disabling tests due to crosscompiling."
267 return
268 fi
269
270 # Skip failing tests.
271 local skipped_tests="distutils gdb"
272
273 for test in ${skipped_tests}; do
274 mv Lib/test/test_${test}.py "${T}"
275 done
276
277 # Rerun failed tests in verbose mode (regrtest -w).
278 emake test EXTRATESTOPTS="-w" < /dev/tty
279 local result="$?"
280
281 for test in ${skipped_tests}; do
282 mv "${T}/test_${test}.py" Lib/test
283 done
284
285 elog "The following tests have been skipped:"
286 for test in ${skipped_tests}; do
287 elog "test_${test}.py"
288 done
289
290 elog "If you would like to run them, you may:"
291 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
292 elog "and run the tests separately."
293
294 python_disable_pyc
295
296 if [[ "${result}" -ne 0 ]]; then
297 die "emake test failed"
298 fi
299 }
300
301 src_install() {
302 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
303
304 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
305
306 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
307
308 sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
309
310 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
311
312 # Fix collisions between different slots of Python.
313 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
314 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
315 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
316 rm -f "${ED}usr/bin/smtpd.py"
317
318 if use build; then
319 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
320 else
321 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
322 use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*}
323 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
324 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
325 fi
326
327 use threads || rm -fr "${libdir}/multiprocessing"
328 use wininst || rm -f "${libdir})/distutils/command/"wininst-*.exe
329
330 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
331
332 if use examples; then
333 insinto /usr/share/doc/${PF}/examples
334 doins -r Tools || die "doins failed"
335 fi
336
337 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
338 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
339 sed \
340 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
341 -e "s:@PYDOC@:pydoc${SLOT}:" \
342 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
343
344 # for python-exec
345 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
346 echo "EPYTHON='${EPYTHON}'" > epython.py
347 python_domodule epython.py
348 }
349
350 pkg_preinst() {
351 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
352 python_updater_warning="1"
353 fi
354 }
355
356 eselect_python_update() {
357 [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/"
358
359 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
360 eselect python update
361 fi
362
363 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
364 eselect python update --python${PV%%.*}
365 fi
366 }
367
368 pkg_postinst() {
369 eselect_python_update
370
371 if [[ "${python_updater_warning}" == "1" ]]; then
372 ewarn "You have just upgraded from an older version of Python."
373 ewarn "You should switch active version of Python ${PV%%.*} and run"
374 ewarn "'python-updater [options]' to rebuild Python modules."
375 fi
376 }
377
378 pkg_postrm() {
379 eselect_python_update
380 }
381
382
383
384 1.1 dev-lang/python/python-2.5.4-r5.ebuild
385
386 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.5.4-r5.ebuild?rev=1.1&view=markup
387 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.5.4-r5.ebuild?rev=1.1&content-type=text/plain
388
389 Index: python-2.5.4-r5.ebuild
390 ===================================================================
391 # Copyright 1999-2012 Gentoo Foundation
392 # Distributed under the terms of the GNU General Public License v2
393 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.5.4-r5.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
394
395 EAPI="1"
396
397 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
398
399 MY_P="Python-${PV}"
400
401 PATCHSET_REVISION="3"
402
403 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
404 HOMEPAGE="http://www.python.org/"
405 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
406 mirror://gentoo/python-gentoo-patches-${PV}$([[ "${PATCHSET_REVISION}" != "0" ]] && echo "-r${PATCHSET_REVISION}").tar.bz2"
407
408 LICENSE="PSF-2.2"
409 SLOT="2.5"
410 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
411 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
412
413 # NOTE: dev-python/{elementtree,celementtree,pysqlite}
414 # do not conflict with the ones in python proper. - liquidx
415
416 RDEPEND=">=sys-libs/zlib-1.1.3
417 virtual/libffi
418 virtual/libintl
419 !build? (
420 berkdb? ( || (
421 sys-libs/db:4.5
422 sys-libs/db:4.4
423 sys-libs/db:4.3
424 sys-libs/db:4.2
425 ) )
426 gdbm? ( sys-libs/gdbm )
427 ncurses? (
428 >=sys-libs/ncurses-5.2
429 readline? ( >=sys-libs/readline-4.1 )
430 )
431 sqlite? ( >=dev-db/sqlite-3 )
432 ssl? ( dev-libs/openssl )
433 tk? ( >=dev-lang/tk-8.0 )
434 xml? ( >=dev-libs/expat-2 )
435 )
436 doc? ( dev-python/python-docs:${SLOT} )"
437 DEPEND="${RDEPEND}
438 virtual/pkgconfig"
439 RDEPEND+=" !build? ( app-misc/mime-types )"
440 PDEPEND="app-admin/eselect-python
441 app-admin/python-updater"
442
443 S="${WORKDIR}/${MY_P}"
444
445 pkg_setup() {
446 if use berkdb; then
447 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
448 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
449 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
450 ewarn "is provided by dev-python/bsddb3."
451 fi
452 }
453
454 src_unpack() {
455 unpack ${A}
456 cd "${S}"
457
458 # Ensure that internal copies of expat, libffi and zlib are not used.
459 rm -fr Modules/expat
460 rm -fr Modules/_ctypes/libffi*
461 rm -fr Modules/zlib
462
463 if tc-is-cross-compiler; then
464 epatch "${FILESDIR}/python-2.5-cross-printf.patch"
465 else
466 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
467 fi
468
469 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
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 Makefile.pre.in \
476 Modules/Setup.dist \
477 Modules/getpath.c \
478 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
479
480 # Fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
481 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
482 [[ "${ARCH}" == "hppa" ]] && sed -e "s/utimes //" -i "${S}/configure"
483
484 if ! use wininst; then
485 # Remove Microsoft Windows executables.
486 rm Lib/distutils/command/wininst-*.exe
487 fi
488
489 # Linux-3 compat. Bug #374579 (upstream issue12571)
490 cp -r "${S}/Lib/plat-linux2" "${S}/Lib/plat-linux3" || die
491
492 eautoreconf
493 }
494
495 src_configure() {
496 # Disable extraneous modules with extra dependencies.
497 if use build; then
498 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter pyexpat"
499 export PYTHON_DISABLE_SSL="1"
500 else
501 # dbm module can be linked against berkdb or gdbm.
502 # Defaults to gdbm when both are enabled, #204343.
503 local disable
504 use berkdb || use gdbm || disable+=" dbm"
505 use berkdb || disable+=" _bsddb"
506 use gdbm || disable+=" gdbm"
507 use ncurses || disable+=" _curses _curses_panel"
508 use readline || disable+=" readline"
509 use sqlite || disable+=" _sqlite3"
510 use ssl || export PYTHON_DISABLE_SSL="1"
511 use tk || disable+=" _tkinter"
512 use xml || disable+=" pyexpat"
513 export PYTHON_DISABLE_MODULES="${disable}"
514
515 if ! use xml; then
516 ewarn "You have configured Python without XML support."
517 ewarn "This is NOT a recommended configuration as you"
518 ewarn "may face problems parsing any XML documents."
519 fi
520 fi
521
522 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
523 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
524 fi
525
526 if [[ "$(gcc-major-version)" -ge 4 ]]; then
527 append-flags -fwrapv
528 fi
529
530 export OPT="${CFLAGS}"
531
532 filter-flags -malign-double
533
534 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
535
536 # https://bugs.gentoo.org/show_bug.cgi?id=50309
537 if is-flagq -O3; then
538 is-flagq -fstack-protector-all && replace-flags -O3 -O2
539 use hardened && replace-flags -O3 -O2
540 fi
541
542 if tc-is-cross-compiler; then
543 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
544 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
545 emake python Parser/pgen || die "cross-make failed"
546 mv python hostpython
547 mv Parser/pgen Parser/hostpgen
548 make distclean
549 sed -i \
550 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
551 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
552 Makefile.pre.in || die "sed failed"
553 fi
554
555 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
556 tc-export CXX
557 # The configure script fails to use pkg-config correctly.
558 # http://bugs.python.org/issue15506
559 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
560
561 # Set LDFLAGS so we link modules with -lpython2.5 correctly.
562 # Needed on FreeBSD unless Python 2.5 is already installed.
563 # Please query BSD team before removing this!
564 append-ldflags "-L."
565
566 econf \
567 --with-fpectl \
568 --enable-shared \
569 $(use_enable ipv6) \
570 $(use_with threads) \
571 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
572 --infodir='${prefix}/share/info' \
573 --mandir='${prefix}/share/man' \
574 --with-libc="" \
575 --with-system-ffi
576 }
577
578 src_compile() {
579 src_configure
580 emake || die "emake failed"
581 }
582
583 src_test() {
584 # Tests will not work when cross compiling.
585 if tc-is-cross-compiler; then
586 elog "Disabling tests due to crosscompiling."
587 return
588 fi
589
590 # Skip failing tests.
591 local skip_tests="distutils global mimetools minidom mmap posix pyexpat sax strptime subprocess syntax tcl time urllib urllib2 xml_etree"
592
593 # test_ctypes fails with PAX kernel (bug #234498).
594 host-is-pax && skip_tests+=" ctypes"
595
596 for test in ${skip_tests}; do
597 mv "${S}/Lib/test/test_${test}.py" "${T}"
598 done
599
600 # Redirect stdin from /dev/tty as a workaround for bug #248081.
601 # Rerun failed tests in verbose mode (regrtest -w).
602 EXTRATESTOPTS="-w" emake test < /dev/tty
603 local result="$?"
604
605 for test in ${skip_tests}; do
606 mv "${T}/test_${test}.py" "${S}/Lib/test/test_${test}.py"
607 done
608
609 elog "The following tests have been skipped:"
610 for test in ${skip_tests}; do
611 elog "test_${test}.py"
612 done
613
614 elog "If you would like to run them, you may:"
615 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
616 elog "and run the tests separately."
617
618 if [[ "${result}" -ne 0 ]]; then
619 die "emake test failed"
620 fi
621 }
622
623 src_install() {
624 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
625
626 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
627
628 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
629
630 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
631
632 # Fix collisions between different slots of Python.
633 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
634 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
635 mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
636 rm -f "${ED}usr/bin/smtpd.py"
637
638 # Fix the OPT variable so that it doesn't have any flags listed in it.
639 # Prevents the problem with compiling things with conflicting flags later.
640 sed -e "s:^OPT=.*:OPT=\t\t-DNDEBUG:" -i "${libdir}/config/Makefile"
641
642 if use build; then
643 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,idlelib,lib-tk,sqlite3,test}
644 else
645 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
646 use berkdb || rm -fr "${libdir}/"{bsddb,test/test_bsddb*}
647 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
648 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
649 fi
650
651 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
652
653 if use examples; then
654 insinto /usr/share/doc/${PF}/examples
655 doins -r "${S}/Tools" || die "doins failed"
656 fi
657
658 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
659 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
660 sed \
661 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
662 -e "s:@PYDOC@:pydoc${SLOT}:" \
663 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
664
665 # for python-exec
666 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
667 echo "EPYTHON='${EPYTHON}'" > epython.py
668 python_domodule epython.py
669 }
670
671 pkg_preinst() {
672 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.5" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then
673 python_updater_warning="1"
674 fi
675 }
676
677 eselect_python_update() {
678 local eselect_python_options
679 [[ "$(eselect python show)" == "python2."* ]] && eselect_python_options="--python2"
680
681 # Create python2 symlink.
682 eselect python update --python2 > /dev/null
683
684 eselect python update ${eselect_python_options}
685 }
686
687 pkg_postinst() {
688 eselect_python_update
689
690 if [[ "${python_updater_warning}" == "1" ]]; then
691 ewarn
692 ewarn "\e[1;31m************************************************************************\e[0m"
693 ewarn
694 ewarn "You have just upgraded from an older version of Python."
695 ewarn "You should run 'python-updater \${options}' to rebuild Python modules."
696 ewarn
697 ewarn "\e[1;31m************************************************************************\e[0m"
698 ewarn
699 ebeep 12
700 fi
701 }
702
703 pkg_postrm() {
704 eselect_python_update
705 }
706
707
708
709 1.1 dev-lang/python/python-3.2.3-r2.ebuild
710
711 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.2.3-r2.ebuild?rev=1.1&view=markup
712 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.2.3-r2.ebuild?rev=1.1&content-type=text/plain
713
714 Index: python-3.2.3-r2.ebuild
715 ===================================================================
716 # Copyright 1999-2012 Gentoo Foundation
717 # Distributed under the terms of the GNU General Public License v2
718 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.2.3-r2.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
719
720 EAPI="3"
721 WANT_AUTOMAKE="none"
722 WANT_LIBTOOL="none"
723
724 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
725
726 MY_P="Python-${PV}"
727 PATCHSET_REVISION="0"
728
729 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
730 HOMEPAGE="http://www.python.org/"
731 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
732 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
733
734 LICENSE="PSF-2"
735 SLOT="3.2"
736 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
737 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
738
739 RDEPEND="app-arch/bzip2
740 >=sys-libs/zlib-1.1.3
741 virtual/libffi
742 virtual/libintl
743 !build? (
744 gdbm? ( sys-libs/gdbm[berkdb] )
745 ncurses? (
746 >=sys-libs/ncurses-5.2
747 readline? ( >=sys-libs/readline-4.1 )
748 )
749 sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] )
750 ssl? ( dev-libs/openssl )
751 tk? (
752 >=dev-lang/tk-8.0
753 dev-tcltk/blt
754 )
755 xml? ( >=dev-libs/expat-2.1 )
756 )"
757 DEPEND="${RDEPEND}
758 virtual/pkgconfig
759 >=sys-devel/autoconf-2.65
760 !sys-devel/gcc[libffi]"
761 RDEPEND+=" !build? ( app-misc/mime-types )
762 doc? ( dev-python/python-docs:${SLOT} )"
763 PDEPEND="app-admin/eselect-python
764 app-admin/python-updater"
765
766 S="${WORKDIR}/${MY_P}"
767
768 pkg_setup() {
769 if [[ "${PV}" =~ ^3\.2(\.[1234])?(_pre)? ]]; then
770 rm -f "${EROOT}usr/$(get_libdir)/llibpython3.so"
771 else
772 die "Deprecated code not deleted"
773 fi
774 }
775
776 src_prepare() {
777 # Ensure that internal copies of expat, libffi and zlib are not used.
778 rm -fr Modules/expat
779 rm -fr Modules/_ctypes/libffi*
780 rm -fr Modules/zlib
781
782 local excluded_patches
783 if ! tc-is-cross-compiler; then
784 excluded_patches="*_all_crosscompile.patch"
785 fi
786
787 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
788 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
789 epatch "${FILESDIR}"/${PN}-3.2.3-x32.patch
790
791 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
792 Lib/distutils/command/install.py \
793 Lib/distutils/sysconfig.py \
794 Lib/site.py \
795 Lib/sysconfig.py \
796 Lib/test/test_site.py \
797 Makefile.pre.in \
798 Modules/Setup.dist \
799 Modules/getpath.c \
800 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
801
802 # Disable ABI flags.
803 sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.in || die "sed failed"
804
805 eautoconf
806 eautoheader
807 }
808
809 src_configure() {
810 if use build; then
811 # Disable extraneous modules with extra dependencies.
812 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
813 export PYTHON_DISABLE_SSL="1"
814 else
815 local disable
816 use gdbm || disable+=" gdbm"
817 use ncurses || disable+=" _curses _curses_panel"
818 use readline || disable+=" readline"
819 use sqlite || disable+=" _sqlite3"
820 use ssl || export PYTHON_DISABLE_SSL="1"
821 use tk || disable+=" _tkinter"
822 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
823 export PYTHON_DISABLE_MODULES="${disable}"
824
825 if ! use xml; then
826 ewarn "You have configured Python without XML support."
827 ewarn "This is NOT a recommended configuration as you"
828 ewarn "may face problems parsing any XML documents."
829 fi
830 fi
831
832 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
833 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
834 fi
835
836 if [[ "$(gcc-major-version)" -ge 4 ]]; then
837 append-flags -fwrapv
838 fi
839
840 filter-flags -malign-double
841
842 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
843
844 # https://bugs.gentoo.org/show_bug.cgi?id=50309
845 if is-flagq -O3; then
846 is-flagq -fstack-protector-all && replace-flags -O3 -O2
847 use hardened && replace-flags -O3 -O2
848 fi
849
850 if tc-is-cross-compiler; then
851 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
852 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
853 emake python Parser/pgen || die "cross-make failed"
854 mv python hostpython
855 mv Parser/pgen Parser/hostpgen
856 make distclean
857 sed -i \
858 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
859 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
860 Makefile.pre.in || die "sed failed"
861 fi
862
863 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
864 tc-export CXX
865 # The configure script fails to use pkg-config correctly.
866 # http://bugs.python.org/issue15506
867 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
868
869 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
870 # Needed on FreeBSD unless Python 3.2 is already installed.
871 # Please query BSD team before removing this!
872 append-ldflags "-L."
873
874 local dbmliborder
875 if use gdbm; then
876 dbmliborder+="${dbmliborder:+:}gdbm"
877 fi
878
879 OPT="" econf \
880 --with-fpectl \
881 --enable-shared \
882 $(use_enable ipv6) \
883 $(use_with threads) \
884 $(use_with wide-unicode) \
885 --infodir='${prefix}/share/info' \
886 --mandir='${prefix}/share/man' \
887 --with-computed-gotos \
888 --with-dbmliborder="${dbmliborder}" \
889 --with-libc="" \
890 --enable-loadable-sqlite-extensions \
891 --with-system-expat \
892 --with-system-ffi
893 }
894
895 src_compile() {
896 emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed"
897
898 # Work around bug 329499. See also bug 413751.
899 pax-mark m python
900 }
901
902 src_test() {
903 # Tests will not work when cross compiling.
904 if tc-is-cross-compiler; then
905 elog "Disabling tests due to crosscompiling."
906 return
907 fi
908
909 # Skip failing tests.
910 local skipped_tests="gdb"
911
912 for test in ${skipped_tests}; do
913 mv Lib/test/test_${test}.py "${T}"
914 done
915
916 # Rerun failed tests in verbose mode (regrtest -w).
917 emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty
918 local result="$?"
919
920 for test in ${skipped_tests}; do
921 mv "${T}/test_${test}.py" Lib/test
922 done
923
924 elog "The following tests have been skipped:"
925 for test in ${skipped_tests}; do
926 elog "test_${test}.py"
927 done
928
929 elog "If you would like to run them, you may:"
930 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
931 elog "and run the tests separately."
932
933 if [[ "${result}" -ne 0 ]]; then
934 die "emake test failed"
935 fi
936 }
937
938 src_install() {
939 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
940
941 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
942
943 sed \
944 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
945 -e "s/\(PY_LDFLAGS=\).*/\1/" \
946 -i "${libdir}/config-${SLOT}/Makefile" || die "sed failed"
947
948 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
949
950 # Fix collisions between different slots of Python.
951 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
952
953 if use build; then
954 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,sqlite3,test,tkinter}
955 else
956 use elibc_uclibc && rm -fr "${libdir}/test"
957 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
958 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
959 fi
960
961 use threads || rm -fr "${libdir}/multiprocessing"
962 use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
963
964 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
965
966 if use examples; then
967 insinto /usr/share/doc/${PF}/examples
968 find Tools -name __pycache__ -print0 | xargs -0 rm -fr
969 doins -r Tools || die "doins failed"
970 fi
971
972 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
973 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
974 sed \
975 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
976 -e "s:@PYDOC@:pydoc${SLOT}:" \
977 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
978
979 # for python-exec
980 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
981 echo "EPYTHON='${EPYTHON}'" > epython.py
982 python_domodule epython.py
983 }
984
985 pkg_preinst() {
986 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
987 python_updater_warning="1"
988 fi
989 }
990
991 eselect_python_update() {
992 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
993 eselect python update
994 fi
995
996 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
997 eselect python update --python${PV%%.*}
998 fi
999 }
1000
1001 pkg_postinst() {
1002 eselect_python_update
1003
1004 if [[ "${python_updater_warning}" == "1" ]]; then
1005 ewarn "You have just upgraded from an older version of Python."
1006 ewarn "You should switch active version of Python ${PV%%.*} and run"
1007 ewarn "'python-updater [options]' to rebuild Python modules."
1008 fi
1009 }
1010
1011 pkg_postrm() {
1012 eselect_python_update
1013 }
1014
1015
1016
1017 1.1 dev-lang/python/python-3.3.0-r1.ebuild
1018
1019 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.3.0-r1.ebuild?rev=1.1&view=markup
1020 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.3.0-r1.ebuild?rev=1.1&content-type=text/plain
1021
1022 Index: python-3.3.0-r1.ebuild
1023 ===================================================================
1024 # Copyright 1999-2012 Gentoo Foundation
1025 # Distributed under the terms of the GNU General Public License v2
1026 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.3.0-r1.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
1027
1028 EAPI="3"
1029 WANT_AUTOMAKE="none"
1030 WANT_LIBTOOL="none"
1031
1032 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
1033
1034 MY_P="Python-${PV}"
1035 PATCHSET_REVISION="1"
1036
1037 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
1038 HOMEPAGE="http://www.python.org/"
1039 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
1040 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
1041
1042 LICENSE="PSF-2"
1043 SLOT="3.3"
1044 KEYWORDS=""
1045 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk wininst +xml"
1046
1047 RDEPEND="app-arch/bzip2
1048 >=sys-libs/zlib-1.1.3
1049 virtual/libffi
1050 virtual/libintl
1051 !build? (
1052 gdbm? ( sys-libs/gdbm[berkdb] )
1053 ncurses? (
1054 >=sys-libs/ncurses-5.2
1055 readline? ( >=sys-libs/readline-4.1 )
1056 )
1057 sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] )
1058 ssl? ( dev-libs/openssl )
1059 tk? (
1060 >=dev-lang/tk-8.0
1061 dev-tcltk/blt
1062 )
1063 xml? ( >=dev-libs/expat-2.1 )
1064 )"
1065 DEPEND="${RDEPEND}
1066 virtual/pkgconfig
1067 >=sys-devel/autoconf-2.65
1068 !sys-devel/gcc[libffi]"
1069 RDEPEND+=" !build? ( app-misc/mime-types )
1070 doc? ( dev-python/python-docs:${SLOT} )"
1071 PDEPEND="app-admin/eselect-python
1072 app-admin/python-updater"
1073
1074 S="${WORKDIR}/${MY_P}"
1075
1076 src_prepare() {
1077 # Ensure that internal copies of expat, libffi and zlib are not used.
1078 rm -fr Modules/expat
1079 rm -fr Modules/_ctypes/libffi*
1080 rm -fr Modules/zlib
1081
1082 local excluded_patches
1083 if ! tc-is-cross-compiler; then
1084 excluded_patches="*_all_crosscompile.patch"
1085 fi
1086
1087 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
1088 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
1089
1090 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
1091 Lib/distutils/command/install.py \
1092 Lib/distutils/sysconfig.py \
1093 Lib/site.py \
1094 Lib/sysconfig.py \
1095 Lib/test/test_site.py \
1096 Makefile.pre.in \
1097 Modules/Setup.dist \
1098 Modules/getpath.c \
1099 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
1100
1101 # Disable ABI flags.
1102 sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed"
1103
1104 eautoconf
1105 eautoheader
1106 }
1107
1108 src_configure() {
1109 if use build; then
1110 # Disable extraneous modules with extra dependencies.
1111 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
1112 export PYTHON_DISABLE_SSL="1"
1113 else
1114 local disable
1115 use gdbm || disable+=" gdbm"
1116 use ncurses || disable+=" _curses _curses_panel"
1117 use readline || disable+=" readline"
1118 use sqlite || disable+=" _sqlite3"
1119 use ssl || export PYTHON_DISABLE_SSL="1"
1120 use tk || disable+=" _tkinter"
1121 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
1122 export PYTHON_DISABLE_MODULES="${disable}"
1123
1124 if ! use xml; then
1125 ewarn "You have configured Python without XML support."
1126 ewarn "This is NOT a recommended configuration as you"
1127 ewarn "may face problems parsing any XML documents."
1128 fi
1129 fi
1130
1131 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
1132 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
1133 fi
1134
1135 if [[ "$(gcc-major-version)" -ge 4 ]]; then
1136 append-flags -fwrapv
1137 fi
1138
1139 filter-flags -malign-double
1140
1141 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
1142
1143 # https://bugs.gentoo.org/show_bug.cgi?id=50309
1144 if is-flagq -O3; then
1145 is-flagq -fstack-protector-all && replace-flags -O3 -O2
1146 use hardened && replace-flags -O3 -O2
1147 fi
1148
1149 if tc-is-cross-compiler; then
1150 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
1151 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
1152 emake python Parser/pgen || die "cross-make failed"
1153 mv python hostpython
1154 mv Parser/pgen Parser/hostpgen
1155 make distclean
1156 sed -i \
1157 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
1158 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
1159 Makefile.pre.in || die "sed failed"
1160 fi
1161
1162 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
1163 tc-export CXX
1164 # The configure script fails to use pkg-config correctly.
1165 # http://bugs.python.org/issue15506
1166 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
1167
1168 # Set LDFLAGS so we link modules with -lpython3.2 correctly.
1169 # Needed on FreeBSD unless Python 3.2 is already installed.
1170 # Please query BSD team before removing this!
1171 append-ldflags "-L."
1172
1173 local dbmliborder
1174 if use gdbm; then
1175 dbmliborder+="${dbmliborder:+:}gdbm"
1176 fi
1177
1178 OPT="" econf \
1179 --with-fpectl \
1180 --enable-shared \
1181 $(use_enable ipv6) \
1182 $(use_with threads) \
1183 --infodir='${prefix}/share/info' \
1184 --mandir='${prefix}/share/man' \
1185 --with-computed-gotos \
1186 --with-dbmliborder="${dbmliborder}" \
1187 --with-libc="" \
1188 --enable-loadable-sqlite-extensions \
1189 --with-system-expat \
1190 --with-system-ffi
1191 }
1192
1193 src_compile() {
1194 emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed"
1195
1196 # Work around bug 329499. See also bug 413751.
1197 pax-mark m python
1198 }
1199
1200 src_test() {
1201 # Tests will not work when cross compiling.
1202 if tc-is-cross-compiler; then
1203 elog "Disabling tests due to crosscompiling."
1204 return
1205 fi
1206
1207 # Skip failing tests.
1208 local skipped_tests="gdb"
1209
1210 for test in ${skipped_tests}; do
1211 mv Lib/test/test_${test}.py "${T}"
1212 done
1213
1214 # Rerun failed tests in verbose mode (regrtest -w).
1215 emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty
1216 local result="$?"
1217
1218 for test in ${skipped_tests}; do
1219 mv "${T}/test_${test}.py" Lib/test
1220 done
1221
1222 elog "The following tests have been skipped:"
1223 for test in ${skipped_tests}; do
1224 elog "test_${test}.py"
1225 done
1226
1227 elog "If you would like to run them, you may:"
1228 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
1229 elog "and run the tests separately."
1230
1231 if [[ "${result}" -ne 0 ]]; then
1232 die "emake test failed"
1233 fi
1234 }
1235
1236 src_install() {
1237 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
1238
1239 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
1240
1241 sed \
1242 -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
1243 -e "s/\(PY_LDFLAGS=\).*/\1/" \
1244 -i "${libdir}/config-${SLOT}/Makefile" || die "sed failed"
1245
1246 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
1247
1248 # Fix collisions between different slots of Python.
1249 rm -f "${ED}usr/$(get_libdir)/libpython3.so"
1250
1251 if use build; then
1252 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,sqlite3,test,tkinter}
1253 else
1254 use elibc_uclibc && rm -fr "${libdir}/test"
1255 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
1256 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
1257 fi
1258
1259 use threads || rm -fr "${libdir}/multiprocessing"
1260 use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
1261
1262 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
1263
1264 if use examples; then
1265 insinto /usr/share/doc/${PF}/examples
1266 find Tools -name __pycache__ -print0 | xargs -0 rm -fr
1267 doins -r Tools || die "doins failed"
1268 fi
1269
1270 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
1271 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
1272 sed \
1273 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
1274 -e "s:@PYDOC@:pydoc${SLOT}:" \
1275 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
1276
1277 # for python-exec
1278 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
1279 echo "EPYTHON='${EPYTHON}'" > epython.py
1280 python_domodule epython.py
1281 }
1282
1283 pkg_preinst() {
1284 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
1285 python_updater_warning="1"
1286 fi
1287 }
1288
1289 eselect_python_update() {
1290 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
1291 eselect python update
1292 fi
1293
1294 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
1295 eselect python update --python${PV%%.*}
1296 fi
1297 }
1298
1299 pkg_postinst() {
1300 eselect_python_update
1301
1302 if [[ "${python_updater_warning}" == "1" ]]; then
1303 ewarn "You have just upgraded from an older version of Python."
1304 ewarn "You should switch active version of Python ${PV%%.*} and run"
1305 ewarn "'python-updater [options]' to rebuild Python modules."
1306 fi
1307 }
1308
1309 pkg_postrm() {
1310 eselect_python_update
1311 }
1312
1313
1314
1315 1.1 dev-lang/python/python-3.1.5-r1.ebuild
1316
1317 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.1.5-r1.ebuild?rev=1.1&view=markup
1318 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.1.5-r1.ebuild?rev=1.1&content-type=text/plain
1319
1320 Index: python-3.1.5-r1.ebuild
1321 ===================================================================
1322 # Copyright 1999-2012 Gentoo Foundation
1323 # Distributed under the terms of the GNU General Public License v2
1324 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.1.5-r1.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
1325
1326 EAPI="3"
1327 WANT_AUTOMAKE="none"
1328 WANT_LIBTOOL="none"
1329
1330 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
1331
1332 MY_P="Python-${PV}"
1333 PATCHSET_REVISION="0"
1334
1335 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
1336 HOMEPAGE="http://www.python.org/"
1337 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
1338 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
1339
1340 LICENSE="PSF-2"
1341 SLOT="3.1"
1342 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
1343 IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
1344
1345 RDEPEND="app-arch/bzip2
1346 >=sys-libs/zlib-1.1.3
1347 virtual/libffi
1348 virtual/libintl
1349 !build? (
1350 gdbm? ( sys-libs/gdbm[berkdb] )
1351 ncurses? (
1352 >=sys-libs/ncurses-5.2
1353 readline? ( >=sys-libs/readline-4.1 )
1354 )
1355 sqlite? ( >=dev-db/sqlite-3.3.3:3 )
1356 ssl? ( dev-libs/openssl )
1357 tk? (
1358 >=dev-lang/tk-8.0
1359 dev-tcltk/blt
1360 )
1361 xml? ( >=dev-libs/expat-2.1 )
1362 )"
1363 DEPEND="${RDEPEND}
1364 virtual/pkgconfig
1365 >=sys-devel/autoconf-2.61
1366 !sys-devel/gcc[libffi]"
1367 RDEPEND+=" !build? ( app-misc/mime-types )
1368 doc? ( dev-python/python-docs:${SLOT} )"
1369 PDEPEND="app-admin/eselect-python
1370 app-admin/python-updater"
1371
1372 S="${WORKDIR}/${MY_P}"
1373
1374 src_prepare() {
1375 # Ensure that internal copies of expat, libffi and zlib are not used.
1376 rm -fr Modules/expat
1377 rm -fr Modules/_ctypes/libffi*
1378 rm -fr Modules/zlib
1379
1380 local excluded_patches
1381 if ! tc-is-cross-compiler; then
1382 excluded_patches="*_all_crosscompile.patch"
1383 fi
1384
1385 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
1386 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
1387
1388 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
1389 Lib/distutils/command/install.py \
1390 Lib/distutils/sysconfig.py \
1391 Lib/site.py \
1392 Makefile.pre.in \
1393 Modules/Setup.dist \
1394 Modules/getpath.c \
1395 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
1396
1397 eautoconf
1398 eautoheader
1399 }
1400
1401 src_configure() {
1402 if use build; then
1403 # Disable extraneous modules with extra dependencies.
1404 export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
1405 export PYTHON_DISABLE_SSL="1"
1406 else
1407 local disable
1408 use gdbm || disable+=" gdbm"
1409 use ncurses || disable+=" _curses _curses_panel"
1410 use readline || disable+=" readline"
1411 use sqlite || disable+=" _sqlite3"
1412 use ssl || export PYTHON_DISABLE_SSL="1"
1413 use tk || disable+=" _tkinter"
1414 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
1415 export PYTHON_DISABLE_MODULES="${disable}"
1416
1417 if ! use xml; then
1418 ewarn "You have configured Python without XML support."
1419 ewarn "This is NOT a recommended configuration as you"
1420 ewarn "may face problems parsing any XML documents."
1421 fi
1422 fi
1423
1424 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
1425 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
1426 fi
1427
1428 if [[ "$(gcc-major-version)" -ge 4 ]]; then
1429 append-flags -fwrapv
1430 fi
1431
1432 filter-flags -malign-double
1433
1434 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
1435
1436 # https://bugs.gentoo.org/show_bug.cgi?id=50309
1437 if is-flagq -O3; then
1438 is-flagq -fstack-protector-all && replace-flags -O3 -O2
1439 use hardened && replace-flags -O3 -O2
1440 fi
1441
1442 if tc-is-cross-compiler; then
1443 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
1444 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
1445 emake python Parser/pgen || die "cross-make failed"
1446 mv python hostpython
1447 mv Parser/pgen Parser/hostpgen
1448 make distclean
1449 sed -i \
1450 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
1451 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
1452 Makefile.pre.in || die "sed failed"
1453 fi
1454
1455 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
1456 tc-export CXX
1457 # The configure script fails to use pkg-config correctly.
1458 # http://bugs.python.org/issue15506
1459 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
1460
1461 # Set LDFLAGS so we link modules with -lpython3.1 correctly.
1462 # Needed on FreeBSD unless Python 3.1 is already installed.
1463 # Please query BSD team before removing this!
1464 append-ldflags "-L."
1465
1466 local dbmliborder
1467 if use gdbm; then
1468 dbmliborder+="${dbmliborder:+:}gdbm"
1469 fi
1470
1471 OPT="" econf \
1472 --with-fpectl \
1473 --enable-shared \
1474 $(use_enable ipv6) \
1475 $(use_with threads) \
1476 $(use_with wide-unicode) \
1477 --infodir='${prefix}/share/info' \
1478 --mandir='${prefix}/share/man' \
1479 --with-computed-gotos \
1480 --with-dbmliborder="${dbmliborder}" \
1481 --with-libc="" \
1482 --with-system-ffi
1483 }
1484
1485 src_compile() {
1486 emake || die "emake failed"
1487
1488 # Work around bug 329499. See also bug 413751.
1489 pax-mark m python
1490 }
1491
1492 src_test() {
1493 # Tests will not work when cross compiling.
1494 if tc-is-cross-compiler; then
1495 elog "Disabling tests due to crosscompiling."
1496 return
1497 fi
1498
1499 if ! use threads; then
1500 ewarn "Disabling tests due to USE=\"-threads\""
1501 return
1502 fi
1503
1504 # Skip failing tests.
1505 local skipped_tests="distutils"
1506
1507 for test in ${skipped_tests}; do
1508 mv Lib/test/test_${test}.py "${T}"
1509 done
1510
1511 # Rerun failed tests in verbose mode (regrtest -w).
1512 emake test EXTRATESTOPTS="-w" < /dev/tty
1513 local result="$?"
1514
1515 for test in ${skipped_tests}; do
1516 mv "${T}/test_${test}.py" Lib/test
1517 done
1518
1519 elog "The following tests have been skipped:"
1520 for test in ${skipped_tests}; do
1521 elog "test_${test}.py"
1522 done
1523
1524 elog "If you would like to run them, you may:"
1525 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
1526 elog "and run the tests separately."
1527
1528 if [[ "${result}" -ne 0 ]]; then
1529 die "emake test failed"
1530 fi
1531 }
1532
1533 src_install() {
1534 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
1535
1536 emake DESTDIR="${D}" altinstall || die "emake altinstall failed"
1537
1538 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
1539
1540 # Fix collisions between different slots of Python.
1541 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
1542 mv "${ED}usr/bin/pydoc3" "${ED}usr/bin/pydoc${SLOT}"
1543 mv "${ED}usr/bin/idle3" "${ED}usr/bin/idle${SLOT}"
1544 rm -f "${ED}usr/bin/smtpd.py"
1545
1546 if use build; then
1547 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,sqlite3,test,tkinter}
1548 else
1549 use elibc_uclibc && rm -fr "${libdir}/test"
1550 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
1551 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
1552 fi
1553
1554 use threads || rm -fr "${libdir}/multiprocessing"
1555 use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
1556
1557 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
1558
1559 if use examples; then
1560 insinto /usr/share/doc/${PF}/examples
1561 doins -r Tools || die "doins failed"
1562 fi
1563
1564 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
1565 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
1566 sed \
1567 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
1568 -e "s:@PYDOC@:pydoc${SLOT}:" \
1569 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
1570
1571 # for python-exec
1572 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
1573 echo "EPYTHON='${EPYTHON}'" > epython.py
1574 python_domodule epython.py
1575 }
1576
1577 pkg_preinst() {
1578 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then
1579 python_updater_warning="1"
1580 fi
1581 }
1582
1583 eselect_python_update() {
1584 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
1585 eselect python update
1586 fi
1587
1588 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
1589 eselect python update --python${PV%%.*}
1590 fi
1591 }
1592
1593 pkg_postinst() {
1594 eselect_python_update
1595
1596 if [[ "${python_updater_warning}" == "1" ]]; then
1597 ewarn "You have just upgraded from an older version of Python."
1598 ewarn "You should switch active version of Python ${PV%%.*} and run"
1599 ewarn "'python-updater [options]' to rebuild Python modules."
1600 fi
1601 }
1602
1603 pkg_postrm() {
1604 eselect_python_update
1605 }
1606
1607
1608
1609 1.1 dev-lang/python/python-2.6.8-r1.ebuild
1610
1611 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.6.8-r1.ebuild?rev=1.1&view=markup
1612 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.6.8-r1.ebuild?rev=1.1&content-type=text/plain
1613
1614 Index: python-2.6.8-r1.ebuild
1615 ===================================================================
1616 # Copyright 1999-2012 Gentoo Foundation
1617 # Distributed under the terms of the GNU General Public License v2
1618 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.8-r1.ebuild,v 1.1 2012/11/30 13:25:17 mgorny Exp $
1619
1620 EAPI="2"
1621 WANT_AUTOMAKE="none"
1622 WANT_LIBTOOL="none"
1623
1624 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
1625
1626 MY_P="Python-${PV}"
1627 PATCHSET_REVISION="0"
1628
1629 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
1630 HOMEPAGE="http://www.python.org/"
1631 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
1632 mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2"
1633
1634 LICENSE="PSF-2"
1635 SLOT="2.6"
1636 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd"
1637 IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
1638
1639 RDEPEND="app-arch/bzip2
1640 >=sys-libs/zlib-1.1.3
1641 virtual/libffi
1642 virtual/libintl
1643 !build? (
1644 berkdb? ( || (
1645 sys-libs/db:4.7
1646 sys-libs/db:4.6
1647 sys-libs/db:4.5
1648 sys-libs/db:4.4
1649 sys-libs/db:4.3
1650 sys-libs/db:4.2
1651 ) )
1652 gdbm? ( sys-libs/gdbm[berkdb] )
1653 ncurses? (
1654 >=sys-libs/ncurses-5.2
1655 readline? ( >=sys-libs/readline-4.1 )
1656 )
1657 sqlite? ( >=dev-db/sqlite-3.3.3:3 )
1658 ssl? ( dev-libs/openssl )
1659 tk? (
1660 >=dev-lang/tk-8.0
1661 dev-tcltk/blt
1662 )
1663 xml? ( >=dev-libs/expat-2.1 )
1664 )
1665 !!<sys-apps/portage-2.1.9"
1666 DEPEND="${RDEPEND}
1667 virtual/pkgconfig
1668 >=sys-devel/autoconf-2.61
1669 !sys-devel/gcc[libffi]"
1670 RDEPEND+=" !build? ( app-misc/mime-types )
1671 doc? ( dev-python/python-docs:${SLOT} )"
1672 PDEPEND="app-admin/eselect-python
1673 app-admin/python-updater"
1674
1675 S="${WORKDIR}/${MY_P}"
1676
1677 pkg_setup() {
1678 if use berkdb; then
1679 ewarn "'bsddb' module is out-of-date and no longer maintained inside"
1680 ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
1681 ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
1682 ewarn "is provided by dev-python/bsddb3."
1683 else
1684 if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
1685 ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
1686 ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
1687 ewarn "You might need to migrate your databases."
1688 fi
1689 fi
1690 }
1691
1692 src_prepare() {
1693 # Ensure that internal copies of expat, libffi and zlib are not used.
1694 rm -fr Modules/expat
1695 rm -fr Modules/_ctypes/libffi*
1696 rm -fr Modules/zlib
1697
1698 local excluded_patches
1699 if ! tc-is-cross-compiler; then
1700 excluded_patches="*_all_crosscompile.patch"
1701 fi
1702
1703 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
1704 epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}"
1705
1706 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
1707 Lib/distutils/command/install.py \
1708 Lib/distutils/sysconfig.py \
1709 Lib/site.py \
1710 Makefile.pre.in \
1711 Modules/Setup.dist \
1712 Modules/getpath.c \
1713 setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
1714
1715 eautoconf
1716 eautoheader
1717 }
1718
1719 src_configure() {
1720 if use build; then
1721 # Disable extraneous modules with extra dependencies.
1722 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
1723 export PYTHON_DISABLE_SSL="1"
1724 else
1725 # dbm module can be linked against berkdb or gdbm.
1726 # Defaults to gdbm when both are enabled, #204343.
1727 local disable
1728 use berkdb || use gdbm || disable+=" dbm"
1729 use berkdb || disable+=" _bsddb"
1730 use gdbm || disable+=" gdbm"
1731 use ncurses || disable+=" _curses _curses_panel"
1732 use readline || disable+=" readline"
1733 use sqlite || disable+=" _sqlite3"
1734 use ssl || export PYTHON_DISABLE_SSL="1"
1735 use tk || disable+=" _tkinter"
1736 use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
1737 export PYTHON_DISABLE_MODULES="${disable}"
1738
1739 if ! use xml; then
1740 ewarn "You have configured Python without XML support."
1741 ewarn "This is NOT a recommended configuration as you"
1742 ewarn "may face problems parsing any XML documents."
1743 fi
1744 fi
1745
1746 if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
1747 einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
1748 fi
1749
1750 if [[ "$(gcc-major-version)" -ge 4 ]]; then
1751 append-flags -fwrapv
1752 fi
1753
1754 filter-flags -malign-double
1755
1756 [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
1757
1758 # https://bugs.gentoo.org/show_bug.cgi?id=50309
1759 if is-flagq -O3; then
1760 is-flagq -fstack-protector-all && replace-flags -O3 -O2
1761 use hardened && replace-flags -O3 -O2
1762 fi
1763
1764 if tc-is-cross-compiler; then
1765 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
1766 ./configure --{build,host}=${CBUILD} || die "cross-configure failed"
1767 emake python Parser/pgen || die "cross-make failed"
1768 mv python hostpython
1769 mv Parser/pgen Parser/hostpgen
1770 make distclean
1771 sed -i \
1772 -e "/^HOSTPYTHON/s:=.*:=./hostpython:" \
1773 -e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \
1774 Makefile.pre.in || die "sed failed"
1775 fi
1776
1777 # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
1778 tc-export CXX
1779 # The configure script fails to use pkg-config correctly.
1780 # http://bugs.python.org/issue15506
1781 export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
1782
1783 # Set LDFLAGS so we link modules with -lpython2.6 correctly.
1784 # Needed on FreeBSD unless Python 2.6 is already installed.
1785 # Please query BSD team before removing this!
1786 append-ldflags "-L."
1787
1788 OPT="" econf \
1789 --with-fpectl \
1790 --enable-shared \
1791 $(use_enable ipv6) \
1792 $(use_with threads) \
1793 $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
1794 --infodir='${prefix}/share/info' \
1795 --mandir='${prefix}/share/man' \
1796 --with-libc="" \
1797 --with-system-ffi
1798 }
1799
1800 src_compile() {
1801 emake EPYTHON="python${PV%%.*}" || die "emake failed"
1802
1803 # Work around bug 329499. See also bug 413751.
1804 pax-mark m python
1805 }
1806
1807 src_test() {
1808 # Tests will not work when cross compiling.
1809 if tc-is-cross-compiler; then
1810 elog "Disabling tests due to crosscompiling."
1811 return
1812 fi
1813
1814 # Skip failing tests.
1815 local skipped_tests="distutils tcl"
1816
1817 for test in ${skipped_tests}; do
1818 mv Lib/test/test_${test}.py "${T}"
1819 done
1820
1821 # Rerun failed tests in verbose mode (regrtest -w).
1822 emake test EXTRATESTOPTS="-w" < /dev/tty
1823 local result="$?"
1824
1825 for test in ${skipped_tests}; do
1826 mv "${T}/test_${test}.py" Lib/test
1827 done
1828
1829 elog "The following tests have been skipped:"
1830 for test in ${skipped_tests}; do
1831 elog "test_${test}.py"
1832 done
1833
1834 elog "If you would like to run them, you may:"
1835 elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
1836 elog "and run the tests separately."
1837
1838 python_disable_pyc
1839
1840 if [[ "${result}" -ne 0 ]]; then
1841 die "emake test failed"
1842 fi
1843 }
1844
1845 src_install() {
1846 [[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/"
1847
1848 local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
1849
1850 emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed"
1851
1852 mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}"
1853
1854 # Fix collisions between different slots of Python.
1855 mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
1856 mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
1857 mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
1858 mv "${ED}usr/share/man/man1/python.1" "${ED}usr/share/man/man1/python${SLOT}.1"
1859 rm -f "${ED}usr/bin/smtpd.py"
1860
1861 if use build; then
1862 rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test}
1863 else
1864 use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
1865 use berkdb || rm -fr "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*}
1866 use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
1867 use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk}
1868 fi
1869
1870 use threads || rm -fr "${libdir}/multiprocessing"
1871 use wininst || rm -f "${libdir})/distutils/command/"wininst-*.exe
1872
1873 dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed"
1874
1875 if use examples; then
1876 insinto /usr/share/doc/${PF}/examples
1877 doins -r Tools || die "doins failed"
1878 fi
1879
1880 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed"
1881 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed"
1882 sed \
1883 -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
1884 -e "s:@PYDOC@:pydoc${SLOT}:" \
1885 -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
1886
1887 # for python-exec
1888 python_export python${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
1889 echo "EPYTHON='${EPYTHON}'" > epython.py
1890 python_domodule epython.py
1891 }
1892
1893 pkg_preinst() {
1894 if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then
1895 python_updater_warning="1"
1896 fi
1897 }
1898
1899 eselect_python_update() {
1900 [[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/"
1901
1902 if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
1903 eselect python update
1904 fi
1905
1906 if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
1907 eselect python update --python${PV%%.*}
1908 fi
1909 }
1910
1911 pkg_postinst() {
1912 eselect_python_update
1913
1914 if [[ "${python_updater_warning}" == "1" ]]; then
1915 ewarn "You have just upgraded from an older version of Python."
1916 ewarn "You should switch active version of Python ${PV%%.*} and run"
1917 ewarn "'python-updater [options]' to rebuild Python modules."
1918 fi
1919 }
1920
1921 pkg_postrm() {
1922 eselect_python_update
1923 }