Gentoo Archives: gentoo-commits

From: "Tiziano Mueller (dev-zero)" <dev-zero@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-lang/python: ChangeLog python-2.4.4-r14.ebuild python-2.5.2-r6.ebuild
Date: Thu, 31 Jul 2008 13:55:57
Message-Id: E1KOYdF-0007BI-KR@stork.gentoo.org
1 dev-zero 08/07/31 13:55:53
2
3 Modified: ChangeLog
4 Added: python-2.4.4-r14.ebuild python-2.5.2-r6.ebuild
5 Log:
6 Revision bump to fix bug #230640 (CVE-2008-2315, CVE-2008-2316) and bug #232137 (CVE-2008-{3142,3143,3144}).
7 (Portage version: 2.2_rc4/cvs/Linux 2.6.26-gentoo x86_64, RepoMan options: --force)
8
9 Revision Changes Path
10 1.335 dev-lang/python/ChangeLog
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?rev=1.335&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?rev=1.335&content-type=text/plain
14 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/ChangeLog?r1=1.334&r2=1.335
15
16 Index: ChangeLog
17 ===================================================================
18 RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v
19 retrieving revision 1.334
20 retrieving revision 1.335
21 diff -u -r1.334 -r1.335
22 --- ChangeLog 18 Jul 2008 13:37:47 -0000 1.334
23 +++ ChangeLog 31 Jul 2008 13:55:53 -0000 1.335
24 @@ -1,6 +1,14 @@
25 # ChangeLog for dev-lang/python
26 # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
27 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.334 2008/07/18 13:37:47 tester Exp $
28 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.335 2008/07/31 13:55:53 dev-zero Exp $
29 +
30 +*python-2.5.2-r6 (31 Jul 2008)
31 +*python-2.4.4-r14 (31 Jul 2008)
32 +
33 + 31 Jul 2008; Tiziano Müller <dev-zero@g.o>
34 + +python-2.4.4-r14.ebuild, +python-2.5.2-r6.ebuild:
35 + Revision bump to fix bug #230640 (CVE-2008-2315, CVE-2008-2316) and bug
36 + #232137 (CVE-2008-{3142,3143,3144}).
37
38 18 Jul 2008; Olivier Crête <tester@g.o> python-2.5.2-r5.ebuild:
39 Stable on amd64, bug #178800
40
41
42
43 1.1 dev-lang/python/python-2.4.4-r14.ebuild
44
45 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.4.4-r14.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.4.4-r14.ebuild?rev=1.1&content-type=text/plain
47
48 Index: python-2.4.4-r14.ebuild
49 ===================================================================
50 # Copyright 1999-2008 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.4.4-r14.ebuild,v 1.1 2008/07/31 13:55:53 dev-zero Exp $
53
54 # NOTE about python-portage interactions :
55 # - Do not add a pkg_setup() check for a certain version of portage
56 # in dev-lang/python. It _WILL_ stop people installing from
57 # Gentoo 1.4 images.
58
59 EAPI=1
60
61 inherit autotools eutils flag-o-matic python multilib versionator toolchain-funcs alternatives
62
63 # we need this so that we don't depends on python.eclass
64 PYVER_MAJOR=$(get_major_version)
65 PYVER_MINOR=$(get_version_component_range 2)
66 PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
67
68 MY_P="Python-${PV}"
69 S="${WORKDIR}/${MY_P}"
70 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
71 HOMEPAGE="http://www.python.org/"
72 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
73 mirror://gentoo/python-gentoo-patches-${PV}-r11.tar.bz2"
74
75 LICENSE="PSF-2.2"
76 SLOT="2.4"
77 KEYWORDS="alpha amd64 ~arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc ~sparc-fbsd x86 ~x86-fbsd"
78 IUSE="ncurses gdbm ssl readline tk berkdb bootstrap ipv6 build ucs2 doc +cxx +threads examples elibc_uclibc wininst"
79
80 # Can't be compiled against db-4.5 Bug #179377
81 DEPEND=">=sys-libs/zlib-1.1.3
82 !dev-python/cjkcodecs
83 !build? (
84 tk? ( >=dev-lang/tk-8.0 )
85 ncurses? ( >=sys-libs/ncurses-5.2 readline? ( >=sys-libs/readline-4.1 ) )
86 berkdb? ( || ( sys-libs/db:4.4 sys-libs/db:4.3 ) )
87 gdbm? ( sys-libs/gdbm )
88 ssl? ( dev-libs/openssl )
89 doc? ( dev-python/python-docs:2.4 )
90 dev-libs/expat
91 )"
92
93 # NOTE: changed RDEPEND to PDEPEND to resolve bug 88777. - kloeri
94 # NOTE: added blocker to enforce correct merge order for bug 88777. - zmedico
95
96 RDEPEND="${DEPEND} build? ( !dev-python/pycrypto )"
97 PDEPEND="${DEPEND} app-admin/python-updater"
98
99 PROVIDE="virtual/python"
100
101 src_unpack() {
102 unpack ${A}
103 cd "${S}"
104
105 if tc-is-cross-compiler ; then
106 [[ $(python -V 2>&1) != "Python ${PV}" ]] && \
107 die "Crosscompiling requires the same host and build versions."
108 epatch "${FILESDIR}"/python-2.4.4-test-cross.patch
109 else
110 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
111 fi
112
113 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
114 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
115 Lib/distutils/command/install.py \
116 Lib/distutils/sysconfig.py \
117 Lib/site.py \
118 Makefile.pre.in \
119 Modules/Setup.dist \
120 Modules/getpath.c \
121 setup.py || die
122
123 # fix os.utime() on hppa. utimes it not supported but unfortunately
124 # reported as working - gmsoft (22 May 04)
125 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
126 [ "${ARCH}" = "hppa" ] && sed -e 's/utimes //' -i "${S}"/configure
127
128 if ! use wininst; then
129 # remove microsoft windows executables
130 rm Lib/distutils/command/wininst-*.exe
131 fi
132
133 eautoreconf
134 }
135
136 src_configure() {
137 # disable extraneous modules with extra dependencies
138 if use build; then
139 export PYTHON_DISABLE_MODULES="readline pyexpat dbm gdbm bsddb _curses _curses_panel _tkinter"
140 export PYTHON_DISABLE_SSL=1
141 else
142 # dbm module can link to berkdb or gdbm -- defaults to gdbm when
143 # both are enabled, see #204343
144 use berkdb || use gdbm \
145 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} dbm"
146 use gdbm \
147 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} gdbm"
148 use berkdb \
149 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} bsddb"
150 use readline \
151 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} readline"
152 use tk \
153 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _tkinter"
154 use ncurses \
155 || PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _curses _curses_panel"
156 use ssl \
157 || export PYTHON_DISABLE_SSL=1
158 export PYTHON_DISABLE_MODULES
159 echo $PYTHON_DISABLE_MODULES
160 fi
161 }
162
163 src_compile() {
164 filter-flags -malign-double
165
166 # Seems to no longer be necessary
167 #[ "${ARCH}" = "amd64" ] && append-flags -fPIC
168 [ "${ARCH}" = "alpha" ] && append-flags -fPIC
169
170 # http://bugs.gentoo.org/show_bug.cgi?id=50309
171 if is-flag -O3; then
172 is-flag -fstack-protector-all && replace-flags -O3 -O2
173 use hardened && replace-flags -O3 -O2
174 fi
175
176 export OPT="${CFLAGS}"
177
178 local myconf
179 #if we are creating a new build image, we remove the dependency on g++
180 if use build && ! use bootstrap || ! use cxx ; then
181 myconf="--with-cxx=no"
182 fi
183
184 # super-secret switch. don't use this unless you know what you're
185 # doing. enabling UCS2 support will break your existing python
186 # modules
187 use ucs2 \
188 && myconf="${myconf} --enable-unicode=ucs2" \
189 || myconf="${myconf} --enable-unicode=ucs4"
190
191 use threads \
192 && myconf="${myconf} --with-threads" \
193 || myconf="${myconf} --without-threads"
194
195 src_configure
196
197 if tc-is-cross-compiler ; then
198 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
199 ./configure --with-cxx=no || die "cross-configure failed"
200 emake python Parser/pgen || die "cross-make failed"
201 mv python hostpython
202 mv Parser/pgen Parser/hostpgen
203 make distclean
204 sed -i \
205 -e '/^HOSTPYTHON/s:=.*:=./hostpython:' \
206 -e '/^HOSTPGEN/s:=.*:=./Parser/hostpgen:' \
207 Makefile.pre.in || die
208 fi
209
210 # export CXX so it ends up in /usr/lib/python2.x/config/Makefile
211 tc-export CXX
212 # set LINKCC to prevent python from being linked to libstdc++.so
213 export LINKCC="\$(PURIFY) \$(CC)"
214 econf \
215 --with-fpectl \
216 --enable-shared \
217 `use_enable ipv6` \
218 --infodir='${prefix}'/share/info \
219 --mandir='${prefix}'/share/man \
220 --with-libc='' \
221 ${myconf} || die
222 emake || die "Parallel make failed"
223 }
224
225 src_install() {
226 dodir /usr
227 src_configure
228 make DESTDIR="${D}" altinstall maninstall || die
229
230 # install our own custom python-config
231 exeinto /usr/bin
232 newexe "${FILESDIR}"/python-config-${PYVER}-r1 python-config-${PYVER}
233
234 # Use correct libdir in python-config
235 dosed "s:/usr/lib/:/usr/$(get_libdir)/:" /usr/bin/python-config-${PYVER}
236
237 if use build ; then
238 rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/{test,encodings,email,lib-tk,bsddb/test}
239 else
240 use elibc_uclibc && rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/{test,bsddb/test}
241 use berkdb || rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/bsddb
242 use tk || rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/lib-tk
243 fi
244
245 # Fix slotted collisions
246 mv "${D}"/usr/bin/pydoc "${D}"/usr/bin/pydoc${PYVER}
247 mv "${D}"/usr/bin/idle "${D}"/usr/bin/idle${PYVER}
248 mv "${D}"/usr/share/man/man1/python.1 \
249 "${D}"/usr/share/man/man1/python${PYVER}.1
250 rm -f "${D}"/usr/bin/smtpd.py
251
252 prep_ml_includes usr/include/python${PYVER}
253
254 # The stuff below this line extends from 2.1, and should be deprecated
255 # in 2.3, or possibly can wait till 2.4
256
257 # seems like the build do not install Makefile.pre.in anymore
258 # it probably shouldn't - use DistUtils, people!
259 insinto /usr/$(get_libdir)/python${PYVER}/config
260 doins "${S}"/Makefile.pre.in
261
262 # While we're working on the config stuff... Let's fix the OPT var
263 # so that it doesn't have any opts listed in it. Prevents the problem
264 # with compiling things with conflicting opts later.
265 dosed -e 's:^OPT=.*:OPT=-DNDEBUG:' \
266 /usr/$(get_libdir)/python${PYVER}/config/Makefile
267
268 if use examples ; then
269 mkdir -p "${D}"/usr/share/doc/${P}/examples
270 cp -r "${S}"/Tools "${D}"/usr/share/doc/${P}/examples
271 fi
272
273 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
274 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
275 }
276
277 pkg_postrm() {
278 local mansuffix=$(ecompress --suffix)
279 python_makesym
280 alternatives_auto_makesym "/usr/bin/idle" "idle[0-9].[0-9]"
281 alternatives_auto_makesym "/usr/bin/pydoc" "pydoc[0-9].[0-9]"
282 alternatives_auto_makesym "/usr/bin/python-config" \
283 "python-config-[0-9].[0-9]"
284 alternatives_auto_makesym "/usr/share/man/man1/python.1${mansuffix}" \
285 "python[0-9].[0-9].1${mansuffix}"
286
287 python_mod_cleanup /usr/lib/python${PYVER}
288 [[ "$(get_libdir)" == "lib" ]] || \
289 python_mod_cleanup /usr/$(get_libdir)/python${PYVER}
290 }
291
292 pkg_postinst() {
293 local myroot
294 myroot=$(echo $ROOT | sed 's:/$::')
295 local mansuffix=$(ecompress --suffix)
296
297 python_makesym
298 alternatives_auto_makesym "/usr/bin/idle" "idle[0-9].[0-9]"
299 alternatives_auto_makesym "/usr/bin/pydoc" "pydoc[0-9].[0-9]"
300 alternatives_auto_makesym "/usr/bin/python-config" \
301 "python-config-[0-9].[0-9]"
302 alternatives_auto_makesym "/usr/share/man/man1/python.1${mansuffix}" \
303 "python[0-9].[0-9].1${mansuffix}"
304
305 python_mod_optimize
306 python_mod_optimize -x "(site-packages|test)" \
307 /usr/lib/python${PYVER}
308 [[ "$(get_libdir)" == "lib" ]] || \
309 python_mod_optimize -x "(site-packages|test)" \
310 /usr/$(get_libdir)/python${PYVER}
311
312 # workaround possible python-upgrade-breaks-portage situation
313 if [ ! -f ${myroot}/usr/lib/portage/pym/portage.py ]; then
314 if [ -f ${myroot}/usr/lib/python2.3/site-packages/portage.py ]; then
315 einfo "Working around possible python-portage upgrade breakage"
316 mkdir -p ${myroot}/usr/lib/portage/pym
317 cp ${myroot}/usr/lib/python2.4/site-packages/{portage,xpak,output,cvstree,getbinpkg,emergehelp,dispatch_conf}.py ${myroot}/usr/lib/portage/pym
318 python_mod_optimize /usr/lib/portage/pym
319 fi
320 fi
321
322 echo
323 ewarn
324 ewarn "If you have just upgraded from an older version of python you"
325 ewarn "will need to run:"
326 ewarn
327 ewarn "/usr/sbin/python-updater"
328 ewarn
329 ewarn "This will automatically rebuild all the python dependent modules"
330 ewarn "to run with python-${PYVER}."
331 ewarn
332 ewarn "Your original Python is still installed and can be accessed via"
333 ewarn "/usr/bin/python2.x."
334 ewarn
335 ebeep 5
336 }
337
338 src_test() {
339 # Tests won't work when cross compiling
340 if tc-is-cross-compiler ; then
341 elog "Disabling tests due to crosscompiling."
342 return
343 fi
344
345 # PYTHON_DONTCOMPILE=1 breaks test_import
346 unset PYTHON_DONTCOMPILE
347
348 #skip all tests that fail during emerge but pass without emerge:
349 #(See bug# 67970)
350 local skip_tests="cookielib distutils global hotshot mimetools minidom mmap posix sax strptime subprocess syntax tcl time urllib urllib2"
351
352 # test_pow fails on alpha.
353 # http://bugs.python.org/issue756093
354 [[ ${ARCH} == "alpha" ]] && skip_tests="${skip_tests} pow"
355
356 for test in ${skip_tests} ; do
357 mv "${S}"/Lib/test/test_${test}.py "${T}"
358 done
359
360 # rerun failed tests in verbose mode (regrtest -w)
361 EXTRATESTOPTS="-w" make test || die "make test failed"
362
363 for test in ${skip_tests} ; do
364 mv "${T}"/test_${test}.py "${S}"/Lib/test/test_${test}.py
365 done
366
367 elog "Portage skipped the following tests which aren't able to run from emerge:"
368 for test in ${skip_tests} ; do
369 elog "test_${test}.py"
370 done
371
372 elog "If you'd like to run them, you may:"
373 elog "cd /usr/lib/python${PYVER}/test"
374 elog "and run the tests separately."
375 }
376
377
378
379 1.1 dev-lang/python/python-2.5.2-r6.ebuild
380
381 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.5.2-r6.ebuild?rev=1.1&view=markup
382 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-lang/python/python-2.5.2-r6.ebuild?rev=1.1&content-type=text/plain
383
384 Index: python-2.5.2-r6.ebuild
385 ===================================================================
386 # Copyright 1999-2008 Gentoo Foundation
387 # Distributed under the terms of the GNU General Public License v2
388 # $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.5.2-r6.ebuild,v 1.1 2008/07/31 13:55:53 dev-zero Exp $
389
390 # NOTE about python-portage interactions :
391 # - Do not add a pkg_setup() check for a certain version of portage
392 # in dev-lang/python. It _WILL_ stop people installing from
393 # Gentoo 1.4 images.
394
395 EAPI=1
396
397 inherit eutils autotools flag-o-matic python multilib versionator toolchain-funcs alternatives libtool
398
399 # we need this so that we don't depends on python.eclass
400 PYVER_MAJOR=$(get_major_version)
401 PYVER_MINOR=$(get_version_component_range 2)
402 PYVER="${PYVER_MAJOR}.${PYVER_MINOR}"
403
404 MY_P="Python-${PV}"
405 S="${WORKDIR}/${MY_P}"
406
407 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
408 HOMEPAGE="http://www.python.org/"
409 SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2
410 mirror://gentoo/python-gentoo-patches-${PV}-r6.tar.bz2"
411
412 LICENSE="PSF-2.2"
413 SLOT="2.5"
414 KEYWORDS="alpha amd64 ~arm hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh ~sparc ~sparc-fbsd x86 ~x86-fbsd"
415 IUSE="ncurses gdbm ssl readline tk berkdb bootstrap ipv6 build ucs2 sqlite doc +threads examples elibc_uclibc wininst"
416
417 # NOTE: dev-python/{elementtree,celementtree,pysqlite,ctypes,cjkcodecs}
418 # do not conflict with the ones in python proper. - liquidx
419
420 DEPEND=">=sys-libs/zlib-1.1.3
421 !build? (
422 sqlite? ( >=dev-db/sqlite-3 )
423 tk? ( >=dev-lang/tk-8.0 )
424 ncurses? ( >=sys-libs/ncurses-5.2
425 readline? ( >=sys-libs/readline-4.1 ) )
426 berkdb? ( || ( sys-libs/db:4.5 sys-libs/db:4.4 sys-libs/db:4.3
427 sys-libs/db:4.2 ) )
428 gdbm? ( sys-libs/gdbm )
429 ssl? ( dev-libs/openssl )
430 doc? ( dev-python/python-docs:2.5 )
431 dev-libs/expat
432 )"
433
434 # NOTE: changed RDEPEND to PDEPEND to resolve bug 88777. - kloeri
435 # NOTE: added blocker to enforce correct merge order for bug 88777. - zmedico
436
437 PDEPEND="${DEPEND} app-admin/python-updater"
438 PROVIDE="virtual/python"
439
440 src_unpack() {
441 unpack ${A}
442 cd "${S}"
443
444 if tc-is-cross-compiler ; then
445 [[ $(python -V 2>&1) != "Python ${PV}" ]] && \
446 die "Crosscompiling requires the same host and build versions."
447 epatch "${FILESDIR}"/python-2.4.4-test-cross.patch
448 else
449 rm "${WORKDIR}/${PV}"/*_all_crosscompile.patch
450 fi
451
452 EPATCH_SUFFIX="patch" epatch "${WORKDIR}/${PV}"
453 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
454 Lib/distutils/command/install.py \
455 Lib/distutils/sysconfig.py \
456 Lib/site.py \
457 Makefile.pre.in \
458 Modules/Setup.dist \
459 Modules/getpath.c \
460 setup.py || die
461
462 # fix os.utime() on hppa. utimes it not supported but unfortunately reported as working - gmsoft (22 May 04)
463 # PLEASE LEAVE THIS FIX FOR NEXT VERSIONS AS IT'S A CRITICAL FIX !!!
464 [ "${ARCH}" = "hppa" ] && sed -e 's/utimes //' -i "${S}"/configure
465
466 if ! use wininst; then
467 # remove microsoft windows executables
468 rm Lib/distutils/command/wininst-*.exe
469 fi
470
471 eautoreconf
472 }
473
474 src_configure() {
475 # disable extraneous modules with extra dependencies
476 if use build; then
477 export PYTHON_DISABLE_MODULES="readline pyexpat dbm gdbm bsddb _curses _curses_panel _tkinter _sqlite3"
478 export PYTHON_DISABLE_SSL=1
479 else
480 # dbm module can link to berkdb or gdbm
481 # defaults to gdbm when both are enabled, #204343
482 local disable
483 use berkdb || use gdbm || disable="${disable} dbm"
484 use berkdb || disable="${disable} bsddb"
485 use gdbm || disable="${disable} gdbm"
486 use ncurses || disable="${disable} _curses _curses_panel"
487 use readline || disable="${disable} readline"
488 use sqlite || disable="${disable} sqlite3"
489 use ssl || export PYTHON_DISABLE_SSL=1
490 use tk || disable="${disable} _tkinter"
491 export PYTHON_DISABLE_MODULES="${disable}"
492 fi
493 einfo "Disabled modules: $PYTHON_DISABLE_MODULES"
494 }
495
496 src_compile() {
497 filter-flags -malign-double
498
499 # Seems to no longer be necessary
500 #[ "${ARCH}" = "amd64" ] && append-flags -fPIC
501 [ "${ARCH}" = "alpha" ] && append-flags -fPIC
502
503 # http://bugs.gentoo.org/show_bug.cgi?id=50309
504 if is-flag -O3; then
505 is-flag -fstack-protector-all && replace-flags -O3 -O2
506 use hardened && replace-flags -O3 -O2
507 fi
508
509 # See #228905
510 if [[ $(gcc-major-version) -ge 4 ]]; then
511 append-flags -fwrapv
512 fi
513
514 export OPT="${CFLAGS}"
515
516 local myconf
517
518 # super-secret switch. don't use this unless you know what you're
519 # doing. enabling UCS2 support will break your existing python
520 # modules
521 use ucs2 \
522 && myconf="${myconf} --enable-unicode=ucs2" \
523 || myconf="${myconf} --enable-unicode=ucs4"
524
525 use threads \
526 && myconf="${myconf} --with-threads" \
527 || myconf="${myconf} --without-threads"
528
529 src_configure
530
531 if tc-is-cross-compiler ; then
532 OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \
533 ./configure || die "cross-configure failed"
534 emake python Parser/pgen || die "cross-make failed"
535 mv python hostpython
536 mv Parser/pgen Parser/hostpgen
537 make distclean
538 sed -i \
539 -e '/^HOSTPYTHON/s:=.*:=./hostpython:' \
540 -e '/^HOSTPGEN/s:=.*:=./Parser/hostpgen:' \
541 Makefile.pre.in || die
542 fi
543
544 # export CXX so it ends up in /usr/lib/python2.x/config/Makefile
545 tc-export CXX
546
547 # set LDFLAGS so we link modules with -lpython2.5 correctly.
548 # Needed on FreeBSD unless python2.5 is already installed.
549 # Please query BSD team before removing this!
550 append-ldflags "-L."
551
552 econf \
553 --with-fpectl \
554 --enable-shared \
555 `use_enable ipv6` \
556 --infodir='${prefix}'/share/info \
557 --mandir='${prefix}'/share/man \
558 --with-libc='' \
559 ${myconf} || die
560 emake || die "Parallel make failed"
561 }
562
563 src_install() {
564 dodir /usr
565 src_configure
566 make DESTDIR="${D}" altinstall maninstall || die
567
568 mv "${D}"/usr/bin/python${PYVER}-config "${D}"/usr/bin/python-config-${PYVER}
569
570 # Fix slotted collisions
571 mv "${D}"/usr/bin/pydoc "${D}"/usr/bin/pydoc${PYVER}
572 mv "${D}"/usr/bin/idle "${D}"/usr/bin/idle${PYVER}
573 mv "${D}"/usr/share/man/man1/python.1 \
574 "${D}"/usr/share/man/man1/python${PYVER}.1
575 rm -f "${D}"/usr/bin/smtpd.py
576
577 # While we're working on the config stuff... Let's fix the OPT var
578 # so that it doesn't have any opts listed in it. Prevents the problem
579 # with compiling things with conflicting opts later.
580 dosed -e 's:^OPT=.*:OPT=-DNDEBUG:' \
581 /usr/$(get_libdir)/python${PYVER}/config/Makefile
582
583 if use build ; then
584 rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/{test,encodings,email,lib-tk,bsddb/test}
585 else
586 use elibc_uclibc && rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/{test,bsddb/test}
587 use berkdb || rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/bsddb
588 use tk || rm -rf "${D}"/usr/$(get_libdir)/python${PYVER}/lib-tk
589 fi
590
591 prep_ml_includes usr/include/python${PYVER}
592
593 # The stuff below this line extends from 2.1, and should be deprecated
594 # in 2.3, or possibly can wait till 2.4
595
596 # seems like the build do not install Makefile.pre.in anymore
597 # it probably shouldn't - use DistUtils, people!
598 insinto /usr/$(get_libdir)/python${PYVER}/config
599 doins "${S}"/Makefile.pre.in
600
601 if use examples ; then
602 mkdir -p "${D}"/usr/share/doc/${P}/examples
603 cp -r "${S}"/Tools "${D}"/usr/share/doc/${P}/examples
604 fi
605
606 newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
607 newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
608 }
609
610 pkg_postrm() {
611 local mansuffix=$(ecompress --suffix)
612 python_makesym
613 alternatives_auto_makesym "/usr/bin/idle" "idle[0-9].[0-9]"
614 alternatives_auto_makesym "/usr/bin/pydoc" "pydoc[0-9].[0-9]"
615 alternatives_auto_makesym "/usr/bin/python-config" \
616 "python-config-[0-9].[0-9]"
617
618 alternatives_auto_makesym "/usr/share/man/man1/python.1${mansuffix}" \
619 "python[0-9].[0-9].1${mansuffix}"
620
621 python_mod_cleanup /usr/lib/python${PYVER}
622 [[ "$(get_libdir)" == "lib" ]] || \
623 python_mod_cleanup /usr/$(get_libdir)/python${PYVER}
624 }
625
626 pkg_postinst() {
627 local myroot
628 myroot=$(echo $ROOT | sed 's:/$::')
629 local mansuffix=$(ecompress --suffix)
630
631 python_makesym
632 alternatives_auto_makesym "/usr/bin/idle" "idle[0-9].[0-9]"
633 alternatives_auto_makesym "/usr/bin/pydoc" "pydoc[0-9].[0-9]"
634 alternatives_auto_makesym "/usr/bin/python-config" \
635 "python-config-[0-9].[0-9]"
636
637 alternatives_auto_makesym "/usr/share/man/man1/python.1${mansuffix}" \
638 "python[0-9].[0-9].1${mansuffix}"
639
640 python_mod_optimize
641 python_mod_optimize -x "(site-packages|test)" \
642 /usr/lib/python${PYVER}
643 [[ "$(get_libdir)" == "lib" ]] || \
644 python_mod_optimize -x "(site-packages|test)" \
645 /usr/$(get_libdir)/python${PYVER}
646
647 # workaround possible python-upgrade-breaks-portage situation
648 if [ ! -f ${myroot}/usr/lib/portage/pym/portage.py ]; then
649 if [ -f ${myroot}/usr/lib/python2.3/site-packages/portage.py ]; then
650 einfo "Working around possible python-portage upgrade breakage"
651 mkdir -p ${myroot}/usr/lib/portage/pym
652 cp ${myroot}/usr/lib/python2.4/site-packages/{portage,xpak,output,cvstree,getbinpkg,emergehelp,dispatch_conf}.py ${myroot}/usr/lib/portage/pym
653 python_mod_optimize /usr/lib/portage/pym
654 fi
655 fi
656
657 echo
658 ewarn
659 ewarn "If you have just upgraded from an older version of python you will"
660 ewarn "need to run:"
661 ewarn
662 ewarn "/usr/sbin/python-updater"
663 ewarn
664 ewarn "This will automatically rebuild all the python dependent modules"
665 ewarn "to run with python-${PYVER}."
666 ewarn
667 ewarn "Your original Python is still installed and can be accessed via"
668 ewarn "/usr/bin/python2.x."
669 ewarn
670 ebeep 5
671 }
672
673 src_test() {
674 # Tests won't work when cross compiling
675 if tc-is-cross-compiler ; then
676 elog "Disabling tests due to crosscompiling."
677 return
678 fi
679
680 # PYTHON_DONTCOMPILE=1 breaks test_import
681 unset PYTHON_DONTCOMPILE
682
683 #skip all tests that fail during emerge but pass without emerge:
684 #(See bug# 67970)
685 local skip_tests="distutils global mimetools minidom mmap posix pyexpat sax strptime subprocess syntax tcl time urllib urllib2 webbrowser xml_etree"
686
687 # test_pow fails on alpha.
688 # http://bugs.python.org/issue756093
689 [[ ${ARCH} == "alpha" ]] && skip_tests="${skip_tests} pow"
690
691 for test in ${skip_tests} ; do
692 mv "${S}"/Lib/test/test_${test}.py "${T}"
693 done
694
695 # rerun failed tests in verbose mode (regrtest -w)
696 EXTRATESTOPTS="-w" make test || die "make test failed"
697
698 for test in ${skip_tests} ; do
699 mv "${T}"/test_${test}.py "${S}"/Lib/test/test_${test}.py
700 done
701
702 elog "Portage skipped the following tests which aren't able to run from emerge:"
703 for test in ${skip_tests} ; do
704 elog "test_${test}.py"
705 done
706
707 elog "If you'd like to run them, you may:"
708 elog "cd /usr/lib/python${PYVER}/test"
709 elog "and run the tests separately."
710 }