1 |
floppym 12/05/01 16:07:57 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: python-2.7.3-r2.ebuild python-3.2.3-r1.ebuild |
5 |
Log: |
6 |
Drop several patches that upstream has not accepted. |
7 |
|
8 |
(Portage version: 2.2.0_alpha101/cvs/Linux x86_64) |
9 |
|
10 |
Revision Changes Path |
11 |
1.586 dev-lang/python/ChangeLog |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.586&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?rev=1.586&content-type=text/plain |
15 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/ChangeLog?r1=1.585&r2=1.586 |
16 |
|
17 |
Index: ChangeLog |
18 |
=================================================================== |
19 |
RCS file: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v |
20 |
retrieving revision 1.585 |
21 |
retrieving revision 1.586 |
22 |
diff -u -r1.585 -r1.586 |
23 |
--- ChangeLog 28 Apr 2012 05:02:04 -0000 1.585 |
24 |
+++ ChangeLog 1 May 2012 16:07:57 -0000 1.586 |
25 |
@@ -1,6 +1,13 @@ |
26 |
# ChangeLog for dev-lang/python |
27 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
28 |
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.585 2012/04/28 05:02:04 floppym Exp $ |
29 |
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/ChangeLog,v 1.586 2012/05/01 16:07:57 floppym Exp $ |
30 |
+ |
31 |
+*python-3.2.3-r1 (01 May 2012) |
32 |
+*python-2.7.3-r2 (01 May 2012) |
33 |
+ |
34 |
+ 01 May 2012; Mike Gilbert <floppym@g.o> +python-2.7.3-r2.ebuild, |
35 |
+ +python-3.2.3-r1.ebuild: |
36 |
+ Drop several patches that upstream has not accepted. |
37 |
|
38 |
28 Apr 2012; Mike Gilbert <floppym@g.o> python-2.6.8.ebuild, |
39 |
python-2.7.3-r1.ebuild, python-3.1.5.ebuild, python-3.2.3.ebuild: |
40 |
|
41 |
|
42 |
|
43 |
1.1 dev-lang/python/python-2.7.3-r2.ebuild |
44 |
|
45 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.3-r2.ebuild?rev=1.1&view=markup |
46 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-2.7.3-r2.ebuild?rev=1.1&content-type=text/plain |
47 |
|
48 |
Index: python-2.7.3-r2.ebuild |
49 |
=================================================================== |
50 |
# Copyright 1999-2012 Gentoo Foundation |
51 |
# Distributed under the terms of the GNU General Public License v2 |
52 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.7.3-r2.ebuild,v 1.1 2012/05/01 16:07:57 floppym Exp $ |
53 |
|
54 |
EAPI="2" |
55 |
WANT_AUTOMAKE="none" |
56 |
WANT_LIBTOOL="none" |
57 |
|
58 |
inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs |
59 |
|
60 |
MY_P="Python-${PV}" |
61 |
PATCHSET_REVISION="1" |
62 |
|
63 |
DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." |
64 |
HOMEPAGE="http://www.python.org/" |
65 |
SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.bz2 |
66 |
mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2" |
67 |
|
68 |
LICENSE="PSF-2" |
69 |
SLOT="2.7" |
70 |
PYTHON_ABI="${SLOT}" |
71 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
72 |
IUSE="-berkdb build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" |
73 |
|
74 |
RDEPEND="app-arch/bzip2 |
75 |
>=sys-libs/zlib-1.1.3 |
76 |
virtual/libffi |
77 |
virtual/libintl |
78 |
!build? ( |
79 |
berkdb? ( || ( |
80 |
sys-libs/db:4.8 |
81 |
sys-libs/db:4.7 |
82 |
sys-libs/db:4.6 |
83 |
sys-libs/db:4.5 |
84 |
sys-libs/db:4.4 |
85 |
sys-libs/db:4.3 |
86 |
sys-libs/db:4.2 |
87 |
) ) |
88 |
gdbm? ( sys-libs/gdbm[berkdb] ) |
89 |
ncurses? ( |
90 |
>=sys-libs/ncurses-5.2 |
91 |
readline? ( >=sys-libs/readline-4.1 ) |
92 |
) |
93 |
sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] ) |
94 |
ssl? ( dev-libs/openssl ) |
95 |
tk? ( |
96 |
>=dev-lang/tk-8.0 |
97 |
dev-tcltk/blt |
98 |
) |
99 |
xml? ( >=dev-libs/expat-2.1 ) |
100 |
) |
101 |
!!<sys-apps/portage-2.1.9" |
102 |
DEPEND="${RDEPEND} |
103 |
dev-util/pkgconfig |
104 |
>=sys-devel/autoconf-2.65 |
105 |
!sys-devel/gcc[libffi]" |
106 |
RDEPEND+=" !build? ( app-misc/mime-types ) |
107 |
doc? ( dev-python/python-docs:${SLOT} )" |
108 |
|
109 |
S="${WORKDIR}/${MY_P}" |
110 |
|
111 |
pkg_setup() { |
112 |
python_pkg_setup |
113 |
|
114 |
if use berkdb; then |
115 |
ewarn "\"bsddb\" module is out-of-date and no longer maintained inside dev-lang/python." |
116 |
ewarn "\"bsddb\" and \"dbhash\" modules have been additionally removed in Python 3." |
117 |
ewarn "You should use external, still maintained \"bsddb3\" module provided by dev-python/bsddb3," |
118 |
ewarn "which supports both Python 2 and Python 3." |
119 |
else |
120 |
if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then |
121 |
ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb] to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." |
122 |
ewarn "You might need to migrate your databases." |
123 |
fi |
124 |
fi |
125 |
} |
126 |
|
127 |
src_prepare() { |
128 |
# Ensure that internal copies of expat, libffi and zlib are not used. |
129 |
rm -fr Modules/expat |
130 |
rm -fr Modules/_ctypes/libffi* |
131 |
rm -fr Modules/zlib |
132 |
|
133 |
local excluded_patches |
134 |
if ! tc-is-cross-compiler; then |
135 |
excluded_patches="*_all_crosscompile.patch" |
136 |
fi |
137 |
|
138 |
EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \ |
139 |
epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}" |
140 |
|
141 |
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
142 |
Lib/distutils/command/install.py \ |
143 |
Lib/distutils/sysconfig.py \ |
144 |
Lib/site.py \ |
145 |
Lib/sysconfig.py \ |
146 |
Lib/test/test_site.py \ |
147 |
Makefile.pre.in \ |
148 |
Modules/Setup.dist \ |
149 |
Modules/getpath.c \ |
150 |
setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
151 |
|
152 |
eautoconf |
153 |
eautoheader |
154 |
} |
155 |
|
156 |
src_configure() { |
157 |
if use build; then |
158 |
# Disable extraneous modules with extra dependencies. |
159 |
export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" |
160 |
export PYTHON_DISABLE_SSL="1" |
161 |
else |
162 |
# dbm module can be linked against berkdb or gdbm. |
163 |
# Defaults to gdbm when both are enabled, #204343. |
164 |
local disable |
165 |
use berkdb || use gdbm || disable+=" dbm" |
166 |
use berkdb || disable+=" _bsddb" |
167 |
use gdbm || disable+=" gdbm" |
168 |
use ncurses || disable+=" _curses _curses_panel" |
169 |
use readline || disable+=" readline" |
170 |
use sqlite || disable+=" _sqlite3" |
171 |
use ssl || export PYTHON_DISABLE_SSL="1" |
172 |
use tk || disable+=" _tkinter" |
173 |
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
174 |
export PYTHON_DISABLE_MODULES="${disable}" |
175 |
|
176 |
if ! use xml; then |
177 |
ewarn "You have configured Python without XML support." |
178 |
ewarn "This is NOT a recommended configuration as you" |
179 |
ewarn "may face problems parsing any XML documents." |
180 |
fi |
181 |
fi |
182 |
|
183 |
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
184 |
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
185 |
fi |
186 |
|
187 |
if [[ "$(gcc-major-version)" -ge 4 ]]; then |
188 |
append-flags -fwrapv |
189 |
fi |
190 |
|
191 |
filter-flags -malign-double |
192 |
|
193 |
[[ "${ARCH}" == "alpha" ]] && append-flags -fPIC |
194 |
|
195 |
# https://bugs.gentoo.org/show_bug.cgi?id=50309 |
196 |
if is-flagq -O3; then |
197 |
is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
198 |
use hardened && replace-flags -O3 -O2 |
199 |
fi |
200 |
|
201 |
if tc-is-cross-compiler; then |
202 |
OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \ |
203 |
./configure --{build,host}=${CBUILD} || die "cross-configure failed" |
204 |
emake python Parser/pgen || die "cross-make failed" |
205 |
mv python hostpython |
206 |
mv Parser/pgen Parser/hostpgen |
207 |
make distclean |
208 |
sed -i \ |
209 |
-e "/^HOSTPYTHON/s:=.*:=./hostpython:" \ |
210 |
-e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \ |
211 |
Makefile.pre.in || die "sed failed" |
212 |
fi |
213 |
|
214 |
# Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. |
215 |
tc-export CXX |
216 |
|
217 |
# Set LDFLAGS so we link modules with -lpython2.7 correctly. |
218 |
# Needed on FreeBSD unless Python 2.7 is already installed. |
219 |
# Please query BSD team before removing this! |
220 |
append-ldflags "-L." |
221 |
|
222 |
local dbmliborder |
223 |
if use gdbm; then |
224 |
dbmliborder+="${dbmliborder:+:}gdbm" |
225 |
fi |
226 |
if use berkdb; then |
227 |
dbmliborder+="${dbmliborder:+:}bdb" |
228 |
fi |
229 |
|
230 |
OPT="" econf \ |
231 |
--with-fpectl \ |
232 |
--enable-shared \ |
233 |
$(use_enable ipv6) \ |
234 |
$(use_with threads) \ |
235 |
$(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ |
236 |
--infodir='${prefix}/share/info' \ |
237 |
--mandir='${prefix}/share/man' \ |
238 |
--with-dbmliborder="${dbmliborder}" \ |
239 |
--with-libc="" \ |
240 |
--enable-loadable-sqlite-extensions \ |
241 |
--with-system-expat \ |
242 |
--with-system-ffi |
243 |
} |
244 |
|
245 |
src_compile() { |
246 |
emake EPYTHON="python${PV%%.*}" || die "emake failed" |
247 |
|
248 |
# Work around bug 329499. See also bug 413751. |
249 |
pax-mark m python |
250 |
} |
251 |
|
252 |
src_test() { |
253 |
# Tests will not work when cross compiling. |
254 |
if tc-is-cross-compiler; then |
255 |
elog "Disabling tests due to crosscompiling." |
256 |
return |
257 |
fi |
258 |
|
259 |
# Byte compiling should be enabled here. |
260 |
# Otherwise test_import fails. |
261 |
python_enable_pyc |
262 |
|
263 |
# Skip failing tests. |
264 |
local skipped_tests="distutils gdb" |
265 |
|
266 |
for test in ${skipped_tests}; do |
267 |
mv Lib/test/test_${test}.py "${T}" |
268 |
done |
269 |
|
270 |
# Rerun failed tests in verbose mode (regrtest -w). |
271 |
emake test EXTRATESTOPTS="-w" < /dev/tty |
272 |
local result="$?" |
273 |
|
274 |
for test in ${skipped_tests}; do |
275 |
mv "${T}/test_${test}.py" Lib/test |
276 |
done |
277 |
|
278 |
elog "The following tests have been skipped:" |
279 |
for test in ${skipped_tests}; do |
280 |
elog "test_${test}.py" |
281 |
done |
282 |
|
283 |
elog "If you would like to run them, you may:" |
284 |
elog "cd '${EPREFIX}$(python_get_libdir)/test'" |
285 |
elog "and run the tests separately." |
286 |
|
287 |
python_disable_pyc |
288 |
|
289 |
if [[ "${result}" -ne 0 ]]; then |
290 |
die "emake test failed" |
291 |
fi |
292 |
} |
293 |
|
294 |
src_install() { |
295 |
[[ -z "${ED}" ]] && ED="${D%/}${EPREFIX}/" |
296 |
|
297 |
emake DESTDIR="${D}" altinstall maninstall || die "emake altinstall maninstall failed" |
298 |
python_clean_installation_image -q |
299 |
|
300 |
sed -e "s/\(LDFLAGS=\).*/\1/" -i "${ED}$(python_get_libdir)/config/Makefile" || die "sed failed" |
301 |
|
302 |
mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" |
303 |
|
304 |
# Fix collisions between different slots of Python. |
305 |
mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" |
306 |
mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" |
307 |
mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" |
308 |
rm -f "${ED}usr/bin/smtpd.py" |
309 |
|
310 |
if use build; then |
311 |
rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,idlelib,lib-tk,sqlite3,test} |
312 |
else |
313 |
use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/"{bsddb/test,test} |
314 |
use berkdb || rm -fr "${ED}$(python_get_libdir)/"{bsddb,dbhash.py,test/test_bsddb*} |
315 |
use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} |
316 |
use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,lib-tk} |
317 |
fi |
318 |
|
319 |
use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" |
320 |
use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe |
321 |
|
322 |
dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" |
323 |
|
324 |
if use examples; then |
325 |
insinto /usr/share/doc/${PF}/examples |
326 |
doins -r Tools || die "doins failed" |
327 |
fi |
328 |
|
329 |
newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" |
330 |
newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" |
331 |
sed \ |
332 |
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ |
333 |
-e "s:@PYDOC@:pydoc${SLOT}:" \ |
334 |
-i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" |
335 |
} |
336 |
|
337 |
pkg_preinst() { |
338 |
if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then |
339 |
python_updater_warning="1" |
340 |
fi |
341 |
} |
342 |
|
343 |
eselect_python_update() { |
344 |
[[ -z "${EROOT}" || (! -d "${EROOT}" && -d "${ROOT}") ]] && EROOT="${ROOT%/}${EPREFIX}/" |
345 |
|
346 |
if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
347 |
eselect python update |
348 |
fi |
349 |
|
350 |
if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
351 |
eselect python update --python${PV%%.*} |
352 |
fi |
353 |
} |
354 |
|
355 |
pkg_postinst() { |
356 |
eselect_python_update |
357 |
|
358 |
python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir) |
359 |
|
360 |
if [[ "${python_updater_warning}" == "1" ]]; then |
361 |
ewarn "You have just upgraded from an older version of Python." |
362 |
ewarn "You should switch active version of Python ${PV%%.*} and run" |
363 |
ewarn "'python-updater [options]' to rebuild Python modules." |
364 |
fi |
365 |
} |
366 |
|
367 |
pkg_postrm() { |
368 |
eselect_python_update |
369 |
|
370 |
python_mod_cleanup $(python_get_libdir) |
371 |
} |
372 |
|
373 |
|
374 |
|
375 |
1.1 dev-lang/python/python-3.2.3-r1.ebuild |
376 |
|
377 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.2.3-r1.ebuild?rev=1.1&view=markup |
378 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.2.3-r1.ebuild?rev=1.1&content-type=text/plain |
379 |
|
380 |
Index: python-3.2.3-r1.ebuild |
381 |
=================================================================== |
382 |
# Copyright 1999-2012 Gentoo Foundation |
383 |
# Distributed under the terms of the GNU General Public License v2 |
384 |
# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-3.2.3-r1.ebuild,v 1.1 2012/05/01 16:07:57 floppym Exp $ |
385 |
|
386 |
EAPI="3" |
387 |
WANT_AUTOMAKE="none" |
388 |
WANT_LIBTOOL="none" |
389 |
|
390 |
inherit autotools eutils flag-o-matic multilib pax-utils python toolchain-funcs |
391 |
|
392 |
MY_P="Python-${PV}" |
393 |
PATCHSET_REVISION="1" |
394 |
|
395 |
DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." |
396 |
HOMEPAGE="http://www.python.org/" |
397 |
SRC_URI="http://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz |
398 |
mirror://gentoo/python-gentoo-patches-${PV}-${PATCHSET_REVISION}.tar.bz2" |
399 |
|
400 |
LICENSE="PSF-2" |
401 |
SLOT="3.2" |
402 |
PYTHON_ABI="${SLOT}" |
403 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
404 |
IUSE="build doc elibc_uclibc examples gdbm ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" |
405 |
|
406 |
RDEPEND="app-arch/bzip2 |
407 |
>=sys-libs/zlib-1.1.3 |
408 |
virtual/libffi |
409 |
virtual/libintl |
410 |
!build? ( |
411 |
gdbm? ( sys-libs/gdbm[berkdb] ) |
412 |
ncurses? ( |
413 |
>=sys-libs/ncurses-5.2 |
414 |
readline? ( >=sys-libs/readline-4.1 ) |
415 |
) |
416 |
sqlite? ( >=dev-db/sqlite-3.3.8:3[extensions] ) |
417 |
ssl? ( dev-libs/openssl ) |
418 |
tk? ( |
419 |
>=dev-lang/tk-8.0 |
420 |
dev-tcltk/blt |
421 |
) |
422 |
xml? ( >=dev-libs/expat-2.1 ) |
423 |
)" |
424 |
DEPEND="${RDEPEND} |
425 |
dev-util/pkgconfig |
426 |
>=sys-devel/autoconf-2.65 |
427 |
!sys-devel/gcc[libffi]" |
428 |
RDEPEND+=" !build? ( app-misc/mime-types ) |
429 |
doc? ( dev-python/python-docs:${SLOT} )" |
430 |
|
431 |
S="${WORKDIR}/${MY_P}" |
432 |
|
433 |
pkg_setup() { |
434 |
python_pkg_setup |
435 |
|
436 |
if [[ "${PV}" =~ ^3\.2(\.[1234])?(_pre)? ]]; then |
437 |
rm -f "${EROOT}usr/$(get_libdir)/llibpython3.so" |
438 |
else |
439 |
die "Deprecated code not deleted" |
440 |
fi |
441 |
} |
442 |
|
443 |
src_prepare() { |
444 |
# Ensure that internal copies of expat, libffi and zlib are not used. |
445 |
rm -fr Modules/expat |
446 |
rm -fr Modules/_ctypes/libffi* |
447 |
rm -fr Modules/zlib |
448 |
|
449 |
local excluded_patches |
450 |
if ! tc-is-cross-compiler; then |
451 |
excluded_patches="*_all_crosscompile.patch" |
452 |
fi |
453 |
|
454 |
EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \ |
455 |
epatch "${WORKDIR}/${PV}-${PATCHSET_REVISION}" |
456 |
|
457 |
sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
458 |
Lib/distutils/command/install.py \ |
459 |
Lib/distutils/sysconfig.py \ |
460 |
Lib/site.py \ |
461 |
Lib/sysconfig.py \ |
462 |
Lib/test/test_site.py \ |
463 |
Makefile.pre.in \ |
464 |
Modules/Setup.dist \ |
465 |
Modules/getpath.c \ |
466 |
setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
467 |
|
468 |
# Disable ABI flags. |
469 |
sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.in || die "sed failed" |
470 |
|
471 |
eautoconf |
472 |
eautoheader |
473 |
} |
474 |
|
475 |
src_configure() { |
476 |
if use build; then |
477 |
# Disable extraneous modules with extra dependencies. |
478 |
export PYTHON_DISABLE_MODULES="gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat" |
479 |
export PYTHON_DISABLE_SSL="1" |
480 |
else |
481 |
local disable |
482 |
use gdbm || disable+=" gdbm" |
483 |
use ncurses || disable+=" _curses _curses_panel" |
484 |
use readline || disable+=" readline" |
485 |
use sqlite || disable+=" _sqlite3" |
486 |
use ssl || export PYTHON_DISABLE_SSL="1" |
487 |
use tk || disable+=" _tkinter" |
488 |
use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
489 |
export PYTHON_DISABLE_MODULES="${disable}" |
490 |
|
491 |
if ! use xml; then |
492 |
ewarn "You have configured Python without XML support." |
493 |
ewarn "This is NOT a recommended configuration as you" |
494 |
ewarn "may face problems parsing any XML documents." |
495 |
fi |
496 |
fi |
497 |
|
498 |
if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
499 |
einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
500 |
fi |
501 |
|
502 |
if [[ "$(gcc-major-version)" -ge 4 ]]; then |
503 |
append-flags -fwrapv |
504 |
fi |
505 |
|
506 |
filter-flags -malign-double |
507 |
|
508 |
[[ "${ARCH}" == "alpha" ]] && append-flags -fPIC |
509 |
|
510 |
# https://bugs.gentoo.org/show_bug.cgi?id=50309 |
511 |
if is-flagq -O3; then |
512 |
is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
513 |
use hardened && replace-flags -O3 -O2 |
514 |
fi |
515 |
|
516 |
if tc-is-cross-compiler; then |
517 |
OPT="-O1" CFLAGS="" LDFLAGS="" CC="" \ |
518 |
./configure --{build,host}=${CBUILD} || die "cross-configure failed" |
519 |
emake python Parser/pgen || die "cross-make failed" |
520 |
mv python hostpython |
521 |
mv Parser/pgen Parser/hostpgen |
522 |
make distclean |
523 |
sed -i \ |
524 |
-e "/^HOSTPYTHON/s:=.*:=./hostpython:" \ |
525 |
-e "/^HOSTPGEN/s:=.*:=./Parser/hostpgen:" \ |
526 |
Makefile.pre.in || die "sed failed" |
527 |
fi |
528 |
|
529 |
# Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
530 |
tc-export CXX |
531 |
|
532 |
# Set LDFLAGS so we link modules with -lpython3.2 correctly. |
533 |
# Needed on FreeBSD unless Python 3.2 is already installed. |
534 |
# Please query BSD team before removing this! |
535 |
append-ldflags "-L." |
536 |
|
537 |
local dbmliborder |
538 |
if use gdbm; then |
539 |
dbmliborder+="${dbmliborder:+:}gdbm" |
540 |
fi |
541 |
|
542 |
OPT="" econf \ |
543 |
--with-fpectl \ |
544 |
--enable-shared \ |
545 |
$(use_enable ipv6) \ |
546 |
$(use_with threads) \ |
547 |
$(use_with wide-unicode) \ |
548 |
--infodir='${prefix}/share/info' \ |
549 |
--mandir='${prefix}/share/man' \ |
550 |
--with-computed-gotos \ |
551 |
--with-dbmliborder="${dbmliborder}" \ |
552 |
--with-libc="" \ |
553 |
--enable-loadable-sqlite-extensions \ |
554 |
--with-system-expat \ |
555 |
--with-system-ffi |
556 |
} |
557 |
|
558 |
src_compile() { |
559 |
emake CPPFLAGS="" CFLAGS="" LDFLAGS="" || die "emake failed" |
560 |
|
561 |
# Work around bug 329499. See also bug 413751. |
562 |
pax-mark m python |
563 |
} |
564 |
|
565 |
src_test() { |
566 |
# Tests will not work when cross compiling. |
567 |
if tc-is-cross-compiler; then |
568 |
elog "Disabling tests due to crosscompiling." |
569 |
return |
570 |
fi |
571 |
|
572 |
# Byte compiling should be enabled here. |
573 |
# Otherwise test_import fails. |
574 |
python_enable_pyc |
575 |
|
576 |
# Skip failing tests. |
577 |
local skipped_tests="gdb" |
578 |
|
579 |
for test in ${skipped_tests}; do |
580 |
mv Lib/test/test_${test}.py "${T}" |
581 |
done |
582 |
|
583 |
# Rerun failed tests in verbose mode (regrtest -w). |
584 |
emake test EXTRATESTOPTS="-w" CPPFLAGS="" CFLAGS="" LDFLAGS="" < /dev/tty |
585 |
local result="$?" |
586 |
|
587 |
for test in ${skipped_tests}; do |
588 |
mv "${T}/test_${test}.py" Lib/test |
589 |
done |
590 |
|
591 |
elog "The following tests have been skipped:" |
592 |
for test in ${skipped_tests}; do |
593 |
elog "test_${test}.py" |
594 |
done |
595 |
|
596 |
elog "If you would like to run them, you may:" |
597 |
elog "cd '${EPREFIX}$(python_get_libdir)/test'" |
598 |
elog "and run the tests separately." |
599 |
|
600 |
python_disable_pyc |
601 |
|
602 |
if [[ "${result}" -ne 0 ]]; then |
603 |
die "emake test failed" |
604 |
fi |
605 |
} |
606 |
|
607 |
src_install() { |
608 |
emake DESTDIR="${D}" altinstall || die "emake altinstall failed" |
609 |
python_clean_installation_image -q |
610 |
|
611 |
sed \ |
612 |
-e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
613 |
-e "s/\(PY_LDFLAGS=\).*/\1/" \ |
614 |
-i "${ED}$(python_get_libdir)/config-${SLOT}/Makefile" || die "sed failed" |
615 |
|
616 |
mv "${ED}usr/bin/python${SLOT}-config" "${ED}usr/bin/python-config-${SLOT}" |
617 |
|
618 |
# Fix collisions between different slots of Python. |
619 |
rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
620 |
|
621 |
if use build; then |
622 |
rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,sqlite3,test,tkinter} |
623 |
else |
624 |
use elibc_uclibc && rm -fr "${ED}$(python_get_libdir)/test" |
625 |
use sqlite || rm -fr "${ED}$(python_get_libdir)/"{sqlite3,test/test_sqlite*} |
626 |
use tk || rm -fr "${ED}usr/bin/idle${SLOT}" "${ED}$(python_get_libdir)/"{idlelib,tkinter,test/test_tk*} |
627 |
fi |
628 |
|
629 |
use threads || rm -fr "${ED}$(python_get_libdir)/multiprocessing" |
630 |
use wininst || rm -f "${ED}$(python_get_libdir)/distutils/command/"wininst-*.exe |
631 |
|
632 |
dodoc Misc/{ACKS,HISTORY,NEWS} || die "dodoc failed" |
633 |
|
634 |
if use examples; then |
635 |
insinto /usr/share/doc/${PF}/examples |
636 |
find Tools -name __pycache__ -print0 | xargs -0 rm -fr |
637 |
doins -r Tools || die "doins failed" |
638 |
fi |
639 |
|
640 |
newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} || die "newconfd failed" |
641 |
newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} || die "newinitd failed" |
642 |
sed \ |
643 |
-e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ |
644 |
-e "s:@PYDOC@:pydoc${SLOT}:" \ |
645 |
-i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" |
646 |
} |
647 |
|
648 |
pkg_preinst() { |
649 |
if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then |
650 |
python_updater_warning="1" |
651 |
fi |
652 |
} |
653 |
|
654 |
eselect_python_update() { |
655 |
if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
656 |
eselect python update |
657 |
fi |
658 |
|
659 |
if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
660 |
eselect python update --python${PV%%.*} |
661 |
fi |
662 |
} |
663 |
|
664 |
pkg_postinst() { |
665 |
eselect_python_update |
666 |
|
667 |
python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir) |
668 |
|
669 |
if [[ "${python_updater_warning}" == "1" ]]; then |
670 |
ewarn "You have just upgraded from an older version of Python." |
671 |
ewarn "You should switch active version of Python ${PV%%.*} and run" |
672 |
ewarn "'python-updater [options]' to rebuild Python modules." |
673 |
fi |
674 |
} |
675 |
|
676 |
pkg_postrm() { |
677 |
eselect_python_update |
678 |
|
679 |
python_mod_cleanup $(python_get_libdir) |
680 |
} |