1 |
commit: 7b01068518698b9292df9171df071f3bfbfa6500 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 3 11:47:49 2018 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 3 11:47:49 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7b010685 |
7 |
|
8 |
dev-lang/python: bump/sync 3.5 |
9 |
|
10 |
Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6 |
11 |
|
12 |
dev-lang/python/Manifest | 1 + |
13 |
.../python-3.5.5-libressl-compatibility.patch | 69 ++++ |
14 |
dev-lang/python/python-3.5.5-r1.ebuild | 442 +++++++++++++++++++++ |
15 |
3 files changed, 512 insertions(+) |
16 |
|
17 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
18 |
index b4faac8990..00c4315df3 100644 |
19 |
--- a/dev-lang/python/Manifest |
20 |
+++ b/dev-lang/python/Manifest |
21 |
@@ -4,6 +4,7 @@ DIST Python-2.7.14.tar.xz 12576112 BLAKE2B e03c4134cfdd88678acc26f383130a598ce4d |
22 |
DIST Python-3.4.5.tar.xz 14516820 BLAKE2B f9ddabd2df2241089d07756d3a8ba1c70096bee60d7cdef84041edbb20c488c3a573762441a4b7f543dbc0ce403ce84ff7d02e7d25699917bd014ab96deead85 SHA512 b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c |
23 |
DIST Python-3.4.8.tar.xz 14576444 BLAKE2B 262b82fbc0e4852216d2edf05f9e9194bc93be7b14a2d6ef56789b808cff274e58b2fa7134955464fd05ab36181b5861aeca31e2e05b27f0f58ac66d145bd56b SHA512 478552c72efe606cb1993024b81839c51d01f1c949564c007ab2b76016f110e1f7bd418e5de3f4f93b466ce7dbe6583d3c150830d1f28f75e0809625b568a7ec |
24 |
DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61 SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff |
25 |
+DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22 |
26 |
DIST Python-3.6.3.tar.xz 16974296 BLAKE2B 8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623 SHA512 32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b |
27 |
DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1 |
28 |
DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8 |
29 |
|
30 |
diff --git a/dev-lang/python/files/python-3.5.5-libressl-compatibility.patch b/dev-lang/python/files/python-3.5.5-libressl-compatibility.patch |
31 |
new file mode 100644 |
32 |
index 0000000000..67d57d0c13 |
33 |
--- /dev/null |
34 |
+++ b/dev-lang/python/files/python-3.5.5-libressl-compatibility.patch |
35 |
@@ -0,0 +1,69 @@ |
36 |
+# From 8d89a385b71a2e4cce0fba0cfc8d91b63485edc5 Mon Sep 17 00:00:00 2001 |
37 |
+# From: Christian Heimes <christian@××××××.org> |
38 |
+# Date: Sat, 24 Mar 2018 18:38:14 +0100 |
39 |
+# Subject: [PATCH] [3.6] bpo-33127: Compatibility patch for LibreSSL 2.7.0 |
40 |
+# (GH-6210) (GH-6214) |
41 |
+# |
42 |
+# LibreSSL 2.7 introduced OpenSSL 1.1.0 API. The ssl module now detects |
43 |
+# LibreSSL 2.7 and only provides API shims for OpenSSL < 1.1.0 and |
44 |
+# LibreSSL < 2.7. |
45 |
+ |
46 |
+# Documentation updates and fixes for failing tests will be provided in |
47 |
+# another patch set. |
48 |
+ |
49 |
+# Signed-off-by: Christian Heimes <christian@××××××.org>. |
50 |
+# (cherry picked from commit 4ca0739c9d97ac7cd45499e0d31be68dc659d0e1) |
51 |
+ |
52 |
+# Co-authored-by: Christian Heimes <christian@××××××.org> |
53 |
+# Patch modified by Aaron Bauman <bman@g.o> for 3.5.5 |
54 |
+ |
55 |
+--- a/Modules/_ssl.c 2018-04-13 18:33:17.397649561 -0400 |
56 |
++++ b/Modules/_ssl.c 2018-04-13 18:40:22.319852014 -0400 |
57 |
+@@ -101,6 +101,12 @@ |
58 |
+ |
59 |
+ #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER) |
60 |
+ # define OPENSSL_VERSION_1_1 1 |
61 |
++# define PY_OPENSSL_1_1_API 1 |
62 |
++#endif |
63 |
++ |
64 |
++/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */ |
65 |
++#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL |
66 |
++# define PY_OPENSSL_1_1_API 1 |
67 |
+ #endif |
68 |
+ |
69 |
+ /* Openssl comes with TLSv1.1 and TLSv1.2 between 1.0.0h and 1.0.1 |
70 |
+@@ -129,16 +135,18 @@ |
71 |
+ #define INVALID_SOCKET (-1) |
72 |
+ #endif |
73 |
+ |
74 |
+-#ifdef OPENSSL_VERSION_1_1 |
75 |
+-/* OpenSSL 1.1.0+ */ |
76 |
+-#ifndef OPENSSL_NO_SSL2 |
77 |
+-#define OPENSSL_NO_SSL2 |
78 |
+-#endif |
79 |
+-#else /* OpenSSL < 1.1.0 */ |
80 |
+-#if defined(WITH_THREAD) |
81 |
++/* OpenSSL 1.0.2 and LibreSSL needs extra code for locking */ |
82 |
++#if !defined(OPENSSL_VERSION_1_1) && defined(WITH_THREAD) |
83 |
+ #define HAVE_OPENSSL_CRYPTO_LOCK |
84 |
+ #endif |
85 |
+ |
86 |
++#if defined(OPENSSL_VERSION_1_1) && !defined(OPENSSL_NO_SSL2) |
87 |
++#define OPENSSL_NO_SSL2 |
88 |
++#endif |
89 |
++ |
90 |
++#ifndef PY_OPENSSL_1_1_API |
91 |
++/* OpenSSL 1.1 API shims for OpenSSL < 1.1.0 and LibreSSL < 2.7.0 */ |
92 |
++ |
93 |
+ #define TLS_method SSLv23_method |
94 |
+ |
95 |
+ static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne) |
96 |
+@@ -187,7 +195,7 @@ |
97 |
+ { |
98 |
+ return store->param; |
99 |
+ } |
100 |
+-#endif /* OpenSSL < 1.1.0 or LibreSSL */ |
101 |
++#endif /* OpenSSL < 1.1.0 or LibreSSL < 2.7.0 */ |
102 |
+ |
103 |
+ |
104 |
+ enum py_ssl_error { |
105 |
|
106 |
diff --git a/dev-lang/python/python-3.5.5-r1.ebuild b/dev-lang/python/python-3.5.5-r1.ebuild |
107 |
new file mode 100644 |
108 |
index 0000000000..c9e5669455 |
109 |
--- /dev/null |
110 |
+++ b/dev-lang/python/python-3.5.5-r1.ebuild |
111 |
@@ -0,0 +1,442 @@ |
112 |
+# Copyright 1999-2018 Gentoo Foundation |
113 |
+# Distributed under the terms of the GNU General Public License v2 |
114 |
+ |
115 |
+EAPI="5" |
116 |
+WANT_LIBTOOL="none" |
117 |
+ |
118 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs |
119 |
+ |
120 |
+MY_P="Python-${PV/_/}" |
121 |
+PATCHSET_VERSION="3.5.4-0" |
122 |
+PREFIX_PATCHREV="3.5.4-gentoo-patches-r0" |
123 |
+ |
124 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
125 |
+HOMEPAGE="https://www.python.org/" |
126 |
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
127 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz |
128 |
+ https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PREFIX_PATCHREV}.tar.xz" |
129 |
+ |
130 |
+LICENSE="PSF-2" |
131 |
+SLOT="3.5/3.5m" |
132 |
+KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
133 |
+IUSE="aqua bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test +threads tk wininst +xml" |
134 |
+RESTRICT="!test? ( test )" |
135 |
+ |
136 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
137 |
+# If you need to apply a patch which requires python for bootstrapping, please |
138 |
+# run the bootstrap code on your dev box and include the results in the |
139 |
+# patchset. See bug 447752. |
140 |
+ |
141 |
+RDEPEND="app-arch/bzip2:0= |
142 |
+ app-arch/xz-utils:0= |
143 |
+ >=sys-libs/zlib-1.1.3:0= |
144 |
+ virtual/libffi |
145 |
+ virtual/libintl |
146 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
147 |
+ ncurses? ( >=sys-libs/ncurses-5.2:0= ) |
148 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
149 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
150 |
+ ssl? ( |
151 |
+ !libressl? ( dev-libs/openssl:0= ) |
152 |
+ libressl? ( dev-libs/libressl:0= ) |
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 |
+# bluetooth requires headers from bluez |
163 |
+DEPEND="${RDEPEND} |
164 |
+ bluetooth? ( net-wireless/bluez ) |
165 |
+ virtual/pkgconfig |
166 |
+ !sys-devel/gcc[libffi(-)]" |
167 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
168 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
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.5-distutils-OO-build.patch" |
188 |
+ epatch "${FILESDIR}/3.6-disable-nis.patch" |
189 |
+ epatch "${FILESDIR}/python-3.5.5-libressl-compatibility.patch" |
190 |
+ epatch "${FILESDIR}/python-3.5.5-hash-unaligned.patch" |
191 |
+ |
192 |
+ epatch_user |
193 |
+ |
194 |
+ # Prefix' round of patches |
195 |
+ # http://prefix.gentooexperimental.org:8000/python-patches-3_3 |
196 |
+ EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \ |
197 |
+ epatch "${WORKDIR}"/python-prefix-${PREFIX_PATCHREV} |
198 |
+ |
199 |
+ # https://forums.developer.apple.com/thread/9233, bug #572726 |
200 |
+ sed -i -e '/$(RUNSHARED) .\/regen/s/^/export RUNSHARED=$(RUNSHARED); /' \ |
201 |
+ Makefile.pre.in || die |
202 |
+ sed -i -e '/python$EXE/s/^/env ${RUNSHARED} /' \ |
203 |
+ Lib/plat-darwin/regen || die |
204 |
+ |
205 |
+ # we provide a fully working readline also on Darwin, so don't force |
206 |
+ # usage of less functional libedit |
207 |
+ sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die |
208 |
+ |
209 |
+ # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR. |
210 |
+ sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die |
211 |
+ |
212 |
+ # Make sure python doesn't use the host libffi. |
213 |
+ use prefix && epatch "${FILESDIR}/python-3.5.4-libffi-pkgconfig.patch" |
214 |
+ |
215 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
216 |
+ configure.ac \ |
217 |
+ Lib/distutils/command/install.py \ |
218 |
+ Lib/distutils/sysconfig.py \ |
219 |
+ Lib/site.py \ |
220 |
+ Lib/sysconfig.py \ |
221 |
+ Lib/test/test_site.py \ |
222 |
+ Makefile.pre.in \ |
223 |
+ Modules/getpath.c \ |
224 |
+ Modules/Setup.dist \ |
225 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
226 |
+ |
227 |
+ # workaround a development build env problem and muck around |
228 |
+ # framework install to get the best of both worlds (non-standard) |
229 |
+ sed -i \ |
230 |
+ -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \ |
231 |
+ -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \ |
232 |
+ configure.ac configure || die |
233 |
+ sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die |
234 |
+ |
235 |
+ # Disable ABI flags. |
236 |
+ sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed" |
237 |
+ |
238 |
+ eautoreconf |
239 |
+} |
240 |
+ |
241 |
+src_configure() { |
242 |
+ local disable |
243 |
+ # disable automagic bluetooth headers detection |
244 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
245 |
+ use gdbm || disable+=" gdbm" |
246 |
+ use ncurses || disable+=" _curses _curses_panel" |
247 |
+ use readline || disable+=" readline" |
248 |
+ use sqlite || disable+=" _sqlite3" |
249 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
250 |
+ use tk || disable+=" _tkinter" |
251 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
252 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
253 |
+ |
254 |
+ if ! use xml; then |
255 |
+ ewarn "You have configured Python without XML support." |
256 |
+ ewarn "This is NOT a recommended configuration as you" |
257 |
+ ewarn "may face problems parsing any XML documents." |
258 |
+ fi |
259 |
+ |
260 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
261 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
262 |
+ fi |
263 |
+ |
264 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
265 |
+ append-flags -fwrapv |
266 |
+ fi |
267 |
+ |
268 |
+ filter-flags -malign-double |
269 |
+ |
270 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
271 |
+ if is-flagq -O3; then |
272 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
273 |
+ use hardened && replace-flags -O3 -O2 |
274 |
+ fi |
275 |
+ |
276 |
+ # Export CC so even AIX will use gcc instead of xlc_r. |
277 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
278 |
+ tc-export CC CXX |
279 |
+ |
280 |
+ # The configure script fails to use pkg-config correctly. |
281 |
+ # http://bugs.python.org/issue15506 |
282 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
283 |
+ |
284 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
285 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
286 |
+ # Please query BSD team before removing this! |
287 |
+ append-ldflags "-L." |
288 |
+ |
289 |
+ # make sure setup.py considers Prefix' paths before system ones |
290 |
+ use prefix && append-cppflags -I"${EPREFIX}"/usr/include |
291 |
+ use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib |
292 |
+ |
293 |
+ local dbmliborder |
294 |
+ if use gdbm; then |
295 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
296 |
+ fi |
297 |
+ |
298 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
299 |
+ mkdir -p "${BUILD_DIR}" || die |
300 |
+ cd "${BUILD_DIR}" || die |
301 |
+ |
302 |
+ if use aqua ; then |
303 |
+ ECONF_SOURCE="${S}" OPT="" \ |
304 |
+ econf \ |
305 |
+ --enable-framework="${EPREFIX}"/usr/lib \ |
306 |
+ --config-cache |
307 |
+ fi |
308 |
+ |
309 |
+ # pymalloc #452720 |
310 |
+ local myeconfargs=( |
311 |
+ $(use aqua && echo --config-cache) \ |
312 |
+ --with-fpectl |
313 |
+ --enable-shared |
314 |
+ $(use_enable ipv6) |
315 |
+ $(use_with threads) |
316 |
+ --infodir='${prefix}/share/info' |
317 |
+ --mandir='${prefix}/share/man' |
318 |
+ --with-computed-gotos |
319 |
+ --with-dbmliborder="${dbmliborder}" |
320 |
+ --with-libc= |
321 |
+ --enable-loadable-sqlite-extensions |
322 |
+ --without-ensurepip |
323 |
+ --with-system-expat |
324 |
+ --with-system-ffi |
325 |
+ --without-pymalloc |
326 |
+ ) |
327 |
+ |
328 |
+ ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}" |
329 |
+ |
330 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
331 |
+ eerror "configure has detected that the sem_open function is broken." |
332 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
333 |
+ die "Broken sem_open function (bug 496328)" |
334 |
+ fi |
335 |
+} |
336 |
+ |
337 |
+src_compile() { |
338 |
+ # Ensure sed works as expected |
339 |
+ # https://bugs.gentoo.org/594768 |
340 |
+ local -x LC_ALL=C |
341 |
+ |
342 |
+ cd "${BUILD_DIR}" || die |
343 |
+ |
344 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
345 |
+ |
346 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
347 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
348 |
+ pax-mark E python |
349 |
+ else |
350 |
+ pax-mark m python |
351 |
+ fi |
352 |
+} |
353 |
+ |
354 |
+src_test() { |
355 |
+ # Tests will not work when cross compiling. |
356 |
+ if tc-is-cross-compiler; then |
357 |
+ elog "Disabling tests due to crosscompiling." |
358 |
+ return |
359 |
+ fi |
360 |
+ |
361 |
+ cd "${BUILD_DIR}" || die |
362 |
+ |
363 |
+ # Skip failing tests. |
364 |
+ local skipped_tests="gdb" |
365 |
+ |
366 |
+ for test in ${skipped_tests}; do |
367 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
368 |
+ done |
369 |
+ |
370 |
+ local -x PYTHONDONTWRITEBYTECODE= |
371 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
372 |
+ local result=$? |
373 |
+ |
374 |
+ for test in ${skipped_tests}; do |
375 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
376 |
+ done |
377 |
+ |
378 |
+ elog "The following tests have been skipped:" |
379 |
+ for test in ${skipped_tests}; do |
380 |
+ elog "test_${test}.py" |
381 |
+ done |
382 |
+ |
383 |
+ elog "If you would like to run them, you may:" |
384 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
385 |
+ elog "and run the tests separately." |
386 |
+ |
387 |
+ if [[ ${result} -ne 0 ]]; then |
388 |
+ die "emake test failed" |
389 |
+ fi |
390 |
+} |
391 |
+ |
392 |
+src_install() { |
393 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
394 |
+ |
395 |
+ cd "${BUILD_DIR}" || die |
396 |
+ |
397 |
+ emake DESTDIR="${D}" altinstall |
398 |
+ |
399 |
+ if use aqua ; then |
400 |
+ # avoid config.status to be triggered |
401 |
+ find Mac -name "Makefile" -exec touch \{\} + || die |
402 |
+ |
403 |
+ # Python_Launcher is kind of a wrapper, and we should fix it for |
404 |
+ # Prefix (it uses /usr/bin/pythonw) so useless |
405 |
+ # IDLE doesn't run, no idea, but definitely not used |
406 |
+ emake DESTDIR="${D}" -C Mac install_Python || die |
407 |
+ rmdir "${ED}"/Applications/Python* || die |
408 |
+ rmdir "${ED}"/Applications || die |
409 |
+ |
410 |
+ local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER} |
411 |
+ ln -s "${EPREFIX}"/usr/include/python${PYVER} \ |
412 |
+ "${ED}${fwdir}"/Headers || die |
413 |
+ ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ |
414 |
+ "${ED}${fwdir}"/Python || die |
415 |
+ fi |
416 |
+ |
417 |
+ sed \ |
418 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
419 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
420 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
421 |
+ |
422 |
+ # Fix collisions between different slots of Python. |
423 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
424 |
+ |
425 |
+ # Cheap hack to get version with ABIFLAGS |
426 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
427 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
428 |
+ # Replace python3.X with a symlink to python3.Xm |
429 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
430 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
431 |
+ # Create python3.X-config symlink |
432 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
433 |
+ # Create python-3.5m.pc symlink |
434 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
435 |
+ fi |
436 |
+ |
437 |
+ # python seems to get rebuilt in src_install (bug 569908) |
438 |
+ # Work around it for now. |
439 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
440 |
+ pax-mark E "${ED}usr/bin/${abiver}" |
441 |
+ else |
442 |
+ pax-mark m "${ED}usr/bin/${abiver}" |
443 |
+ fi |
444 |
+ |
445 |
+ use elibc_uclibc && rm -fr "${libdir}/test" |
446 |
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
447 |
+ use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
448 |
+ |
449 |
+ use threads || rm -fr "${libdir}/multiprocessing" |
450 |
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
451 |
+ |
452 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
453 |
+ |
454 |
+ if use examples; then |
455 |
+ insinto /usr/share/doc/${PF}/examples |
456 |
+ find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
457 |
+ doins -r "${S}"/Tools |
458 |
+ fi |
459 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
460 |
+ if use aqua ; then |
461 |
+ # we do framework, so the emake trick below returns a pathname |
462 |
+ # since that won't work here, use a (cheap) trick instead |
463 |
+ local libname=libpython${PYVER} |
464 |
+ else |
465 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
466 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
467 |
+ fi |
468 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
469 |
+ |
470 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
471 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
472 |
+ sed \ |
473 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
474 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
475 |
+ -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
476 |
+ |
477 |
+ # for python-exec |
478 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
479 |
+ |
480 |
+ # if not using a cross-compiler, use the fresh binary |
481 |
+ if ! tc-is-cross-compiler; then |
482 |
+ local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) |
483 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
484 |
+ local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} |
485 |
+ else |
486 |
+ vars=( PYTHON "${vars[@]}" ) |
487 |
+ fi |
488 |
+ |
489 |
+ python_export "python${PYVER}" "${vars[@]}" |
490 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
491 |
+ python_domodule epython.py |
492 |
+ |
493 |
+ # python-exec wrapping support |
494 |
+ local pymajor=${PYVER%.*} |
495 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
496 |
+ # python and pythonX |
497 |
+ ln -s "../../../bin/${abiver}" \ |
498 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
499 |
+ ln -s "python${pymajor}" \ |
500 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
501 |
+ # python-config and pythonX-config |
502 |
+ # note: we need to create a wrapper rather than symlinking it due |
503 |
+ # to some random dirname(argv[0]) magic performed by python-config |
504 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
505 |
+ #!/bin/sh |
506 |
+ exec "${abiver}-config" "\${@}" |
507 |
+ EOF |
508 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
509 |
+ ln -s "python${pymajor}-config" \ |
510 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
511 |
+ # 2to3, pydoc, pyvenv |
512 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
513 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
514 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
515 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
516 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
517 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
518 |
+ # idle |
519 |
+ if use tk; then |
520 |
+ ln -s "../../../bin/idle${PYVER}" \ |
521 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
522 |
+ fi |
523 |
+} |
524 |
+ |
525 |
+pkg_preinst() { |
526 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
527 |
+ python_updater_warning="1" |
528 |
+ fi |
529 |
+} |
530 |
+ |
531 |
+eselect_python_update() { |
532 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
533 |
+ eselect python update |
534 |
+ fi |
535 |
+ |
536 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
537 |
+ eselect python update --python${PV%%.*} |
538 |
+ fi |
539 |
+} |
540 |
+ |
541 |
+pkg_postinst() { |
542 |
+ eselect_python_update |
543 |
+ |
544 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
545 |
+ ewarn "You have just upgraded from an older version of Python." |
546 |
+ ewarn |
547 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
548 |
+ fi |
549 |
+} |
550 |
+ |
551 |
+pkg_postrm() { |
552 |
+ eselect_python_update |
553 |
+} |