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/files/, dev-lang/python/
Date: Thu, 03 May 2018 10:39:30
Message-Id: 1525339256.86500c00c3e1ad35d5cf8b619310d7243deb80d5.grobian@gentoo
1 commit: 86500c00c3e1ad35d5cf8b619310d7243deb80d5
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 3 09:20:56 2018 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Thu May 3 09:20:56 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=86500c00
7
8 dev-lang/python: sync python 2.7
9
10 Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6
11
12 dev-lang/python/Manifest | 3 -
13 dev-lang/python/files/2.7-disable-nis.patch | 21 +
14 .../files/python-2.7-libressl-compatibility.patch | 92 +++
15 ...ython-2.7.12.ebuild => python-2.7.14-r2.ebuild} | 82 +--
16 dev-lang/python/python-2.7.14.ebuild | 637 ---------------------
17 5 files changed, 160 insertions(+), 675 deletions(-)
18
19 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
20 index 67805c47ab..274b181cfb 100644
21 --- a/dev-lang/python/Manifest
22 +++ b/dev-lang/python/Manifest
23 @@ -1,16 +1,13 @@
24 DIST 7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 BLAKE2B 85803bc1677bd16650cb5fc4a2c54fdac0228326f25cfba4fcd098ac9d689312d3e0dde6fca57f720d5235361d6462461cf018325c23fda9139e0f1683055aff SHA512 cabc21d2d7379daf1f4bafe7ab00b70e5b4f707d3102496b96ff0dfdced26347097ad771c69e0b9488b7c54b1ef36f9bc019bee72f1ffcbb55dcd0e71095edfe
25 DIST 8ee84829be03c2a1aa74f0f095c994c1f43f4688.zip 14239 BLAKE2B 3dd91f83e5886cb9ba5c1fd9f3da38ab521db70645fa187752cd784919d523d9bf59b61223ea1a455b6d9002ba88dac5bd834c8e943b121db84e30bbb0f65204 SHA512 2f3ada7ff2bd97f90e3b972b681624ddf45c6d1db8d5e89f1313b4693db240a3c4e27c84bd2cf8ff71d5fb276b381ca6a3b8a6945f8db53ff3496cc4cc0b1d62
26 -DIST Python-2.7.12.tar.xz 12390820 BLAKE2B 97446bca10005277cf1a92ce7fc9e847d5df93f656a6a3b66e9f064d1c2ba35d5a8b420aaa64b92247d6a3fcd3852876450faebc466c7a8e841fd0c2e62fd306 SHA512 6ddbbce47cc49597433d98ca05c2f62f07ed1070807b645602a8e9e9b996adc6fa66fa20a33cd7d23d4e7e925e25071d7301d288149fbe4e8c5f06d5438dda1f
27 DIST Python-2.7.14.tar.xz 12576112 BLAKE2B e03c4134cfdd88678acc26f383130a598ce4de908ab6bb9ee00e9235de3e0fcb9e653fec86f39db64fb895ef797d33736524655c5b94fab2cde2544b966b2cfb SHA512 78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9
28 DIST Python-3.4.5.tar.xz 14516820 BLAKE2B f9ddabd2df2241089d07756d3a8ba1c70096bee60d7cdef84041edbb20c488c3a573762441a4b7f543dbc0ce403ce84ff7d02e7d25699917bd014ab96deead85 SHA512 b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c
29 DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61 SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
30 DIST Python-3.6.3.tar.xz 16974296 BLAKE2B 8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623 SHA512 32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b
31 -DIST python-gentoo-patches-2.7.12-0.tar.xz 13576 BLAKE2B 6ae9fc3e8d3e7dca2e8f5fa6ec9709be9e41982bcd8ca71764766c1a21e596c42d389afd65379c65c469dbbe53918cfa5a23ec7ca7e825f35bc462ff3110f949 SHA512 8bf530fca15c47fa5d9bc958e433b35943a12c98e4172806a45aa60dc85ec92f8ab6ffcd90f752dc5bf8ffc711414894c15820c4b6ef72dbcedc2808119fb1f6
32 DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
33 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
34 DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 BLAKE2B 4a7d71feff18c7c8c109bed10748348484d314183c3de3ec950d5ca5ce7048bb322c470f3f5bff2d63eb7f2ed99c0fe75c621df050273d9d118681b28926061d SHA512 d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec
35 DIST python-gentoo-patches-3.6.2-0.tar.xz 10744 BLAKE2B 3075754627617ac2ceee879eaf1a0e6564505655cdbdff380233a09df701a6188d64fe1f6a8c642b1fb05ef3c460a07042b6a362d655cd02717d6d9ba47983a1 SHA512 2aac1700c541202aa4f43bff4cb521b996d52ab350133318abaddb43f4b6e20548f37de472ace8024ef325ebf63fdfff0d43f8aa1f717d3c56f974b7aa1764e3
36 -DIST python-prefix-2.7.12-gentoo-patches-r0.tar.xz 17380 BLAKE2B 566c47624d054cd251ea4350bf57735ad63057a6ef7968dbe572a02156a03c080303ba2aa6c26e10077070507317b22eb7665595aaf903b4ffd4a45104fbfa31 SHA512 ef17c8e8083da0ed0e6a63c96f59cc1243b0376fc6d4d7fcecb165e557403c54ae87625ed6dfe4d7d73693f8220ec98ef8a3f16124d8022dbac6a3a9d5514d9c
37 DIST python-prefix-2.7.14-gentoo-patches-r0.tar.xz 14736 BLAKE2B 75422fc7390f559d9864f6e22a0b85982ccbdb07d5f2507db8e528285e56d1f11d4bc0b21a0b78d5340eafd562220d2f1b9d0a78b1f7c811c5689a426a81f9f3 SHA512 bf8e5039fff834d03a5a671269905f1ea10961995f2327ea023f6ad4d9b49bf210ec746ac6f45a01ff7501f1eb616013951d164410f6c64bce04df0e8b9715c8
38 DIST python-prefix-3.4.5-gentoo-patches-r0.tar.xz 12932 BLAKE2B 228cea390cd16f68579896ccec06025446d6378ee164090a7f8ab8174d28e73e35b0e311b95ab78be7a54b21eefce7c01238e3cb31fae1f49a1706476c5abda5 SHA512 e32556c63e48d8dacd86218945147d1bbbc5777a6bb3441373827da47771a8eb387f26885acd35343cc598c719c9feec63007144fc1fdd1aca253a2ec1a19825
39 DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 BLAKE2B ab0cbc5430e9588f71cfd7b001a07f9a77097262f17e1f980e3945e39855e1c9437117bf4eb2d424dadf701d37d025e09627d7efdbb9f8867714039f62f261a7 SHA512 334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5
40
41 diff --git a/dev-lang/python/files/2.7-disable-nis.patch b/dev-lang/python/files/2.7-disable-nis.patch
42 new file mode 100644
43 index 0000000000..5a6cb3e403
44 --- /dev/null
45 +++ b/dev-lang/python/files/2.7-disable-nis.patch
46 @@ -0,0 +1,21 @@
47 +--- a/setup.py
48 ++++ b/setup.py
49 +@@ -1346,17 +1346,7 @@ class PyBuildExt(build_ext):
50 + else:
51 + missing.append('resource')
52 +
53 +- # Sun yellow pages. Some systems have the functions in libc.
54 +- if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and
55 +- find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
56 +- if (self.compiler.find_library_file(lib_dirs, 'nsl')):
57 +- libs = ['nsl']
58 +- else:
59 +- libs = []
60 +- exts.append( Extension('nis', ['nismodule.c'],
61 +- libraries = libs) )
62 +- else:
63 +- missing.append('nis')
64 ++ missing.append('nis')
65 + else:
66 + missing.extend(['nis', 'resource', 'termios'])
67 +
68
69 diff --git a/dev-lang/python/files/python-2.7-libressl-compatibility.patch b/dev-lang/python/files/python-2.7-libressl-compatibility.patch
70 new file mode 100644
71 index 0000000000..c9e7a8458e
72 --- /dev/null
73 +++ b/dev-lang/python/files/python-2.7-libressl-compatibility.patch
74 @@ -0,0 +1,92 @@
75 +# From https://github.com/python/cpython/pull/6215
76 +
77 +# LibreSSL 2.7 introduced OpenSSL 1.1.0 API. The ssl module now detects
78 +# LibreSSL 2.7 and only provides API shims for OpenSSL < 1.1.0 and
79 +# LibreSSL < 2.7.
80 +
81 +# Documentation updates and fixes for failing tests will be provided in
82 +# another patch set.
83 +
84 +# Signed-off-by: Christian Heimes christian@××××××.org.
85 +# (cherry picked from commit 4ca0739)
86 +
87 +#Co-authored-by: Christian Heimes christian@××××××.org
88 +
89 +--- a/Modules/_ssl.c 2017-09-16 17:38:35.000000000 +0000
90 ++++ b/Modules/_ssl.c 2018-04-13 15:55:10.919424126 +0000
91 +@@ -97,6 +102,12 @@
92 +
93 + #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined(LIBRESSL_VERSION_NUMBER)
94 + # define OPENSSL_VERSION_1_1 1
95 ++# define PY_OPENSSL_1_1_API 1
96 ++#endif
97 ++
98 ++/* LibreSSL 2.7.0 provides necessary OpenSSL 1.1.0 APIs */
99 ++#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070000fL
100 ++# define PY_OPENSSL_1_1_API 1
101 + #endif
102 +
103 + /* Openssl comes with TLSv1.1 and TLSv1.2 between 1.0.0h and 1.0.1
104 +@@ -118,24 +129,44 @@
105 + #endif
106 +
107 + /* ALPN added in OpenSSL 1.0.2 */
108 +-#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x1000200fL && !defined(OPENSSL_NO_TLSEXT)
109 +-# define HAVE_ALPN
110 ++#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
111 ++# define HAVE_ALPN 1
112 ++#else
113 ++# define HAVE_ALPN 0
114 ++#endif
115 ++
116 ++/* We cannot rely on OPENSSL_NO_NEXTPROTONEG because LibreSSL 2.6.1 dropped
117 ++ * NPN support but did not set OPENSSL_NO_NEXTPROTONEG for compatibility
118 ++ * reasons. The check for TLSEXT_TYPE_next_proto_neg works with
119 ++ * OpenSSL 1.0.1+ and LibreSSL.
120 ++ * OpenSSL 1.1.1-pre1 dropped NPN but still has TLSEXT_TYPE_next_proto_neg.
121 ++ */
122 ++#ifdef OPENSSL_NO_NEXTPROTONEG
123 ++# define HAVE_NPN 0
124 ++#elif (OPENSSL_VERSION_NUMBER >= 0x10101000L) && !defined(LIBRESSL_VERSION_NUMBER)
125 ++# define HAVE_NPN 0
126 ++#elif defined(TLSEXT_TYPE_next_proto_neg)
127 ++# define HAVE_NPN 1
128 ++#else
129 ++# define HAVE_NPN 0
130 + #endif
131 +
132 + #ifndef INVALID_SOCKET /* MS defines this */
133 + #define INVALID_SOCKET (-1)
134 + #endif
135 +
136 +-#ifdef OPENSSL_VERSION_1_1
137 +-/* OpenSSL 1.1.0+ */
138 +-#ifndef OPENSSL_NO_SSL2
139 +-#define OPENSSL_NO_SSL2
140 +-#endif
141 +-#else /* OpenSSL < 1.1.0 */
142 +-#if defined(WITH_THREAD)
143 ++/* OpenSSL 1.0.2 and LibreSSL needs extra code for locking */
144 ++#if !defined(OPENSSL_VERSION_1_1) && defined(WITH_THREAD)
145 + #define HAVE_OPENSSL_CRYPTO_LOCK
146 + #endif
147 +
148 ++#if defined(OPENSSL_VERSION_1_1) && !defined(OPENSSL_NO_SSL2)
149 ++#define OPENSSL_NO_SSL2
150 ++#endif
151 ++
152 ++#ifndef PY_OPENSSL_1_1_API
153 ++/* OpenSSL 1.1 API shims for OpenSSL < 1.1.0 and LibreSSL < 2.7.0 */
154 ++
155 + #define TLS_method SSLv23_method
156 +
157 + static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
158 +@@ -178,7 +209,7 @@
159 + {
160 + return store->param;
161 + }
162 +-#endif /* OpenSSL < 1.1.0 or LibreSSL */
163 ++#endif /* OpenSSL < 1.1.0 or LibreSSL < 2.7.0 */
164 +
165 +
166 + enum py_ssl_error {
167
168 diff --git a/dev-lang/python/python-2.7.12.ebuild b/dev-lang/python/python-2.7.14-r2.ebuild
169 similarity index 93%
170 rename from dev-lang/python/python-2.7.12.ebuild
171 rename to dev-lang/python/python-2.7.14-r2.ebuild
172 index f038c4b118..494beb6780 100644
173 --- a/dev-lang/python/python-2.7.12.ebuild
174 +++ b/dev-lang/python/python-2.7.14-r2.ebuild
175 @@ -1,6 +1,5 @@
176 -# Copyright 1999-2017 Gentoo Foundation
177 +# Copyright 1999-2018 Gentoo Foundation
178 # Distributed under the terms of the GNU General Public License v2
179 -# $Id$
180
181 EAPI="5"
182 WANT_LIBTOOL="none"
183 @@ -8,12 +7,12 @@ WANT_LIBTOOL="none"
184 inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
185
186 MY_P="Python-${PV}"
187 -PATCHSET_VERSION="2.7.12-0"
188 +PATCHSET_VERSION="2.7.14-0"
189 PREFIX_PATCHREV="r0"
190 CYGWINPORTS_GITREV="7be648659ef46f33db6913ca0ca5a809219d5629"
191
192 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
193 -HOMEPAGE="http://www.python.org/"
194 +HOMEPAGE="https://www.python.org/"
195 SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
196 https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
197 https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz"
198 @@ -24,7 +23,7 @@ SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/python2/archive/${CYGW
199 LICENSE="PSF-2"
200 SLOT="2.7"
201 KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
202 -IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
203 +IUSE="aqua -berkdb bluetooth build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
204
205 # Do not add a dependency on dev-lang/python to this ebuild.
206 # If you need to apply a patch which requires python for bootstrapping, please
207 @@ -49,14 +48,12 @@ RDEPEND="app-arch/bzip2:0=
208 sys-libs/db:4.2
209 ) )
210 gdbm? ( sys-libs/gdbm:0=[berkdb] )
211 - ncurses? (
212 - >=sys-libs/ncurses-5.2:0=
213 - readline? ( >=sys-libs/readline-4.1:0= )
214 - )
215 + ncurses? ( >=sys-libs/ncurses-5.2:0= )
216 + readline? ( >=sys-libs/readline-4.1:0= )
217 sqlite? ( >=dev-db/sqlite-3.3.8:3= )
218 ssl? (
219 !libressl? ( dev-libs/openssl:0= )
220 - libressl? ( dev-libs/libressl:= )
221 + libressl? ( dev-libs/libressl:0= )
222 )
223 tk? (
224 >=dev-lang/tcl-8.0:0=
225 @@ -66,7 +63,9 @@ RDEPEND="app-arch/bzip2:0=
226 )
227 xml? ( >=dev-libs/expat-2.1 )
228 !!<sys-apps/portage-2.1.9"
229 +# bluetooth requires headers from bluez
230 DEPEND="${RDEPEND}
231 + bluetooth? ( net-wireless/bluez )
232 virtual/pkgconfig
233 >=sys-devel/autoconf-2.65
234 !sys-devel/gcc[libffi(-)]"
235 @@ -74,6 +73,9 @@ RDEPEND+=" !build? ( app-misc/mime-types )
236 doc? ( dev-python/python-docs:${SLOT} )"
237 PDEPEND=">=app-eselect/eselect-python-20140125-r1"
238
239 +[[ -n ${CYGWINPORTS_GITREV} ]] &&
240 +DEPEND+=" elibc_Cygwin? ( app-arch/unzip )"
241 +
242 S="${WORKDIR}/${MY_P}"
243
244 pkg_setup() {
245 @@ -111,6 +113,9 @@ src_prepare() {
246 # http://prefix.gentooexperimental.org:8000/python-patches-2_7
247 EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
248 epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
249 + epatch "${FILESDIR}/python-3.4-pyfpe-dll.patch" # Cygwin: --with-fpectl
250 + # Make sure python doesn't use the host libffi.
251 + use prefix && epatch "${FILESDIR}/python-2.7.14-libffi-pkgconfig.patch"
252
253 if use aqua ; then
254 # make sure we don't get a framework reference here
255 @@ -137,16 +142,6 @@ src_prepare() {
256 CC="$(tc-getCC) -std=gnu89"
257 fi
258
259 - # Fix for cross-compiling.
260 - epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
261 - epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
262 - epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
263 - epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
264 - epatch "${FILESDIR}/python-3.4-pyfpe-dll.patch" # Cygwin: --with-fpectl
265 -
266 - # Make sure python doesn't use the host libffi.
267 - use prefix && epatch "${FILESDIR}/python-2.7-libffi-pkgconfig.patch"
268 -
269 if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
270 local p d="${WORKDIR}/python2-${CYGWINPORTS_GITREV}"
271 for p in $(
272 @@ -159,6 +154,15 @@ src_prepare() {
273 done
274 fi
275
276 + # Fix for cross-compiling.
277 + epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
278 + epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
279 + epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
280 + epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
281 + epatch "${FILESDIR}/2.7-disable-nis.patch"
282 + epatch "${FILESDIR}/python-2.7-libressl-compatibility.patch"
283 +
284 +
285 epatch_user
286
287 sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
288 @@ -181,6 +185,8 @@ src_configure() {
289 local disable
290 use berkdb || use gdbm || disable+=" dbm"
291 use berkdb || disable+=" _bsddb"
292 + # disable automagic bluetooth headers detection
293 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
294 use gdbm || disable+=" gdbm"
295 use ncurses || disable+=" _curses _curses_panel"
296 use readline || disable+=" readline"
297 @@ -229,6 +235,13 @@ src_configure() {
298 replace-flags -Os -O3 # comment #14
299 fi
300
301 + # Export CC so even AIX will use gcc instead of xlc_r.
302 + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
303 + tc-export CC CXX
304 + # The configure script fails to use pkg-config correctly.
305 + # http://bugs.python.org/issue15506
306 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
307 +
308 # Set LDFLAGS so we link modules with -lpython2.7 correctly.
309 # Needed on FreeBSD unless Python 2.7 is already installed.
310 # Please query BSD team before removing this!
311 @@ -242,8 +255,8 @@ src_configure() {
312 append-cppflags -I"${EPREFIX}"/usr/include
313 append-ldflags -L"${EPREFIX}"/$(get_libdir)
314 append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
315 - # fix compilation on some 64-bits Linux hosts, #381163, #473520
316 - if use amd64-linux ; then
317 + # fix compilation on some Linux hosts, #381163, #473520
318 + if use elibc_glibc ; then
319 for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
320 [[ -d ${hostlibdir} ]] || continue
321 append-ldflags -L${hostlibdir}
322 @@ -254,13 +267,6 @@ src_configure() {
323 sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
324 fi
325
326 - # Export CC so even AIX will use gcc instead of xlc_r.
327 - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
328 - tc-export CC CXX
329 - # The configure script fails to use pkg-config correctly.
330 - # http://bugs.python.org/issue15506
331 - export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
332 -
333 local dbmliborder
334 if use gdbm; then
335 dbmliborder+="${dbmliborder:+:}gdbm"
336 @@ -342,6 +348,11 @@ src_test() {
337 mv "${S}"/Lib/test/test_${test}.py "${T}"
338 done
339
340 + # Daylight saving time problem
341 + # https://bugs.python.org/issue22067
342 + # https://bugs.gentoo.org/610628
343 + local -x TZ=UTC
344 +
345 # Rerun failed tests in verbose mode (regrtest -w).
346 emake test EXTRATESTOPTS="-w" < /dev/tty
347 local result="$?"
348 @@ -536,10 +547,10 @@ EOF
349 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
350 "${ED}"/usr/include/python${SLOT}/pyconfig.h
351
352 - use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
353 - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
354 - use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
355 - use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
356 + use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
357 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
358 + use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
359 + use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
360
361 use threads || rm -r "${libdir}/multiprocessing" || die
362 use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
363 @@ -575,8 +586,9 @@ EOF
364 # if not using a cross-compiler, use the fresh binary
365 if ! tc-is-cross-compiler; then
366 local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
367 - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
368 - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}.
369 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
370 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD}
371 + local -x DYLD_FRAMEWORK_PATH="${WORKDIR}/${CHOST}"
372 else
373 vars=( PYTHON "${vars[@]}" )
374 fi
375
376 diff --git a/dev-lang/python/python-2.7.14.ebuild b/dev-lang/python/python-2.7.14.ebuild
377 deleted file mode 100644
378 index 2650b651f0..0000000000
379 --- a/dev-lang/python/python-2.7.14.ebuild
380 +++ /dev/null
381 @@ -1,637 +0,0 @@
382 -# Copyright 1999-2018 Gentoo Foundation
383 -# Distributed under the terms of the GNU General Public License v2
384 -
385 -EAPI="5"
386 -WANT_LIBTOOL="none"
387 -
388 -inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing
389 -
390 -MY_P="Python-${PV}"
391 -PATCHSET_VERSION="2.7.14-0"
392 -PREFIX_PATCHREV="r0"
393 -CYGWINPORTS_GITREV="7be648659ef46f33db6913ca0ca5a809219d5629"
394 -
395 -DESCRIPTION="An interpreted, interactive, object-oriented programming language"
396 -HOMEPAGE="https://www.python.org/"
397 -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
398 - https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
399 - https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz"
400 -
401 -[[ -n ${CYGWINPORTS_GITREV} ]] &&
402 -SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/python2/archive/${CYGWINPORTS_GITREV}.zip )"
403 -
404 -LICENSE="PSF-2"
405 -SLOT="2.7"
406 -KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
407 -IUSE="aqua -berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
408 -
409 -# Do not add a dependency on dev-lang/python to this ebuild.
410 -# If you need to apply a patch which requires python for bootstrapping, please
411 -# run the bootstrap code on your dev box and include the results in the
412 -# patchset. See bug 447752.
413 -
414 -RDEPEND="app-arch/bzip2:0=
415 - >=sys-libs/zlib-1.1.3:0=
416 - !m68k-mint? ( virtual/libffi )
417 - virtual/libintl
418 - berkdb? ( || (
419 - sys-libs/db:5.3
420 - sys-libs/db:5.2
421 - sys-libs/db:5.1
422 - sys-libs/db:5.0
423 - sys-libs/db:4.8
424 - sys-libs/db:4.7
425 - sys-libs/db:4.6
426 - sys-libs/db:4.5
427 - sys-libs/db:4.4
428 - sys-libs/db:4.3
429 - sys-libs/db:4.2
430 - ) )
431 - gdbm? ( sys-libs/gdbm:0=[berkdb] )
432 - ncurses? (
433 - >=sys-libs/ncurses-5.2:0=
434 - readline? ( >=sys-libs/readline-4.1:0= )
435 - )
436 - sqlite? ( >=dev-db/sqlite-3.3.8:3= )
437 - ssl? (
438 - !libressl? ( dev-libs/openssl:0= )
439 - libressl? ( dev-libs/libressl:= )
440 - )
441 - tk? (
442 - >=dev-lang/tcl-8.0:0=
443 - >=dev-lang/tk-8.0:0=[-aqua]
444 - dev-tcltk/blt:0=
445 - dev-tcltk/tix
446 - )
447 - xml? ( >=dev-libs/expat-2.1 )
448 - !!<sys-apps/portage-2.1.9"
449 -DEPEND="${RDEPEND}
450 - virtual/pkgconfig
451 - >=sys-devel/autoconf-2.65
452 - !sys-devel/gcc[libffi(-)]"
453 -RDEPEND+=" !build? ( app-misc/mime-types )
454 - doc? ( dev-python/python-docs:${SLOT} )"
455 -PDEPEND=">=app-eselect/eselect-python-20140125-r1"
456 -
457 -[[ -n ${CYGWINPORTS_GITREV} ]] &&
458 -DEPEND+=" elibc_Cygwin? ( app-arch/unzip )"
459 -
460 -S="${WORKDIR}/${MY_P}"
461 -
462 -pkg_setup() {
463 - if use berkdb; then
464 - ewarn "'bsddb' module is out-of-date and no longer maintained inside"
465 - ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
466 - ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
467 - ewarn "is provided by dev-python/bsddb3."
468 - else
469 - if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
470 - ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
471 - ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
472 - ewarn "You might need to migrate your databases."
473 - fi
474 - fi
475 -}
476 -
477 -src_prepare() {
478 - # Ensure that internal copies of expat, libffi and zlib are not used.
479 - rm -r Modules/expat || die
480 - rm -r Modules/_ctypes/libffi* || die
481 - rm -r Modules/zlib || die
482 -
483 - if tc-is-cross-compiler; then
484 - local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
485 - fi
486 -
487 - EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
488 -
489 - # if building a patched source-tar, comment the rm's above, and uncomment
490 - # this line:
491 - #local EPATCH_EXCLUDE=" 01_all_prefix-no-patch-invention.patch"
492 -
493 - # Prefix' round of patches
494 - # http://prefix.gentooexperimental.org:8000/python-patches-2_7
495 - EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
496 - epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
497 -
498 - if use aqua ; then
499 - # make sure we don't get a framework reference here
500 - sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
501 - -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \
502 - Makefile.pre.in || die
503 - # Python upstream refuses to listen to configure arguments
504 - sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \
505 - configure.ac configure || die
506 - # we handle creation of symlinks in src_install
507 - sed -i -e '/ln -fs .*PYTHONFRAMEWORK/d' Makefile.pre.in || die
508 - fi
509 - # don't try to do fancy things on Darwin
510 - sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
511 - # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
512 - sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
513 - # fix header standards conflicts on Solaris
514 - if [[ ${CHOST} == *-solaris* ]] ; then
515 - # GCC5 switched the default from gnu89 to gnu11, a standards
516 - # conflict arises from that, which can be solved by upgrading
517 - # _XOPEN_SOURCE from 500 to 600, but since it is compiler
518 - # version specific, just force the old standard onto the
519 - # compiler. Python 3 properly detects this.
520 - CC="$(tc-getCC) -std=gnu89"
521 - fi
522 -
523 - # Fix for cross-compiling.
524 - epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch"
525 - epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch"
526 - epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch"
527 - epatch "${FILESDIR}/python-2.7.10-system-libffi.patch"
528 - epatch "${FILESDIR}/python-3.4-pyfpe-dll.patch" # Cygwin: --with-fpectl
529 -
530 - # Make sure python doesn't use the host libffi.
531 - use prefix && epatch "${FILESDIR}/python-2.7.14-libffi-pkgconfig.patch"
532 -
533 - if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
534 - local p d="${WORKDIR}/python2-${CYGWINPORTS_GITREV}"
535 - for p in $(
536 - eval "$(sed -ne '/PATCH_URI="/,/"/p' < "${d}"/python.cygport)"
537 - echo ${PATCH_URI}
538 - ); do
539 - # dropped by 01_all_prefix-no-patch-invention.patch
540 - [[ ${p} == *-tkinter-* ]] && continue
541 - epatch "${d}/${p}"
542 - done
543 - fi
544 -
545 - epatch_user
546 -
547 - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
548 - Lib/distutils/command/install.py \
549 - Lib/distutils/sysconfig.py \
550 - Lib/site.py \
551 - Lib/sysconfig.py \
552 - Lib/test/test_site.py \
553 - Makefile.pre.in \
554 - Modules/Setup.dist \
555 - Modules/getpath.c \
556 - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
557 -
558 - eautoreconf
559 -}
560 -
561 -src_configure() {
562 - # dbm module can be linked against berkdb or gdbm.
563 - # Defaults to gdbm when both are enabled, #204343.
564 - local disable
565 - use berkdb || use gdbm || disable+=" dbm"
566 - use berkdb || disable+=" _bsddb"
567 - use gdbm || disable+=" gdbm"
568 - use ncurses || disable+=" _curses _curses_panel"
569 - use readline || disable+=" readline"
570 - use sqlite || disable+=" _sqlite3"
571 - use ssl || export PYTHON_DISABLE_SSL="1"
572 - use tk || disable+=" _tkinter"
573 - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
574 - [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon
575 - [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs"
576 - export PYTHON_DISABLE_MODULES="${disable}"
577 -
578 - if ! use xml; then
579 - ewarn "You have configured Python without XML support."
580 - ewarn "This is NOT a recommended configuration as you"
581 - ewarn "may face problems parsing any XML documents."
582 - fi
583 -
584 - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
585 - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
586 - fi
587 -
588 - if [[ "$(gcc-major-version)" -ge 4 ]]; then
589 - append-flags -fwrapv
590 - fi
591 -
592 - filter-flags -malign-double
593 -
594 - # https://bugs.gentoo.org/show_bug.cgi?id=50309
595 - if is-flagq -O3; then
596 - is-flagq -fstack-protector-all && replace-flags -O3 -O2
597 - use hardened && replace-flags -O3 -O2
598 - fi
599 -
600 - if tc-is-cross-compiler; then
601 - # Force some tests that try to poke fs paths.
602 - export ac_cv_file__dev_ptc=no
603 - export ac_cv_file__dev_ptmx=yes
604 - fi
605 -
606 - # http://bugs.gentoo.org/show_bug.cgi?id=302137
607 - if [[ ${CHOST} == powerpc-*-darwin* ]] && \
608 - ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \
609 - [[ ${CHOST} == powerpc64-*-darwin* ]];
610 - then
611 - replace-flags -O2 -O3
612 - replace-flags -Os -O3 # comment #14
613 - fi
614 -
615 - # Set LDFLAGS so we link modules with -lpython2.7 correctly.
616 - # Needed on FreeBSD unless Python 2.7 is already installed.
617 - # Please query BSD team before removing this!
618 - # On AIX this is not needed, but would record '.' as runpath.
619 - [[ ${CHOST} == *-aix* ]] ||
620 - append-ldflags "-L."
621 -
622 - if use prefix ; then
623 - # for Python's setup.py not to do false assumptions (only looking in
624 - # host paths) we need to make explicit where Prefix stuff is
625 - append-cppflags -I"${EPREFIX}"/usr/include
626 - append-ldflags -L"${EPREFIX}"/$(get_libdir)
627 - append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)
628 - # fix compilation on some Linux hosts, #381163, #473520
629 - if use elibc_glibc ; then
630 - for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do
631 - [[ -d ${hostlibdir} ]] || continue
632 - append-ldflags -L${hostlibdir}
633 - done
634 - fi
635 - # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that
636 - # local include paths - set in $(CPPFLAGS) - are searched first.
637 - sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die
638 - fi
639 -
640 - # Export CC so even AIX will use gcc instead of xlc_r.
641 - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
642 - tc-export CC CXX
643 - # The configure script fails to use pkg-config correctly.
644 - # http://bugs.python.org/issue15506
645 - export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
646 -
647 - local dbmliborder
648 - if use gdbm; then
649 - dbmliborder+="${dbmliborder:+:}gdbm"
650 - fi
651 - if use berkdb; then
652 - dbmliborder+="${dbmliborder:+:}bdb"
653 - fi
654 -
655 - [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
656 -
657 - # we need this to get pythonw, the GUI version of python
658 - # --enable-framework and --enable-shared are mutually exclusive:
659 - # http://bugs.python.org/issue5809
660 - local myshared=
661 - use aqua \
662 - && myshared="--enable-framework=${EPREFIX}/usr/lib" \
663 - || myshared="--enable-shared"
664 -
665 - BUILD_DIR="${WORKDIR}/${CHOST}"
666 - mkdir -p "${BUILD_DIR}" || die
667 - cd "${BUILD_DIR}" || die
668 -
669 - # note: for a framework build we need to use ucs2 because macOS
670 - # uses that internally too:
671 - # http://bugs.python.org/issue763708
672 - # HAS_HG to avoid finding obsolete hg of the host
673 - ECONF_SOURCE="${S}" OPT="" HAS_HG="no" \
674 - econf \
675 - --with-fpectl \
676 - ${myshared} \
677 - $(use_enable ipv6) \
678 - $(use_with threads) \
679 - $( (use wide-unicode && use !aqua) && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \
680 - --infodir='${prefix}/share/info' \
681 - --mandir='${prefix}/share/man' \
682 - --with-computed-gotos \
683 - --with-dbmliborder="${dbmliborder}" \
684 - --with-libc="" \
685 - --enable-loadable-sqlite-extensions \
686 - --with-system-expat \
687 - --with-system-ffi \
688 - --without-ensurepip
689 -
690 - if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
691 - eerror "configure has detected that the sem_open function is broken."
692 - eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
693 - die "Broken sem_open function (bug 496328)"
694 - fi
695 -}
696 -
697 -src_compile() {
698 - # Avoid invoking pgen for cross-compiles.
699 - touch Include/graminit.h Python/graminit.c
700 -
701 - cd "${BUILD_DIR}" || die
702 - emake
703 -
704 - # Work around bug 329499. See also bug 413751 and 457194.
705 - if has_version dev-libs/libffi[pax_kernel]; then
706 - pax-mark E python
707 - else
708 - pax-mark m python
709 - fi
710 -}
711 -
712 -src_test() {
713 - # Tests will not work when cross compiling.
714 - if tc-is-cross-compiler; then
715 - elog "Disabling tests due to crosscompiling."
716 - return
717 - fi
718 -
719 - cd "${BUILD_DIR}" || die
720 -
721 - # Skip failing tests.
722 - local skipped_tests="distutils gdb"
723 -
724 - for test in ${skipped_tests}; do
725 - mv "${S}"/Lib/test/test_${test}.py "${T}"
726 - done
727 -
728 - # Daylight saving time problem
729 - # https://bugs.python.org/issue22067
730 - # https://bugs.gentoo.org/610628
731 - local -x TZ=UTC
732 -
733 - # Rerun failed tests in verbose mode (regrtest -w).
734 - emake test EXTRATESTOPTS="-w" < /dev/tty
735 - local result="$?"
736 -
737 - for test in ${skipped_tests}; do
738 - mv "${T}/test_${test}.py" "${S}"/Lib/test
739 - done
740 -
741 - elog "The following tests have been skipped:"
742 - for test in ${skipped_tests}; do
743 - elog "test_${test}.py"
744 - done
745 -
746 - elog "If you would like to run them, you may:"
747 - elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'"
748 - elog "and run the tests separately."
749 -
750 - if [[ "${result}" -ne 0 ]]; then
751 - die "emake test failed"
752 - fi
753 -}
754 -
755 -src_install() {
756 - local libdir=${ED}/usr/$(get_libdir)/python${SLOT}
757 -
758 - cd "${BUILD_DIR}" || die
759 - [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
760 - if use aqua ; then
761 - local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework
762 -
763 - # do not make multiple targets in parallel when there are broken
764 - # sharedmods (during bootstrap), would build them twice in parallel.
765 -
766 - # Python_Launcher is kind of a wrapper, and we should fix it for
767 - # Prefix (it uses /usr/bin/pythonw) so useless
768 - # IDLE doesn't run, no idea, but definitely not used
769 - sed -i -e 's/install_\(BuildApplet\|PythonLauncher\|IDLE\)[^:]//g' \
770 - Mac/Makefile || die
771 -
772 - # let the makefiles do their thing
773 - emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall
774 - rmdir "${ED}"/Applications/Python* || die
775 - rmdir "${ED}"/Applications || die
776 -
777 - # avoid framework incompatability, degrade to a normal UNIX lib
778 - mkdir -p "${ED}"/usr/$(get_libdir)
779 - cp "${D}${fwdir}"/Versions/${SLOT}/Python \
780 - "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die
781 - chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
782 - install_name_tool \
783 - -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
784 - "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
785 - chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib
786 - cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die
787 -
788 - # rebuild python executable to be the non-pythonw (python wrapper)
789 - # version so we don't get framework crap
790 - rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861
791 - $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \
792 - -o "${ED}"/usr/bin/python${SLOT} \
793 - Modules/python.o || die
794 -
795 - # don't install the "Current" symlink, will always conflict
796 - rm "${D}${fwdir}"/Versions/Current || die
797 - # update whatever points to it, eselect-python sets them
798 - rm "${D}${fwdir}"/{Headers,Python,Resources} || die
799 -
800 - # remove unversioned files (that are not made versioned below)
801 - pushd "${ED}"/usr/bin > /dev/null
802 - rm -f python python-config python${SLOT}-config
803 - # python${SLOT} was created above
804 - for f in pythonw smtpd${SLOT}.py pydoc idle ; do
805 - rm -f ${f} ${f}${SLOT}
806 - done
807 - # pythonw needs to remain in the framework (that's the whole
808 - # reason we go through this framework hassle)
809 - ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die
810 - # copy the scripts to we can fix their shebangs
811 - for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do
812 - # for some reason sometimes they already exist, bug #347321
813 - rm -f ${f}
814 - cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die
815 - sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \
816 - ${f} || die
817 - done
818 - # "fix" to have below collision fix not to bail
819 - mv pydoc${SLOT} pydoc || die
820 - mv idle${SLOT} idle || die
821 - popd > /dev/null
822 -
823 - # basically we don't like the framework stuff at all, so just move
824 - # stuff around or add some symlinks to make our life easier
825 - mkdir -p "${ED}"/usr
826 - mv "${D}${fwdir}"/Versions/${SLOT}/share \
827 - "${ED}"/usr/ || die "can't move share"
828 - # get includes just UNIX style
829 - mkdir -p "${ED}"/usr/include
830 - mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \
831 - "${ED}"/usr/include/ || die "can't move include"
832 - pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null
833 - ln -s ../../../../../include/python${SLOT} || die
834 - popd > /dev/null
835 - rm -f "${ED}"/usr/share/man/man1/python{,2}.1
836 -
837 - # same for libs
838 - # NOTE: can't symlink the entire dir, because a real dir already exists
839 - # on upgrade (site-packages), however since we h4x0rzed python to
840 - # actually look into the UNIX-style dir, we just switch them around.
841 - mkdir -p "${ED}"/usr/$(get_libdir)/python${SLOT}
842 - mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT}/* \
843 - "${ED}"/usr/$(get_libdir)/python${SLOT}/ \
844 - || die "can't move python${SLOT}"
845 - rmdir "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} || die
846 - pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null
847 - ln -s ../../../../python${SLOT} || die
848 - popd > /dev/null
849 -
850 - # fix up Makefile
851 - sed -i \
852 - -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \
853 - -e '/^LDFLAGS=/s/=.*$/=/' \
854 - -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \
855 - -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \
856 - -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \
857 - -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \
858 - -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \
859 - -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \
860 - "${libdir}"/config/Makefile || die
861 - # and sysconfigdata likewise
862 - sed -i \
863 - -e "/'LINKFORSHARED'/s/-u _PyMac_Error[^']*'/'/" \
864 - -e "/'LDFLAGS'/s/:.*$/:'',/" \
865 - -e "/'prefix'/s|:.*$|:'${EPREFIX}/usr',|" \
866 - -e "/'PYTHONFRAMEWORK'/s/:.*$/:'',/" \
867 - -e "/'PYTHONFRAMEWORKDIR'/s/:.*$/:'no-framework',/" \
868 - -e "/'PYTHONFRAMEWORKPREFIX'/s/:.*$/:'',/" \
869 - -e "/'PYTHONFRAMEWORKINSTALLDIR'/s/:.*$/:'',/" \
870 - -e "/'LDLIBRARY'/s|:.*$|:'libpython${SLOT}.dylib',|" \
871 - "${libdir}"/_sysconfigdata.py || die
872 -
873 - # add missing version.plist file
874 - mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources
875 - cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF
876 -<?xml version="1.0" encoding="UTF-8"?>
877 -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
878 -"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
879 -<plist version="1.0">
880 -<dict>
881 - <key>BuildVersion</key>
882 - <string>1</string>
883 - <key>CFBundleShortVersionString</key>
884 - <string>${PV}</string>
885 - <key>CFBundleVersion</key>
886 - <string>${PV}</string>
887 - <key>ProjectName</key>
888 - <string>Python</string>
889 - <key>SourceVersion</key>
890 - <string>${PV}</string>
891 -</dict>
892 -</plist>
893 -EOF
894 - else
895 - emake DESTDIR="${D}" altinstall
896 - fi
897 -
898 - sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed"
899 - if [[ ${CHOST} == *-aix* ]]; then
900 - # fix upstream bugs with quite large proposed diffs still to be sorted out:
901 - # http://bugs.python.org/issue13493
902 - # http://bugs.python.org/issue14150
903 - # http://bugs.python.org/issue15590
904 - # http://bugs.python.org/issue16189
905 - sed -e "/Libs:/s|\$| -Wl,-bE:${EPREFIX}/${libdir#$ED}/config/python.exp -lld|" \
906 - -i "${ED}"usr/$(get_libdir)/pkgconfig/python-${SLOT}.pc || die "sed failed"
907 - sed -e "s|:Modules/python.exp|:${EPREFIX}/${libdir#$ED}/config/python.exp|" \
908 - -e 's| -bI:| -Wl,-bI:|g' \
909 - -e '/LINKFORSHARED/s|-bE:|-bI:|g' \
910 - -e '/LINKFORSHARED/s| -lld||g' \
911 - -i "${libdir}"/{_sysconfigdata.py,config/Makefile} || die "sed failed"
912 - fi
913 -
914 - # Fix collisions between different slots of Python.
915 - mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}"
916 - mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}"
917 - mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}"
918 - rm -f "${ED}usr/bin/smtpd.py"
919 -
920 - # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec
921 - # These #defines cause problems when building c99 compliant python modules
922 - # http://bugs.python.org/issue1759169
923 - [[ ${CHOST} == *-solaris* ]] && sed -i -e \
924 - 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \
925 - "${ED}"/usr/include/python${SLOT}/pyconfig.h
926 -
927 - use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py,test/test_bsddb*} || die
928 - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
929 - use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die
930 - use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
931 -
932 - use threads || rm -r "${libdir}/multiprocessing" || die
933 - use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die
934 -
935 - dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
936 -
937 - if use examples; then
938 - insinto /usr/share/doc/${PF}/examples
939 - doins -r "${S}"/Tools
940 - fi
941 - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
942 - local libname
943 - if use aqua ; then
944 - # we do framework, so the emake trick below returns a pathname
945 - # since that won't work here, use a (cheap) trick instead
946 - libname=libpython${SLOT}
947 - else
948 - libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
949 - emake --no-print-directory -s -f - 2>/dev/null)
950 - fi
951 - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
952 -
953 - newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT}
954 - newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT}
955 - sed \
956 - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \
957 - -e "s:@PYDOC@:pydoc${SLOT}:" \
958 - -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed"
959 -
960 - # for python-exec
961 - local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
962 -
963 - # if not using a cross-compiler, use the fresh binary
964 - if ! tc-is-cross-compiler; then
965 - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
966 - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
967 - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}.
968 - local -x DYLD_FRAMEWORK_PATH="${WORKDIR}/${CHOST}"
969 - else
970 - vars=( PYTHON "${vars[@]}" )
971 - fi
972 -
973 - python_export "python${SLOT}" "${vars[@]}"
974 - echo "EPYTHON='${EPYTHON}'" > epython.py || die
975 - python_domodule epython.py
976 -
977 - # python-exec wrapping support
978 - local pymajor=${SLOT%.*}
979 - mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
980 - # python and pythonX
981 - ln -s "../../../bin/python${SLOT}" \
982 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
983 - ln -s "python${pymajor}" \
984 - "${D}${PYTHON_SCRIPTDIR}/python" || die
985 - # python-config and pythonX-config
986 - ln -s "../../../bin/python${SLOT}-config" \
987 - "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
988 - ln -s "python${pymajor}-config" \
989 - "${D}${PYTHON_SCRIPTDIR}/python-config" || die
990 - # 2to3, pydoc, pyvenv
991 - ln -s "../../../bin/2to3-${SLOT}" \
992 - "${D}${PYTHON_SCRIPTDIR}/2to3" || die
993 - ln -s "../../../bin/pydoc${SLOT}" \
994 - "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
995 - # idle
996 - if use tk; then
997 - ln -s "../../../bin/idle${SLOT}" \
998 - "${D}${PYTHON_SCRIPTDIR}/idle" || die
999 - fi
1000 -}
1001 -
1002 -eselect_python_update() {
1003 - if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
1004 - eselect python update
1005 - fi
1006 -
1007 - if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
1008 - eselect python update --python${PV%%.*}
1009 - fi
1010 -}
1011 -
1012 -pkg_postinst() {
1013 - eselect_python_update
1014 -}
1015 -
1016 -pkg_postrm() {
1017 - eselect_python_update
1018 -}