Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: dev-lang/python/
Date: Fri, 01 Jul 2016 14:31:09
Message-Id: 1467380304.cea215c90adc6ff360970d169a790d1790d0585c.grobian@gentoo
1 commit: cea215c90adc6ff360970d169a790d1790d0585c
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 1 13:38:24 2016 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 1 13:38:24 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cea215c9
7
8 dev-lang/python: sync to python-2.7.11-r2
9
10 Package-Manager: portage-2.2.28-prefix
11
12 dev-lang/python/Manifest | 4 +-
13 dev-lang/python/metadata.xml | 5 +-
14 dev-lang/python/python-2.7.11-r2.ebuild | 628 ++++++++++++++++++++++++++++++++
15 3 files changed, 634 insertions(+), 3 deletions(-)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 9366723..5fbfb0c 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -1,3 +1,5 @@
22 +DIST 7be648659ef46f33db6913ca0ca5a809219d5629.zip 9173 SHA256 39e2c7367357110d4bc89a5ba515cd0f419a22e45f0ffda73db6b676ac28b718 SHA512 b1c654c852baf7891b834124607115cfaf3f1b8b7a58a9c3e8e46dd5b2f608d05d27e8a6222cc98ed83634bcfdcbbddcb888070d079cc8438db7e52320f113f9
23 +DIST 8ee84829be03c2a1aa74f0f095c994c1f43f4688.zip 14239 SHA256 811b6fe82630a04a44a6d16074af76964e7e4005136ba479647eb741639099da SHA512 2f3ada7ff2bd97f90e3b972b681624ddf45c6d1db8d5e89f1313b4693db240a3c4e27c84bd2cf8ff71d5fb276b381ca6a3b8a6945f8db53ff3496cc4cc0b1d62
24 DIST Python-2.7.10.tar.xz 12250696 SHA256 1cd3730781b91caf0fa1c4d472dc29274186480161a150294c42ce9b5c5effc0 SHA512 67615a6defbcda062f15a09f9dd3b9441afd01a8cc3255e5bc45b925378a0ddc38d468b7701176f6cc153ec52a4f21671b433780d9bde343aa9b9c1b2ae29feb WHIRLPOOL 3a9dcfc55b107dc55ad0ae93fb24a11eab7d4d9b4cfbe6b6830a090b6e5f71bb2ac91526b89c6f3e4f2610fa1a2cc4e82b58a83c599aa71f94894c74181b504b
25 DIST Python-2.7.11.tar.xz 12277476 SHA256 962b4c45af50124ea61f11a30deb4342fc0bc21126790fa1d7f6c79809413f46 SHA512 72166763a2fe6aab45ecf378f55a1efc7322d1742c4638bae84f4ed4b9fb4c01f2a0293733c64426ae2c70df24d95ff2b1e2a4f3c2715de00d8f320d4d939ea0 WHIRLPOOL 7ebcff7a2fe775a21a3847dee10369b73aaea8685eb63b4bc33dab0f562b8fb984c398cb34e8158cf1e24f106002829649540aad30a5ec7f4de0018ce7449f69
26 DIST Python-2.7.8.tar.xz 10525244 SHA256 edde10a0cb7d14e2735e682882d5b287028d1485c456758154c19573db68075a SHA512 0a992e34b6b704f028f5178c0404f8ca5fd9a7ab9da1879a20f0c72ffa712dc4925e45eb78e9368d6a17ee618259fc3f078d71766b314a732a1a28e526511a5e WHIRLPOOL 81ee40be85a8713dcc91e64c7faaf7605c43dc28f97b410b88411bbf7d4adbdf48a3e4bfa18c039c1da8695160a98ebb57e144c3198abec2b12398d80ece2971
27 @@ -19,5 +21,3 @@ DIST python-prefix-3.2.5-gentoo-patches-r0.tar.bz2 9594 SHA256 350924a35c352915d
28 DIST python-prefix-3.3.3-gentoo-patches-r2.tar.bz2 13776 SHA256 7e90671d26b60b874748efc95171f7bed149637b1d4aa34752d12fdac06d2d85 SHA512 9859d5367ae1d655572236ffdeb49ac58ae4cf48a556428a9cfb80ac21552d0d8b1c89461f31e6a8dbfdfbc9ced01f510400963571d810e79156f2a3f753fffd WHIRLPOOL b5d45333fea0610e0efba2f0d113337d9004459ec733691406518709ff4c191060d868ead7a0db0e65f89e953d03fb164c5cd1dcc128a5c0e5af93fa7fc0ffd4
29 DIST python-prefix-3.4.3-gentoo-patches-r0.tar.xz 12808 SHA256 bb51649f6a586640463dd742170ff2fdb8c906128a97b1c0bb2b9cad0fe82d56 SHA512 714e5cfa03cfd290a821dea641b91c4358a25bb1bcb47050b1cf321f0defa7e060a4cdd967bc356701642230b51f3c74476af96ff58a6f933301171e12ccfac8 WHIRLPOOL f7ff0e0bebbeee221a18d5078f12c77922c7621e00f19254e72f68767647a7d2ff9312366b62023a7d4283def2d7f509572ad657bbb2c132355ee637c5697b0c
30 DIST python-prefix-3.5.1-gentoo-patches-r1.tar.xz 12684 SHA256 a15318c069a7cb463a58ac4d8754a94a5bac081c922f07ca6e1fc6b9b9efa44a SHA512 a0086af9f361098ee7e51e260f9444c93a24c86898fe0fad8b08ad3d7f179c29bb97baa545f19fd8451d4668aa4d3894fe3769c1bf7a10f8342ded806bfd620d WHIRLPOOL 7136d338feefe6d1b7d4ad7dabe9371066f254a3405f2f737d84c69c3a79f0926e2f338e131c7d90199a8948eae95087d454a930c17a7e2f3c360eb0defce4bf
31 -DIST 8ee84829be03c2a1aa74f0f095c994c1f43f4688.zip 14239 SHA256 811b6fe82630a04a44a6d16074af76964e7e4005136ba479647eb741639099da SHA512 2f3ada7ff2bd97f90e3b972b681624ddf45c6d1db8d5e89f1313b4693db240a3c4e27c84bd2cf8ff71d5fb276b381ca6a3b8a6945f8db53ff3496cc4cc0b1d62
32 -DIST 7be648659ef46f33db6913ca0ca5a809219d5629.zip 9173 SHA256 39e2c7367357110d4bc89a5ba515cd0f419a22e45f0ffda73db6b676ac28b718 SHA512 b1c654c852baf7891b834124607115cfaf3f1b8b7a58a9c3e8e46dd5b2f608d05d27e8a6222cc98ed83634bcfdcbbddcb888070d079cc8438db7e52320f113f9
33
34 diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml
35 index 51a9e80..6a4ebd8 100644
36 --- a/dev-lang/python/metadata.xml
37 +++ b/dev-lang/python/metadata.xml
38 @@ -1,7 +1,10 @@
39 <?xml version="1.0" encoding="UTF-8"?>
40 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
41 <pkgmetadata>
42 -<herd>python</herd>
43 +<maintainer type="project">
44 + <email>python@g.o</email>
45 + <name>Python</name>
46 +</maintainer>
47 <use>
48 <flag name="threads">Enable threading support. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag>
49 <flag name="wide-unicode">Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag>
50
51 diff --git a/dev-lang/python/python-2.7.11-r2.ebuild b/dev-lang/python/python-2.7.11-r2.ebuild
52 new file mode 100644
53 index 0000000..1b54e85
54 --- /dev/null
55 +++ b/dev-lang/python/python-2.7.11-r2.ebuild
56 @@ -0,0 +1,628 @@
57 +# Copyright 1999-2015 Gentoo Foundation
58 +# Distributed under the terms of the GNU General Public License v2
59 +# $Id$
60 +
61 +EAPI="5"
62 +WANT_LIBTOOL="none"
63 +
64 +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
65 +
66 +MY_P="Python-${PV}"
67 +PATCHSET_VERSION="2.7.11-0"
68 +PREFIX_PATCHREV="r0"
69 +CYGWINPORTS_GITREV="7be648659ef46f33db6913ca0ca5a809219d5629"
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.xz
74 + https://dev.gentoo.org/~djc/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
75 + https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz"
76 +
77 +[[ -n ${CYGWINPORTS_GITREV} ]] &&
78 +SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/python/archive/${CYGWINPORTS_GITREV}.zip )"
79 +
80 +LICENSE="PSF-2"
81 +SLOT="2.7"
82 +KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
83 +IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
84 +
85 +# Do not add a dependency on dev-lang/python to this ebuild.
86 +# If you need to apply a patch which requires python for bootstrapping, please
87 +# run the bootstrap code on your dev box and include the results in the
88 +# patchset. See bug 447752.
89 +
90 +RDEPEND="app-arch/bzip2:0=
91 + >=sys-libs/zlib-1.1.3:0=
92 + !m68k-mint? ( virtual/libffi )
93 + virtual/libintl
94 + berkdb? ( || (
95 + sys-libs/db:5.3
96 + sys-libs/db:5.2
97 + sys-libs/db:5.1
98 + sys-libs/db:5.0
99 + sys-libs/db:4.8
100 + sys-libs/db:4.7
101 + sys-libs/db:4.6
102 + sys-libs/db:4.5
103 + sys-libs/db:4.4
104 + sys-libs/db:4.3
105 + sys-libs/db:4.2
106 + ) )
107 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
108 + ncurses? (
109 + >=sys-libs/ncurses-5.2:0=
110 + readline? ( >=sys-libs/readline-4.1:0= )
111 + )
112 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
113 + ssl? (
114 + !libressl? ( dev-libs/openssl:0= )
115 + libressl? ( dev-libs/libressl:= )
116 + )
117 + tk? (
118 + >=dev-lang/tcl-8.0:0=
119 + >=dev-lang/tk-8.0:0=[-aqua]
120 + dev-tcltk/blt:0=
121 + dev-tcltk/tix
122 + )
123 + xml? ( >=dev-libs/expat-2.1 )
124 + !!<sys-apps/portage-2.1.9"
125 +DEPEND="${RDEPEND}
126 + virtual/pkgconfig
127 + >=sys-devel/autoconf-2.65
128 + !sys-devel/gcc[libffi]"
129 +RDEPEND+=" !build? ( app-misc/mime-types )
130 + doc? ( dev-python/python-docs:${SLOT} )"
131 +PDEPEND=">=app-eselect/eselect-python-20140125-r1
132 + app-admin/python-updater"
133 +
134 +S="${WORKDIR}/${MY_P}"
135 +
136 +pkg_setup() {
137 + if use berkdb; then
138 + ewarn "'bsddb' module is out-of-date and no longer maintained inside"
139 + ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
140 + ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
141 + ewarn "is provided by dev-python/bsddb3."
142 + else
143 + if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
144 + ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
145 + ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
146 + ewarn "You might need to migrate your databases."
147 + fi
148 + fi
149 +}
150 +
151 +src_prepare() {
152 + # Ensure that internal copies of expat, libffi and zlib are not used.
153 + rm -r Modules/expat || die
154 + rm -r Modules/_ctypes/libffi* || die
155 + rm -r Modules/zlib || die
156 +
157 + if tc-is-cross-compiler; then
158 + local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
159 + fi
160 +
161 + EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
162 +
163 + # if building a patched source-tar, comment the rm's above, and uncomment
164 + # this line:
165 + #local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
166 +
167 + # Prefix' round of patches
168 + # http://prefix.gentooexperimental.org:8000/python-patches-2_7
169 + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
170 + epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
171 +
172 + if use aqua ; then
173 + # make sure we don't get a framework reference here
174 + sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
175 + -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
176 + Makefile.pre.in || die
177 + # Python upstream refuses to listen to configure arguments
178 + sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \
179 + configure.ac configure || die
180 + # we handle creation of symlinks in src_install
181 + sed -i -e '/ln -fs .*PYTHONFRAMEWORK/d' Makefile.pre.in || die
182 + fi
183 + # don't try to do fancy things on Darwin
184 + sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
185 +
186 + # Fix for cross-compiling.
187 + epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
188 + epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
189 + epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
190 + epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
191 + epatch "${FILESDIR}/python-3.4-pyfpe-dll.patch" # Cygwin: --with-fpectl
192 +
193 + # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
194 + sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
195 +
196 + # Make sure python doesn't use the host libffi.
197 + use prefix && epatch "${FILESDIR}/python-2.7-libffi-pkgconfig.patch"
198 +
199 + if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
200 + local p d="${WORKDIR}/python-${CYGWINPORTS_GITREV}"
201 + for p in $(
202 + eval "$(sed -ne '/PATCH_URI="/,/"/p' < "${d}"/python.cygport)"
203 + echo ${PATCH_URI}
204 + ); do
205 + # dropped by 01_all_prefix-no-patch-invention.patch
206 + [[ ${p} == *-tkinter-* ]] && continue
207 + epatch "${d}/${p}"
208 + done
209 + fi
210 +
211 + epatch_user
212 +
213 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
214 + Lib/distutils/command/install.py \
215 + Lib/distutils/sysconfig.py \
216 + Lib/site.py \
217 + Lib/sysconfig.py \
218 + Lib/test/test_site.py \
219 + Makefile.pre.in \
220 + Modules/Setup.dist \
221 + Modules/getpath.c \
222 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
223 +
224 + eautoreconf
225 +}
226 +
227 +src_configure() {
228 + # dbm module can be linked against berkdb or gdbm.
229 + # Defaults to gdbm when both are enabled, #204343.
230 + local disable
231 + use berkdb || use gdbm || disable+=" dbm"
232 + use berkdb || disable+=" _bsddb"
233 + use gdbm || disable+=" gdbm"
234 + use ncurses || disable+=" _curses _curses_panel"
235 + use readline || disable+=" readline"
236 + use sqlite || disable+=" _sqlite3"
237 + use ssl || export PYTHON_DISABLE_SSL="1"
238 + use tk || disable+=" _tkinter"
239 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
240 + [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon
241 + [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs"
242 + export PYTHON_DISABLE_MODULES="${disable}"
243 +
244 + if ! use xml; then
245 + ewarn "You have configured Python without XML support."
246 + ewarn "This is NOT a recommended configuration as you"
247 + ewarn "may face problems parsing any XML documents."
248 + fi
249 +
250 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
251 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
252 + fi
253 +
254 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
255 + append-flags -fwrapv
256 + fi
257 +
258 + filter-flags -malign-double
259 +
260 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
261 + if is-flagq -O3; then
262 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
263 + use hardened && replace-flags -O3 -O2
264 + fi
265 +
266 + if tc-is-cross-compiler; then
267 + # Force some tests that try to poke fs paths.
268 + export ac_cv_file__dev_ptc=no
269 + export ac_cv_file__dev_ptmx=yes
270 + fi
271 +
272 + # http://bugs.gentoo.org/show_bug.cgi?id=302137
273 + if [[ ${CHOST} == powerpc-*-darwin* ]] && \
274 + ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \
275 + [[ ${CHOST} == powerpc64-*-darwin* ]];
276 + then
277 + replace-flags -O2 -O3
278 + replace-flags -Os -O3 # comment #14
279 + fi
280 +
281 + # Set LDFLAGS so we link modules with -lpython2.7 correctly.
282 + # Needed on FreeBSD unless Python 2.7 is already installed.
283 + # Please query BSD team before removing this!
284 + # On AIX this is not needed, but would record '.' as runpath.
285 + [[ ${CHOST} == *-aix* ]] ||
286 + append-ldflags "-L."
287 +
288 + if use prefix ; then
289 + # for Python's setup.py not to do false assumptions (only looking in
290 + # host paths) we need to make explicit where Prefix stuff is
291 + append-cppflags -I"${EPREFIX}"/usr/include
292 + append-ldflags -L"${EPREFIX}"/$(get_libdir)
293 + append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
294 + # fix compilation on some 64-bits Linux hosts, #381163, #473520
295 + for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
296 + [[ -d ${hostlibdir} ]] || continue
297 + append-ldflags -L${hostlibdir}
298 + done
299 + # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that
300 + # local include paths - set in $(CPPFLAGS) - are searched first.
301 + sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
302 + fi
303 +
304 + # Export CC so even AIX will use gcc instead of xlc_r.
305 + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
306 + tc-export CC CXX
307 + # The configure script fails to use pkg-config correctly.
308 + # http://bugs.python.org/issue15506
309 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
310 +
311 + local dbmliborder
312 + if use gdbm; then
313 + dbmliborder+="${dbmliborder:+:}gdbm"
314 + fi
315 + if use berkdb; then
316 + dbmliborder+="${dbmliborder:+:}bdb"
317 + fi
318 +
319 + [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
320 +
321 + # we need this to get pythonw, the GUI version of python
322 + # --enable-framework and --enable-shared are mutually exclusive:
323 + # http://bugs.python.org/issue5809
324 + local myshared=
325 + use aqua \
326 + && myshared="--enable-framework=${EPREFIX}/usr/lib" \
327 + || myshared="--enable-shared"
328 +
329 + BUILD_DIR="${WORKDIR}/${CHOST}"
330 + mkdir -p "${BUILD_DIR}" || die
331 + cd "${BUILD_DIR}" || die
332 +
333 + # note: for a framework build we need to use ucs2 because OSX
334 + # uses that internally too:
335 + # http://bugs.python.org/issue763708
336 + # HAS_HG to avoid finding obsolete hg of the host
337 + ECONF_SOURCE="${S}" OPT="" HAS_HG="no" \
338 + econf \
339 + --with-fpectl \
340 + ${myshared} \
341 + $(use_enable ipv6) \
342 + $(use_with threads) \
343 + $( (use wide-unicode && use !aqua) && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
344 + --infodir='${prefix}/share/info' \
345 + --mandir='${prefix}/share/man' \
346 + --with-computed-gotos \
347 + --with-dbmliborder="${dbmliborder}" \
348 + --with-libc="" \
349 + --enable-loadable-sqlite-extensions \
350 + --with-system-expat \
351 + --with-system-ffi \
352 + --without-ensurepip
353 +
354 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
355 + eerror "configure has detected that the sem_open function is broken."
356 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
357 + die "Broken sem_open function (bug 496328)"
358 + fi
359 +}
360 +
361 +src_compile() {
362 + # Avoid invoking pgen for cross-compiles.
363 + touch Include/graminit.h Python/graminit.c
364 +
365 + cd "${BUILD_DIR}" || die
366 + emake
367 +
368 + # Work around bug 329499. See also bug 413751 and 457194.
369 + if has_version dev-libs/libffi[pax_kernel]; then
370 + pax-mark E python
371 + else
372 + pax-mark m python
373 + fi
374 +}
375 +
376 +src_test() {
377 + # Tests will not work when cross compiling.
378 + if tc-is-cross-compiler; then
379 + elog "Disabling tests due to crosscompiling."
380 + return
381 + fi
382 +
383 + cd "${BUILD_DIR}" || die
384 +
385 + # Skip failing tests.
386 + local skipped_tests="distutils gdb"
387 +
388 + for test in ${skipped_tests}; do
389 + mv "${S}"/Lib/test/test_${test}.py "${T}"
390 + done
391 +
392 + # Rerun failed tests in verbose mode (regrtest -w).
393 + emake test EXTRATESTOPTS="-w" < /dev/tty
394 + local result="$?"
395 +
396 + for test in ${skipped_tests}; do
397 + mv "${T}/test_${test}.py" "${S}"/Lib/test
398 + done
399 +
400 + elog "The following tests have been skipped:"
401 + for test in ${skipped_tests}; do
402 + elog "test_${test}.py"
403 + done
404 +
405 + elog "If you would like to run them, you may:"
406 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
407 + elog "and run the tests separately."
408 +
409 + if [[ "${result}" -ne 0 ]]; then
410 + die "emake test failed"
411 + fi
412 +}
413 +
414 +src_install() {
415 + local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
416 +
417 + cd "${BUILD_DIR}" || die
418 + [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
419 + if use aqua ; then
420 + local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
421 +
422 + # do not make multiple targets in parallel when there are broken
423 + # sharedmods (during bootstrap), would build them twice in parallel.
424 +
425 + # Python_Launcher is kind of a wrapper, and we should fix it for
426 + # Prefix (it uses /usr/bin/pythonw) so useless
427 + # IDLE doesn't run, no idea, but definitely not used
428 + sed -i -e 's/install_\(BuildApplet\|PythonLauncher\|IDLE\)[^:]//g' \
429 + Mac/Makefile || die
430 +
431 + # let the makefiles do their thing
432 + emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall
433 + rmdir "${ED}"/Applications/Python* || die
434 + rmdir "${ED}"/Applications || die
435 +
436 + # avoid framework incompatability, degrade to a normal UNIX lib
437 + mkdir -p "${ED}"/usr/$(get_libdir)
438 + cp "${D}${fwdir}"/Versions/${SLOT}/Python \
439 + "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
440 + chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
441 + install_name_tool \
442 + -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
443 + "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
444 + chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
445 + cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die
446 +
447 + # rebuild python executable to be the non-pythonw (python wrapper)
448 + # version so we don't get framework crap
449 + rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861
450 + $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
451 + -o "${ED}"/usr/bin/python${SLOT} \
452 + Modules/python.o || die
453 +
454 + # don't install the "Current" symlink, will always conflict
455 + rm "${D}${fwdir}"/Versions/Current || die
456 + # update whatever points to it, eselect-python sets them
457 + rm "${D}${fwdir}"/{Headers,Python,Resources} || die
458 +
459 + # remove unversioned files (that are not made versioned below)
460 + pushd "${ED}"/usr/bin > /dev/null
461 + rm -f python python-config python${SLOT}-config
462 + # python${SLOT} was created above
463 + for f in pythonw smtpd${SLOT}.py pydoc idle ; do
464 + rm -f ${f} ${f}${SLOT}
465 + done
466 + # pythonw needs to remain in the framework (that's the whole
467 + # reason we go through this framework hassle)
468 + ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die
469 + # copy the scripts to we can fix their shebangs
470 + for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
471 + # for some reason sometimes they already exist, bug #347321
472 + rm -f ${f}
473 + cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
474 + sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
475 + ${f} || die
476 + done
477 + # "fix" to have below collision fix not to bail
478 + mv pydoc${SLOT} pydoc || die
479 + mv idle${SLOT} idle || die
480 + popd > /dev/null
481 +
482 + # basically we don't like the framework stuff at all, so just move
483 + # stuff around or add some symlinks to make our life easier
484 + mkdir -p "${ED}"/usr
485 + mv "${D}${fwdir}"/Versions/${SLOT}/share \
486 + "${ED}"/usr/ || die "can't move share"
487 + # get includes just UNIX style
488 + mkdir -p "${ED}"/usr/include
489 + mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
490 + "${ED}"/usr/include/ || die "can't move include"
491 + pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
492 + ln -s ../../../../../include/python${SLOT} || die
493 + popd > /dev/null
494 + rm -f "${ED}"/usr/share/man/man1/python{,2}.1
495 +
496 + # same for libs
497 + # NOTE: can't symlink the entire dir, because a real dir already exists
498 + # on upgrade (site-packages), however since we h4x0rzed python to
499 + # actually look into the UNIX-style dir, we just switch them around.
500 + mkdir -p "${ED}"/usr/$(get_libdir)/python${SLOT}
501 + mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT}/* \
502 + "${ED}"/usr/$(get_libdir)/python${SLOT}/ \
503 + || die "can't move python${SLOT}"
504 + rmdir "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} || die
505 + pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
506 + ln -s ../../../../python${SLOT} || die
507 + popd > /dev/null
508 +
509 + # fix up Makefile
510 + sed -i \
511 + -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \
512 + -e '/^LDFLAGS=/s/=.*$/=/' \
513 + -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
514 + -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
515 + -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
516 + -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
517 + -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
518 + -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
519 + "${libdir}"/config/Makefile || die
520 + # and sysconfigdata likewise
521 + sed -i \
522 + -e "/'LINKFORSHARED'/s/-u _PyMac_Error[^']*'/'/" \
523 + -e "/'LDFLAGS'/s/:.*$/:'',/" \
524 + -e "/'prefix'/s|:.*$|:'${EPREFIX}/usr',|" \
525 + -e "/'PYTHONFRAMEWORK'/s/:.*$/:'',/" \
526 + -e "/'PYTHONFRAMEWORKDIR'/s/:.*$/:'no-framework',/" \
527 + -e "/'PYTHONFRAMEWORKPREFIX'/s/:.*$/:'',/" \
528 + -e "/'PYTHONFRAMEWORKINSTALLDIR'/s/:.*$/:'',/" \
529 + -e "/'LDLIBRARY'/s|:.*$|:'libpython${SLOT}.dylib',|" \
530 + "${libdir}"/_sysconfigdata.py || die
531 +
532 + # add missing version.plist file
533 + mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
534 + cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
535 +<?xml version="1.0" encoding="UTF-8"?>
536 +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
537 +"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
538 +<plist version="1.0">
539 +<dict>
540 + <key>BuildVersion</key>
541 + <string>1</string>
542 + <key>CFBundleShortVersionString</key>
543 + <string>${PV}</string>
544 + <key>CFBundleVersion</key>
545 + <string>${PV}</string>
546 + <key>ProjectName</key>
547 + <string>Python</string>
548 + <key>SourceVersion</key>
549 + <string>${PV}</string>
550 +</dict>
551 +</plist>
552 +EOF
553 + else
554 + emake DESTDIR="${D}" altinstall
555 + fi
556 +
557 + sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
558 + if [[ ${CHOST} == *-aix* ]]; then
559 + # fix upstream bugs with quite large proposed diffs still to be sorted out:
560 + # http://bugs.python.org/issue13493
561 + # http://bugs.python.org/issue14150
562 + # http://bugs.python.org/issue15590
563 + # http://bugs.python.org/issue16189
564 + sed -e "/Libs:/s|\$| -Wl,-bE:${EPREFIX}/${libdir#$ED}/config/python.exp -lld|" \
565 + -i "${ED}"usr/$(get_libdir)/pkgconfig/python-${SLOT}.pc || die "sed failed"
566 + sed -e "s|:Modules/python.exp|:${EPREFIX}/${libdir#$ED}/config/python.exp|" \
567 + -e 's| -bI:| -Wl,-bI:|g' \
568 + -e '/LINKFORSHARED/s|-bE:|-bI:|g' \
569 + -e '/LINKFORSHARED/s| -lld||g' \
570 + -i "${libdir}"/{_sysconfigdata.py,config/Makefile} || die "sed failed"
571 + fi
572 +
573 + # Fix collisions between different slots of Python.
574 + mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
575 + mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
576 + mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
577 + rm -f "${ED}usr/bin/smtpd.py"
578 +
579 + # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
580 + # These #defines cause problems when building c99 compliant python modules
581 + # http://bugs.python.org/issue1759169
582 + [[ ${CHOST} == *-solaris* ]] && sed -i -e \
583 + 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
584 + "${ED}"/usr/include/python${SLOT}/pyconfig.h
585 +
586 + use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
587 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
588 + use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
589 + use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
590 +
591 + use threads || rm -r "${libdir}/multiprocessing" || die
592 + use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
593 +
594 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
595 +
596 + if use examples; then
597 + insinto /usr/share/doc/${PF}/examples
598 + doins -r "${S}"/Tools
599 + fi
600 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
601 + local libname
602 + if use aqua ; then
603 + # we do framework, so the emake trick below returns a pathname
604 + # since that won't work here, use a (cheap) trick instead
605 + libname=libpython${SLOT}
606 + else
607 + libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
608 + emake --no-print-directory -s -f - 2>/dev/null)
609 + fi
610 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
611 +
612 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
613 + newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
614 + sed \
615 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
616 + -e "s:@PYDOC@:pydoc${SLOT}:" \
617 + -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
618 +
619 + # for python-exec
620 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
621 +
622 + # if not using a cross-compiler, use the fresh binary
623 + if ! tc-is-cross-compiler; then
624 + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
625 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
626 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}.
627 + else
628 + vars=( PYTHON "${vars[@]}" )
629 + fi
630 +
631 + python_export "python${SLOT}" "${vars[@]}"
632 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
633 + python_domodule epython.py
634 +
635 + # python-exec wrapping support
636 + local pymajor=${SLOT%.*}
637 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
638 + # python and pythonX
639 + ln -s "../../../bin/python${SLOT}" \
640 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
641 + ln -s "python${pymajor}" \
642 + "${D}${PYTHON_SCRIPTDIR}/python" || die
643 + # python-config and pythonX-config
644 + ln -s "../../../bin/python${SLOT}-config" \
645 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
646 + ln -s "python${pymajor}-config" \
647 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
648 + # 2to3, pydoc, pyvenv
649 + ln -s "../../../bin/2to3-${SLOT}" \
650 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
651 + ln -s "../../../bin/pydoc${SLOT}" \
652 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
653 + # idle
654 + if use tk; then
655 + ln -s "../../../bin/idle${SLOT}" \
656 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
657 + fi
658 +}
659 +
660 +pkg_preinst() {
661 + if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.7"; then
662 + python_updater_warning="1"
663 + fi
664 +}
665 +
666 +eselect_python_update() {
667 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
668 + eselect python update
669 + fi
670 +}
671 +
672 +pkg_postinst() {
673 + eselect_python_update
674 +
675 + if [[ "${python_updater_warning}" == "1" ]]; then
676 + ewarn "You have just upgraded from an older version of Python."
677 + ewarn "You should switch active version of Python ${PV%%.*} and run"
678 + ewarn "'python-updater [options]' to rebuild Python modules."
679 + fi
680 +}
681 +
682 +pkg_postrm() {
683 + eselect_python_update
684 +}