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/, dev-lang/python/files/
Date: Mon, 14 Dec 2015 19:15:20
Message-Id: 1450120408.f9b3e3bea3d0b312b0cc141b44ed1c9715768726.grobian@gentoo
1 commit: f9b3e3bea3d0b312b0cc141b44ed1c9715768726
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 14 19:13:28 2015 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 14 19:13:28 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f9b3e3be
7
8 dev-lang/python: add python-3.4.3-r5
9
10 Package-Manager: portage-2.2.20-prefix
11
12 dev-lang/python/Manifest | 3 +
13 dev-lang/python/files/python-3.4-gcc-5.patch | 37 ++
14 .../files/python-3.4.3-ncurses-pkg-config.patch | 13 +
15 dev-lang/python/python-3.4.3-r5.ebuild | 409 +++++++++++++++++++++
16 4 files changed, 462 insertions(+)
17
18 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
19 index 57a2f7e..2c0f64a 100644
20 --- a/dev-lang/python/Manifest
21 +++ b/dev-lang/python/Manifest
22 @@ -3,13 +3,16 @@ DIST Python-2.7.11.tar.xz 12277476 SHA256 962b4c45af50124ea61f11a30deb4342fc0bc2
23 DIST Python-2.7.8.tar.xz 10525244 SHA256 edde10a0cb7d14e2735e682882d5b287028d1485c456758154c19573db68075a SHA512 0a992e34b6b704f028f5178c0404f8ca5fd9a7ab9da1879a20f0c72ffa712dc4925e45eb78e9368d6a17ee618259fc3f078d71766b314a732a1a28e526511a5e WHIRLPOOL 81ee40be85a8713dcc91e64c7faaf7605c43dc28f97b410b88411bbf7d4adbdf48a3e4bfa18c039c1da8695160a98ebb57e144c3198abec2b12398d80ece2971
24 DIST Python-3.2.5.tar.xz 9221624 SHA256 8ccb9645b9779fc4550055b2ebb21a724ab7a63dee45643286eb4f79b2f84116 SHA512 6e71d01695c7b1e74d9781e4ac40a8d1560cae659d5351d392fc685b84316568d93740a99d2ed878dd87d4ce1708d0474cb01c6bad7b3dab610c639f3255b09d WHIRLPOOL d5e5fae5e1d4110861e1e1dac00c9812abbbc37205e8ce3cd268535ab9f66e24038ab4778af8bb834fd472eaa0281730f1f2fabdf6dffc4f6b54ef32c1d75953
25 DIST Python-3.3.3.tar.xz 12057744 SHA256 339275b30a1a3fef1589016bf6302c14e870f7a6fd2522bf87a6c2c6d383c685 SHA512 6acd905d2ae70a259de1d502c90ce9cc831b03cd32930d55bdce1f6dd4b2657c4bb8698e46f6558253338046c43ee842befa2d62e35eeb82b82659acbe6ea0aa WHIRLPOOL 680a88bc7ca312a71237350c06573d5ed6138d826613a6a8ad9e953181561966c9a9f64b176226a627175b8bb5d13755bb7cabe20ee9510ced5da14185e092a4
26 +DIST Python-3.4.3.tar.xz 14421964 SHA256 b5b3963533768d5fc325a4d7a6bd6f666726002d696f1d399ec06b043ea996b8 SHA512 55b2d7c07da8ad3a3971b4687da2e45809c6f1474732e93b0432f121f287d0b63ad8a9bf381987ea70f47a03d9474c3e55b7d86d14800bf7ef29b3324d8d35b9 WHIRLPOOL f851dedc6a1ea35adec83d60784a5fbcd9dfcf6aa8858bb5ada114fa2ff55add1fbf323ab94ec039ecdedb26d59e8f2e6e171cd9fc1ed41ad9cfa434a555cff3
27 DIST python-gentoo-patches-2.7.10-0.tar.xz 12892 SHA256 c9a838bd62ae50cc385da23a837acfd05f2b74e4f086c9c76eb4d3aa5366ef6d SHA512 5f100944635e360691dc0a2b340a906646c4ae9ee558246ddffc56e8b15d389f25f1fbdc1db4cc08e7d29560d04d66b058b3904902899d58ecae8c408ebdf056 WHIRLPOOL f69e9a518bb7ee50c1b262a21e70e1e2443f859ee6d2f4fa84421120dbd054a06ce8dd6cfea8512cbc64bce806322b879c25c561d5eb05e1ba6cc15035b373a9
28 DIST python-gentoo-patches-2.7.11-0.tar.xz 12916 SHA256 e14b47bb1fd64d366d7dfb8339cc2cbf4a53fc288b11dd83f575eb36a8a6408d SHA512 f0447bb699a163afc08df39b111394377539935546ae23732d7239e78d2bff0c04bc94949f86aef0c1be83736127dbd25c2c531e49befed2d638c3cd4940ac52 WHIRLPOOL 305992849d9d244da1e308e739c9bf62a3ef5c74eb65c765bdc666fb5767eb16c7a609f7c442c17da17f76c3ab81e4b09fa8c21e43f89366539a6a9d656bea77
29 DIST python-gentoo-patches-2.7.8-0.tar.xz 14016 SHA256 22ca5eab8e1702f220c272c57359f547b753b88d59b53ab95c7985c17f4f90ec SHA512 17020c8a2039cc073c973e213e77dc67ad9ed4ae7f5fafb931933943aa745733309c46e3972bfde85d112cdef6d47aa91868a614db08bb135c29051999c3df4e WHIRLPOOL 96f0e5c7329cc886d979ec782ffd3c63461f49ba112f0d95e5528d7f15048170cd4e52b78cb4100839d509ef28b927bf7a0f1a610fcf4ec562730a284f8c9fc3
30 DIST python-gentoo-patches-3.2.5-1.tar.xz 14628 SHA256 0acc5531421781ab7f30e6fc8a502f202b79aa285b4f411eb16ea0a9e6d958c1 SHA512 1abbd53e92466d258802717309e1839ae931b8a4b0a5a27d4d0da748e71cf96ac47c6837bdbae5dd6921a46cee339c178f86ff3108afe95e6a0a42c4f4300791 WHIRLPOOL de003cccb8b311413889713d66b7987f28a1f906cc9642621d1fd2a379ceae4f0f901c137503d808dc3da7295ac611de09781bf8661cdbcd14c1d7c94ba489c2
31 DIST python-gentoo-patches-3.3.3-0.tar.xz 12992 SHA256 38b5c604416947fdd7d87ada2ccd3febf7407f00c1e67e6a99be8765f1b25c49 SHA512 d803b287c0f407c68dd766974296239419fb35441f1796081681f28d17b1f6c7e50e0aae807ad147469eb586db8fe486a013a166cb76e08f2b7a9ba39acb1760 WHIRLPOOL 09a9dbd1831c2e7022f4df27b57435dd1df7eace294e8fa069ce5fa5c1719f64ba9bcd8f27d614a8c13ee8605db37c7e75c13fa14885b76ce289667bf2871aaf
32 +DIST python-gentoo-patches-3.4.3-0.tar.xz 11736 SHA256 917a9d98d40a91379c81ea57922a8632ba3c6f6db6f304ed6262bc88c5044946 SHA512 7ad1b30cf8bb7900fe518ed71e4ee55dd92ce7e23ae583a1f2f851b26cfa8c4f4271d28f418e780f3725a48d4ca8eeb8fd083f850810c66c29fb08c430828d72 WHIRLPOOL 074e8c0055b49a028eebda21d1acfb8a25ec968eb8b350c2bed37e042f9f354871e413db13e0ef2fe41d7e56d647178a7b3622019f36c4819c2c68f088366eb1
33 DIST python-prefix-2.7.10-gentoo-patches.tar.bz2 16922 SHA256 9fe4df587363c439f1f29885b4b2a1238d16861667966b279dc1019cb904efa4 SHA512 a016e1572276dbbe0fc045d723b592b31573f99b60370f0c1506f10fd9a632cc879bdc4a2060c6a5ff411f26179189517ff4c4beb6979a5727e0dc17de935fe2 WHIRLPOOL 73542d16f9f64acb2cb941ce659d981d6d8b8a8cba9ef4f41c4b987665beedb125a6ad4a7badb5eb12092d916e1ab807330a2fcefc7914ae9708569d54faa7b6
34 DIST python-prefix-2.7.11-gentoo-patches-r0.tar.xz 17348 SHA256 c02e37fc75fa280cfed86d20df3dc4c8a7ff46f18eb67b268d75209f0c1a2fc6 SHA512 c181953cc30c94935a06f7511b5d641a1b45127a69ccf9e8e22cb31c0da6e54e7e4ccc5c5f4a15889c079d5b1d3c74b94e8da49dc018c807b6b8b0376cb70e76 WHIRLPOOL a8dcda32eadb3c3e1908f5a493b06046190d2f53347edfe3ef859926fe2e741535c9a9ad0ebbe1b0ea011b858f6ee21c04f806469b7249d453e6ae4b7a6cd2b2
35 DIST python-prefix-2.7.8-gentoo-patches.tar.bz2 17154 SHA256 6c5f171f15f662c2b88258ebff152224a7003c43e025be860baf99913d00a8b1 SHA512 fe53cf969e70744ed6c66757e507f55eea031fa98e08f1846e3c51b968eb8d91a377c9c47cbc5cd469715c37d71b70dd1dc46fdbb52cab372179acb497a81643 WHIRLPOOL f966f3dc68f7cf171aeef0226a72616d42f13e9b085a772aa7221b1898a74e0b31c74350c7114fc6a39ab739877d5e12be1755357e2821f8b026af61fa99b4b3
36 DIST python-prefix-3.2.5-gentoo-patches-r0.tar.bz2 9594 SHA256 350924a35c352915d619aea9077ef26707b2621683cca926de5cb55b5dc429fa SHA512 63eb12cea50a9d3a557071f47f4d8200153c495f7e8f9853508194b56b8e16da956fe0e6b790085f4ecdcc8d5c29a0c50664fee1bd522d52d98a43c2bceb28ea WHIRLPOOL e5335f7df1bf21f5303e90048c15d5cf0d539b269a428a417e8678c74f8ab630691456c6e02476bf223531d12e44f7cfb71f6b631f371c8a0dc454e4e5d3607a
37 DIST python-prefix-3.3.3-gentoo-patches-r2.tar.bz2 13776 SHA256 7e90671d26b60b874748efc95171f7bed149637b1d4aa34752d12fdac06d2d85 SHA512 9859d5367ae1d655572236ffdeb49ac58ae4cf48a556428a9cfb80ac21552d0d8b1c89461f31e6a8dbfdfbc9ced01f510400963571d810e79156f2a3f753fffd WHIRLPOOL b5d45333fea0610e0efba2f0d113337d9004459ec733691406518709ff4c191060d868ead7a0db0e65f89e953d03fb164c5cd1dcc128a5c0e5af93fa7fc0ffd4
38 +DIST python-prefix-3.4.3-gentoo-patches-r0.tar.xz 12808 SHA256 bb51649f6a586640463dd742170ff2fdb8c906128a97b1c0bb2b9cad0fe82d56 SHA512 714e5cfa03cfd290a821dea641b91c4358a25bb1bcb47050b1cf321f0defa7e060a4cdd967bc356701642230b51f3c74476af96ff58a6f933301171e12ccfac8 WHIRLPOOL f7ff0e0bebbeee221a18d5078f12c77922c7621e00f19254e72f68767647a7d2ff9312366b62023a7d4283def2d7f509572ad657bbb2c132355ee637c5697b0c
39
40 diff --git a/dev-lang/python/files/python-3.4-gcc-5.patch b/dev-lang/python/files/python-3.4-gcc-5.patch
41 new file mode 100644
42 index 0000000..80afbd1
43 --- /dev/null
44 +++ b/dev-lang/python/files/python-3.4-gcc-5.patch
45 @@ -0,0 +1,37 @@
46 +changeset: 94583:689092296ad3
47 +branch: 3.4
48 +parent: 94579:645f3d750be1
49 +user: Victor Stinner <victor.stinner@×××××.com>
50 +date: Wed Feb 11 14:23:35 2015 +0100
51 +summary: Issue #23433: Fix faulthandler._stack_overflow()
52 +
53 +diff -r 645f3d750be1 -r 689092296ad3 Modules/faulthandler.c
54 +--- a/Modules/faulthandler.c Tue Feb 10 14:49:32 2015 +0100
55 ++++ b/Modules/faulthandler.c Wed Feb 11 14:23:35 2015 +0100
56 +@@ -911,12 +911,12 @@
57 + }
58 +
59 + #if defined(HAVE_SIGALTSTACK) && defined(HAVE_SIGACTION)
60 +-static void*
61 +-stack_overflow(void *min_sp, void *max_sp, size_t *depth)
62 ++static Py_uintptr_t
63 ++stack_overflow(Py_uintptr_t min_sp, Py_uintptr_t max_sp, size_t *depth)
64 + {
65 + /* allocate 4096 bytes on the stack at each call */
66 + unsigned char buffer[4096];
67 +- void *sp = &buffer;
68 ++ Py_uintptr_t sp = (Py_uintptr_t)&buffer;
69 + *depth += 1;
70 + if (sp < min_sp || max_sp < sp)
71 + return sp;
72 +@@ -929,7 +929,8 @@
73 + faulthandler_stack_overflow(PyObject *self)
74 + {
75 + size_t depth, size;
76 +- char *sp = (char *)&depth, *stop;
77 ++ Py_uintptr_t sp = (Py_uintptr_t)&depth;
78 ++ Py_uintptr_t stop;
79 +
80 + depth = 0;
81 + stop = stack_overflow(sp - STACK_OVERFLOW_MAX_SIZE,
82 +
83
84 diff --git a/dev-lang/python/files/python-3.4.3-ncurses-pkg-config.patch b/dev-lang/python/files/python-3.4.3-ncurses-pkg-config.patch
85 new file mode 100644
86 index 0000000..8bfad11
87 --- /dev/null
88 +++ b/dev-lang/python/files/python-3.4.3-ncurses-pkg-config.patch
89 @@ -0,0 +1,13 @@
90 +do not hardcode /usr/include paths
91 +
92 +--- a/configure.ac
93 ++++ b/configure.ac
94 +@@ -4402,7 +4402,7 @@ fi
95 +
96 + # first curses header check
97 + ac_save_cppflags="$CPPFLAGS"
98 +-CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"
99 ++CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags ncursesw`"
100 +
101 + AC_CHECK_HEADERS(curses.h ncurses.h)
102 +
103
104 diff --git a/dev-lang/python/python-3.4.3-r5.ebuild b/dev-lang/python/python-3.4.3-r5.ebuild
105 new file mode 100644
106 index 0000000..f86d0ab
107 --- /dev/null
108 +++ b/dev-lang/python/python-3.4.3-r5.ebuild
109 @@ -0,0 +1,409 @@
110 +# Copyright 1999-2015 Gentoo Foundation
111 +# Distributed under the terms of the GNU General Public License v2
112 +# $Id$
113 +
114 +EAPI="5"
115 +WANT_LIBTOOL="none"
116 +
117 +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
118 +
119 +MY_P="Python-${PV/_/}"
120 +PATCHSET_VERSION="3.4.3-0"
121 +PREFIX_PATCHREV="r0"
122 +
123 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
124 +HOMEPAGE="http://www.python.org/"
125 +SRC_URI="http://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
126 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
127 + https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz"
128 +
129 +LICENSE="PSF-2"
130 +SLOT="3.4/3.4m"
131 +KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
132 +IUSE="aqua build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml"
133 +
134 +# Do not add a dependency on dev-lang/python to this ebuild.
135 +# If you need to apply a patch which requires python for bootstrapping, please
136 +# run the bootstrap code on your dev box and include the results in the
137 +# patchset. See bug 447752.
138 +
139 +RDEPEND="app-arch/bzip2:0=
140 + app-arch/xz-utils:0=
141 + >=sys-libs/zlib-1.1.3:0=
142 + virtual/libffi
143 + virtual/libintl
144 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
145 + ncurses? (
146 + >=sys-libs/ncurses-5.2:0=
147 + readline? ( >=sys-libs/readline-4.1:0= )
148 + )
149 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
150 + ssl? (
151 + !libressl? ( dev-libs/openssl:0= )
152 + libressl? ( dev-libs/libressl:= )
153 + )
154 + tk? (
155 + >=dev-lang/tcl-8.0:0=
156 + >=dev-lang/tk-8.0:0=[-aqua]
157 + dev-tcltk/blt:0=
158 + dev-tcltk/tix
159 + )
160 + xml? ( >=dev-libs/expat-2.1:0= )
161 + !!<sys-apps/sandbox-2.6-r1"
162 +DEPEND="${RDEPEND}
163 + virtual/pkgconfig
164 + >=sys-devel/autoconf-2.65
165 + !sys-devel/gcc[libffi]"
166 +RDEPEND+=" !build? ( app-misc/mime-types )"
167 +PDEPEND=">=app-eselect/eselect-python-20151117-r1
168 + app-admin/python-updater"
169 +
170 +S="${WORKDIR}/${MY_P}"
171 +
172 +PYVER=${SLOT%/*}
173 +
174 +src_prepare() {
175 + # Ensure that internal copies of expat, libffi and zlib are not used.
176 + rm -fr Modules/expat
177 + rm -fr Modules/_ctypes/libffi*
178 + rm -fr Modules/zlib
179 +
180 + if tc-is-cross-compiler; then
181 + # Invokes BUILDPYTHON, which is built for the host arch
182 + local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
183 + fi
184 +
185 + EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
186 + epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch"
187 + epatch "${FILESDIR}/${PN}-3.4-gcc-5.patch" #547626
188 +
189 + # Prefix' round of patches
190 + # http://prefix.gentooexperimental.org:8000/python-patches-3_3
191 + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
192 + epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
193 +
194 + # we provide a fully working readline also on Darwin, so don't force
195 + # usage of less functional libedit
196 + sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
197 +
198 + # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
199 + sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
200 +
201 + # Make sure python doesn't use the host libffi.
202 + use prefix && epatch "${FILESDIR}/python-3.2-libffi-pkgconfig.patch"
203 +
204 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
205 + Lib/distutils/command/install.py \
206 + Lib/distutils/sysconfig.py \
207 + Lib/site.py \
208 + Lib/sysconfig.py \
209 + Lib/test/test_site.py \
210 + Makefile.pre.in \
211 + Modules/Setup.dist \
212 + Modules/getpath.c \
213 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
214 +
215 + # workaround a development build env problem and muck around
216 + # framework install to get the best of both worlds (non-standard)
217 + sed -i \
218 + -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
219 + -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
220 + configure.ac configure || die
221 + sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
222 +
223 + # Disable ABI flags.
224 + sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed"
225 +
226 + epatch_user
227 +
228 + eautoreconf
229 +}
230 +
231 +src_configure() {
232 + local disable
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 + export PYTHON_DISABLE_MODULES="${disable}"
241 +
242 + if ! use xml; then
243 + ewarn "You have configured Python without XML support."
244 + ewarn "This is NOT a recommended configuration as you"
245 + ewarn "may face problems parsing any XML documents."
246 + fi
247 +
248 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
249 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
250 + fi
251 +
252 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
253 + append-flags -fwrapv
254 + fi
255 +
256 + filter-flags -malign-double
257 +
258 + [[ "${ARCH}" == "alpha" ]] && append-flags -fPIC
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 + # Export CC so even AIX will use gcc instead of xlc_r.
267 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
268 + tc-export CC CXX
269 +
270 + # The configure script fails to use pkg-config correctly.
271 + # http://bugs.python.org/issue15506
272 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
273 +
274 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
275 + # Needed on FreeBSD unless Python 3.2 is already installed.
276 + # Please query BSD team before removing this!
277 + append-ldflags "-L."
278 +
279 + # make sure setup.py considers Prefix' paths before system ones
280 + use prefix && append-cppflags -I"${EPREFIX}"/usr/include
281 + use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib
282 +
283 + local dbmliborder
284 + if use gdbm; then
285 + dbmliborder+="${dbmliborder:+:}gdbm"
286 + fi
287 +
288 + BUILD_DIR="${WORKDIR}/${CHOST}"
289 + mkdir -p "${BUILD_DIR}" || die
290 + cd "${BUILD_DIR}" || die
291 +
292 + if use aqua ; then
293 + ECONF_SOURCE="${S}" OPT="" \
294 + econf \
295 + --enable-framework="${EPREFIX}"/usr/lib \
296 + --config-cache
297 + fi
298 +
299 + # pymalloc #452720
300 + ECONF_SOURCE="${S}" OPT="" \
301 + econf \
302 + $(use aqua && echo --config-cache) \
303 + --with-fpectl \
304 + --enable-shared \
305 + $(use_enable ipv6) \
306 + $(use_with threads) \
307 + --infodir='${prefix}/share/info' \
308 + --mandir='${prefix}/share/man' \
309 + --with-computed-gotos \
310 + --with-dbmliborder="${dbmliborder}" \
311 + --with-libc="" \
312 + --enable-loadable-sqlite-extensions \
313 + --with-system-expat \
314 + --with-system-ffi \
315 + --without-ensurepip \
316 + --without-pymalloc
317 +
318 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
319 + eerror "configure has detected that the sem_open function is broken."
320 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
321 + die "Broken sem_open function (bug 496328)"
322 + fi
323 +}
324 +
325 +src_compile() {
326 + # Avoid invoking pgen for cross-compiles.
327 + touch Include/graminit.h Python/graminit.c || die
328 +
329 + cd "${BUILD_DIR}" || die
330 +
331 + emake CPPFLAGS= CFLAGS= LDFLAGS=
332 +
333 + # Work around bug 329499. See also bug 413751 and 457194.
334 + if has_version dev-libs/libffi[pax_kernel]; then
335 + pax-mark E python
336 + else
337 + pax-mark m python
338 + fi
339 +}
340 +
341 +src_test() {
342 + # Tests will not work when cross compiling.
343 + if tc-is-cross-compiler; then
344 + elog "Disabling tests due to crosscompiling."
345 + return
346 + fi
347 +
348 + cd "${BUILD_DIR}" || die
349 +
350 + # Skip failing tests.
351 + local skipped_tests="gdb"
352 +
353 + for test in ${skipped_tests}; do
354 + mv "${S}"/Lib/test/test_${test}.py "${T}"
355 + done
356 +
357 + local -x PYTHONDONTWRITEBYTECODE=
358 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
359 + local result=$?
360 +
361 + for test in ${skipped_tests}; do
362 + mv "${T}/test_${test}.py" "${S}"/Lib/test
363 + done
364 +
365 + elog "The following tests have been skipped:"
366 + for test in ${skipped_tests}; do
367 + elog "test_${test}.py"
368 + done
369 +
370 + elog "If you would like to run them, you may:"
371 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
372 + elog "and run the tests separately."
373 +
374 + if [[ ${result} -ne 0 ]]; then
375 + die "emake test failed"
376 + fi
377 +}
378 +
379 +src_install() {
380 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
381 +
382 + cd "${BUILD_DIR}" || die
383 +
384 + emake DESTDIR="${D}" altinstall
385 +
386 + if use aqua ; then
387 + # avoid config.status to be triggered
388 + find Mac -name "Makefile" -exec touch \{\} + || die
389 +
390 + emake DESTDIR="${D}" -C Mac \
391 + install_Python install_PythonLauncher install_IDLE \
392 + || die
393 +
394 + local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${SLOT}
395 + ln -s "${EPREFIX}"/usr/include/python${SLOT} \
396 + "${ED}${fwdir}"/Headers || die
397 + ln -s "${EPREFIX}"/usr/lib/libpython${SLOT}.dylib \
398 + "${ED}${fwdir}"/Python || die
399 + fi
400 +
401 + sed \
402 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
403 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
404 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
405 +
406 + # Fix collisions between different slots of Python.
407 + rm -f "${ED}usr/$(get_libdir)/libpython3.so"
408 +
409 + # Cheap hack to get version with ABIFLAGS
410 + local abiver=$(cd "${ED}usr/include"; echo python*)
411 + # Replace python3.X with a symlink if appropriate
412 + if [[ ${abiver} != python${PYVER} ]]; then
413 + rm "${ED}usr/bin/python${PYVER}" || die
414 + dosym "${abiver}" "/usr/bin/python${PYVER}"
415 + fi
416 +
417 + use elibc_uclibc && rm -fr "${libdir}/test"
418 + use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
419 + use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
420 +
421 + use threads || rm -fr "${libdir}/multiprocessing"
422 + use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
423 +
424 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
425 +
426 + if use examples; then
427 + insinto /usr/share/doc/${PF}/examples
428 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
429 + doins -r "${S}"/Tools
430 + fi
431 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
432 + if use aqua ; then
433 + # we do framework, so the emake trick below returns a pathname
434 + # since that won't work here, use a (cheap) trick instead
435 + local libname=libpython${SLOT}
436 + else
437 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
438 + emake --no-print-directory -s -f - 2>/dev/null)
439 + fi
440 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
441 +
442 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
443 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
444 + sed \
445 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
446 + -e "s:@PYDOC@:pydoc${PYVER}:" \
447 + -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
448 +
449 + # for python-exec
450 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
451 +
452 + # if not using a cross-compiler, use the fresh binary
453 + if ! tc-is-cross-compiler; then
454 + local -x PYTHON=./python
455 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
456 + else
457 + vars=( PYTHON "${vars[@]}" )
458 + fi
459 +
460 + python_export "python${PYVER}" "${vars[@]}"
461 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
462 + python_domodule epython.py
463 +
464 + # python-exec wrapping support
465 + local pymajor=${PYVER%.*}
466 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
467 + # python and pythonX
468 + ln -s "../../../bin/${abiver}" \
469 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
470 + ln -s "python${pymajor}" \
471 + "${D}${PYTHON_SCRIPTDIR}/python" || die
472 + # python-config and pythonX-config
473 + ln -s "../../../bin/${abiver}-config" \
474 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
475 + ln -s "python${pymajor}-config" \
476 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
477 + # 2to3, pydoc, pyvenv
478 + ln -s "../../../bin/2to3-${PYVER}" \
479 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
480 + ln -s "../../../bin/pydoc${PYVER}" \
481 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
482 + ln -s "../../../bin/pyvenv-${PYVER}" \
483 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
484 +
485 + # Compatibility link for stuff that calls ${PYTHON}-config
486 + # Remove this when all revdeps have been fixed to not do that.
487 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
488 +}
489 +
490 +pkg_preinst() {
491 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
492 + python_updater_warning="1"
493 + fi
494 +}
495 +
496 +eselect_python_update() {
497 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
498 + eselect python update
499 + fi
500 +
501 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
502 + eselect python update --python${PV%%.*}
503 + fi
504 +}
505 +
506 +pkg_postinst() {
507 + eselect_python_update
508 +
509 + if [[ "${python_updater_warning}" == "1" ]]; then
510 + ewarn "You have just upgraded from an older version of Python."
511 + ewarn
512 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
513 + fi
514 +}
515 +
516 +pkg_postrm() {
517 + eselect_python_update
518 +}