Gentoo Archives: gentoo-commits

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