1 |
commit: 820ef48d66fcc57df68a375caf8e37d90b35e98d |
2 |
Author: orbea <orbea <AT> riseup <DOT> net> |
3 |
AuthorDate: Fri Apr 29 06:38:36 2022 +0000 |
4 |
Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com> |
5 |
CommitDate: Sun May 1 00:18:26 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=820ef48d |
7 |
|
8 |
dev-lang/python: Updated versions |
9 |
|
10 |
Updates for 3.9.12, 3.10.3 and 3.10.4 |
11 |
|
12 |
Uses OpenBSD patches. |
13 |
|
14 |
See: https://github.com/libressl-portable/portable/issues/751 |
15 |
|
16 |
Signed-off-by: orbea <orbea <AT> riseup.net> |
17 |
Closes: https://github.com/gentoo/libressl/pull/398 |
18 |
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com> |
19 |
|
20 |
dev-lang/python/Manifest | 9 + |
21 |
dev-lang/python/python-3.10.3-libressl.patch | 74 +++++ |
22 |
dev-lang/python/python-3.10.3.ebuild | 409 ++++++++++++++++++++++++++ |
23 |
dev-lang/python/python-3.10.4.ebuild | 410 +++++++++++++++++++++++++++ |
24 |
dev-lang/python/python-3.9.12.ebuild | 406 ++++++++++++++++++++++++++ |
25 |
5 files changed, 1308 insertions(+) |
26 |
|
27 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
28 |
index 47530ac..97c9489 100644 |
29 |
--- a/dev-lang/python/Manifest |
30 |
+++ b/dev-lang/python/Manifest |
31 |
@@ -1,3 +1,12 @@ |
32 |
+DIST Python-3.10.3.tar.xz 19343528 BLAKE2B 5234f14d3dbc1b7c43da65fbc242218c1f94601d13ca84419cd9b29eab22ab411b7cd043ebaabc2b2aa1856e5e91c3ecc42eaaf333f92b8e133844e09d515bdf SHA512 5020407798ebaae6002b8de29475c1064a32f1527a0e4ec6fe7fcf076b4ea3ef0ab4b4a7864a6081cc8dd01dd545123198b11cc8dd1259c670394b7d81f35a86 |
33 |
+DIST Python-3.10.3.tar.xz.asc 833 BLAKE2B 03117464582146b78748ba129a10b7481607dd9dc7cdd38ced9f20e96c8c01722852941b6b7b58f34fd42b3709fc8bd31b7ba97d89235ce61d8f0ac89106d69b SHA512 ddbe55225fcdd5d36f6be4bb802ea8fb9c5e8cf1b573b76501cc0999bcbfb2355f5bf7bbe10bf7cb209e54f37ed0789b4b936920b208b2afc18597bab33f2f51 |
34 |
+DIST Python-3.10.4.tar.xz 19342692 BLAKE2B c430ad9bed71729fda29433af0614b6c0110a85e23f4cb5cff3a9b501febe99b20094367a5428f256fb3aeef97f34d439ef677fc8ae4d596d52da7976b65ebb5 SHA512 6c9aeecddc55c7896b2e8527fca131c7b2b6127d56ce1a001ccedfebf590334e0c0bb7c517ed3cf1da3c1910e002552b56aa7e03eeb672f42ff0bd8150799113 |
35 |
+DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf SHA512 699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d |
36 |
DIST Python-3.9.11.tar.xz 19724780 BLAKE2B 25b017e36b22235790633eb1a88f52092225252f39963fc365c1ea863f5b5d98a796bceb01e5e34c02d9690f2a664959766b214b8c13350d6e22839218d0c097 SHA512 804e6e6b31922378f07f290023f6efc870c6fd3010204c499c2b375880f6e6ec0f72ce96a8fff81956f6fa3bea2123df2138ef0fda23a3d5d3cf757174a930c3 |
37 |
DIST Python-3.9.11.tar.xz.asc 833 BLAKE2B c60c291f3dad39c842d16717239006f3ee703eaa586d95ea02ba4486d20a1e82065bbaf7af6f7cf6a04799229359791a72834096b6ce5f5d2b583ba5962d441b SHA512 a84bbfa68ec1c0e45bbd64af4481be7d68885021287731c69346a3cb25c9bf607be84dd72af2d3a6fbeabbde64975f37c4bb4f61274e72b92b4277fa48543e52 |
38 |
+DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25 SHA512 081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97 |
39 |
+DIST Python-3.9.12.tar.xz.asc 833 BLAKE2B 33436d0404a643215a8fd2b967ffd216201da24f374941bf65b888159ccfabcbe79b751eca2dd489b06605604338c8bbaab74aa10abbe4bcffaa54236301228e SHA512 dddaa27f8a29034f458edb6739398a5455c87fe37b6349e161865a9deedca118ffe9cb82663cc75bbe60b3b556399c0c6855f5262aac1fe90d36a3694fca65b2 |
40 |
+DIST python-gentoo-patches-3.10.3.tar.xz 8584 BLAKE2B 4287b33e696a1c350fef2ef34843353a2f4ad20feed2e9d7e05d727ec4f18105f57c21e7ab73941e14cc2ace27e8ac7f5e96ce2893b626c8e75cac52760f0935 SHA512 515025b13063eaee71738b8e1f071cd9930cf516e90c1c652adc6f8bee356598d152cb3337a6633500cda4228a5ddc2819f1db0cdb2524a479a0bca69ca557cb |
41 |
+DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2 |
42 |
DIST python-gentoo-patches-3.9.11.tar.xz 12844 BLAKE2B de7ffa39e96127949d2b894fe15c8c1345180842791743af14a3728a7c950e877ab7c74f3e72da5518b16ecb2f3ff13e6132740bb067fe43a8359c673befbaf5 SHA512 0507792188587e66d63a70dde17c6aea1c9aab9e40ace3aeb585adbd2c62acf828782312ba7523f7a4ea49ab1125a30c7b091d10fe02874b018f2733fb8e141d |
43 |
+DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b SHA512 07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91 |
44 |
|
45 |
diff --git a/dev-lang/python/python-3.10.3-libressl.patch b/dev-lang/python/python-3.10.3-libressl.patch |
46 |
new file mode 100644 |
47 |
index 0000000..18e40c1 |
48 |
--- /dev/null |
49 |
+++ b/dev-lang/python/python-3.10.3-libressl.patch |
50 |
@@ -0,0 +1,74 @@ |
51 |
+Neuter security level things until LibreSSL supports them. |
52 |
+ |
53 |
+Index: Modules/_ssl.c |
54 |
+--- a/Modules/_ssl.c.orig |
55 |
++++ b/Modules/_ssl.c |
56 |
+@@ -169,7 +169,7 @@ extern const SSL_METHOD *TLSv1_2_method(void); |
57 |
+ * Based on Hynek's excellent blog post (update 2021-02-11) |
58 |
+ * https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ |
59 |
+ */ |
60 |
+- #define PY_SSL_DEFAULT_CIPHER_STRING "@SECLEVEL=2:ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM" |
61 |
++ #define PY_SSL_DEFAULT_CIPHER_STRING "ECDH+AESGCM:ECDH+CHACHA20:ECDH+AES:DHE+AES:!aNULL:!eNULL:!aDSS:!SHA1:!AESCCM" |
62 |
+ #ifndef PY_SSL_MIN_PROTOCOL |
63 |
+ #define PY_SSL_MIN_PROTOCOL TLS1_2_VERSION |
64 |
+ #endif |
65 |
+@@ -3579,6 +3579,12 @@ set_num_tickets(PySSLContext *self, PyObject *arg, voi |
66 |
+ PyDoc_STRVAR(PySSLContext_num_tickets_doc, |
67 |
+ "Control the number of TLSv1.3 session tickets"); |
68 |
+ #endif /* TLS1_3_VERSION */ |
69 |
++ |
70 |
++int |
71 |
++SSL_CTX_get_security_level(const SSL_CTX *ctx) |
72 |
++{ |
73 |
++ return 1; |
74 |
++} |
75 |
+ |
76 |
+ static PyObject * |
77 |
+ get_security_level(PySSLContext *self, void *c) |
78 |
+Index: Modules/_hashopenssl.c |
79 |
+--- a/Modules/_hashopenssl.c.orig |
80 |
++++ b/Modules/_hashopenssl.c |
81 |
+@@ -45,11 +45,6 @@ |
82 |
+ |
83 |
+ #define MUNCH_SIZE INT_MAX |
84 |
+ |
85 |
+-#define PY_OPENSSL_HAS_SCRYPT 1 |
86 |
+-#define PY_OPENSSL_HAS_SHA3 1 |
87 |
+-#define PY_OPENSSL_HAS_SHAKE 1 |
88 |
+-#define PY_OPENSSL_HAS_BLAKE2 1 |
89 |
+- |
90 |
+ #if OPENSSL_VERSION_NUMBER >= 0x30000000L |
91 |
+ #define PY_EVP_MD EVP_MD |
92 |
+ #define PY_EVP_MD_fetch(algorithm, properties) EVP_MD_fetch(NULL, algorithm, properties) |
93 |
+@@ -119,6 +114,7 @@ static const py_hashentry_t py_hashes[] = { |
94 |
+ PY_HASH_ENTRY(Py_hash_sha256, "SHA256", SN_sha256, NID_sha256), |
95 |
+ PY_HASH_ENTRY(Py_hash_sha384, "SHA384", SN_sha384, NID_sha384), |
96 |
+ PY_HASH_ENTRY(Py_hash_sha512, "SHA512", SN_sha512, NID_sha512), |
97 |
++#if !defined(LIBRESSL_VERSION_NUMBER) |
98 |
+ /* truncated sha2 */ |
99 |
+ PY_HASH_ENTRY(Py_hash_sha512_224, "SHA512_224", SN_sha512_224, NID_sha512_224), |
100 |
+ PY_HASH_ENTRY(Py_hash_sha512_256, "SHA512_256", SN_sha512_256, NID_sha512_256), |
101 |
+@@ -133,6 +129,7 @@ static const py_hashentry_t py_hashes[] = { |
102 |
+ /* blake2 digest */ |
103 |
+ PY_HASH_ENTRY(Py_hash_blake2s, "blake2s256", SN_blake2s256, NID_blake2s256), |
104 |
+ PY_HASH_ENTRY(Py_hash_blake2b, "blake2b512", SN_blake2b512, NID_blake2b512), |
105 |
++#endif |
106 |
+ PY_HASH_ENTRY(NULL, NULL, NULL, 0), |
107 |
+ }; |
108 |
+ |
109 |
+@@ -873,11 +870,15 @@ py_evp_fromname(PyObject *module, const char *digestna |
110 |
+ goto exit; |
111 |
+ } |
112 |
+ |
113 |
++#if defined(LIBRESSL_VERSION_NUMBER) |
114 |
++ type = get_hashlib_state(module)->EVPtype; |
115 |
++#else |
116 |
+ if ((EVP_MD_flags(digest) & EVP_MD_FLAG_XOF) == EVP_MD_FLAG_XOF) { |
117 |
+ type = get_hashlib_state(module)->EVPXOFtype; |
118 |
+ } else { |
119 |
+ type = get_hashlib_state(module)->EVPtype; |
120 |
+ } |
121 |
++#endif |
122 |
+ |
123 |
+ self = newEVPobject(type); |
124 |
+ if (self == NULL) { |
125 |
|
126 |
diff --git a/dev-lang/python/python-3.10.3.ebuild b/dev-lang/python/python-3.10.3.ebuild |
127 |
new file mode 100644 |
128 |
index 0000000..f7d56e4 |
129 |
--- /dev/null |
130 |
+++ b/dev-lang/python/python-3.10.3.ebuild |
131 |
@@ -0,0 +1,409 @@ |
132 |
+# Copyright 1999-2022 Gentoo Authors |
133 |
+# Distributed under the terms of the GNU General Public License v2 |
134 |
+ |
135 |
+EAPI="7" |
136 |
+WANT_LIBTOOL="none" |
137 |
+ |
138 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ |
139 |
+ python-utils-r1 toolchain-funcs verify-sig |
140 |
+ |
141 |
+MY_PV=${PV/_rc/rc} |
142 |
+MY_P="Python-${MY_PV%_p*}" |
143 |
+PYVER=$(ver_cut 1-2) |
144 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
145 |
+ |
146 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
147 |
+HOMEPAGE="https://www.python.org/" |
148 |
+SRC_URI="https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
149 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
150 |
+ verify-sig? ( |
151 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
152 |
+ ) |
153 |
+" |
154 |
+S="${WORKDIR}/${MY_P}" |
155 |
+ |
156 |
+LICENSE="PSF-2" |
157 |
+SLOT="${PYVER}" |
158 |
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" |
159 |
+IUSE="bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" |
160 |
+RESTRICT="!test? ( test )" |
161 |
+ |
162 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
163 |
+# If you need to apply a patch which requires python for bootstrapping, please |
164 |
+# run the bootstrap code on your dev box and include the results in the |
165 |
+# patchset. See bug 447752. |
166 |
+ |
167 |
+RDEPEND=" |
168 |
+ app-arch/bzip2:= |
169 |
+ app-arch/xz-utils:= |
170 |
+ dev-lang/python-exec[python_targets_python3_10(-)] |
171 |
+ dev-libs/libffi:= |
172 |
+ sys-apps/util-linux:= |
173 |
+ >=sys-libs/zlib-1.1.3:= |
174 |
+ virtual/libcrypt:= |
175 |
+ virtual/libintl |
176 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
177 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
178 |
+ readline? ( |
179 |
+ !libedit? ( >=sys-libs/readline-4.1:= ) |
180 |
+ libedit? ( dev-libs/libedit:= ) |
181 |
+ ) |
182 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
183 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
184 |
+ tk? ( |
185 |
+ >=dev-lang/tcl-8.0:= |
186 |
+ >=dev-lang/tk-8.0:= |
187 |
+ dev-tcltk/blt:= |
188 |
+ dev-tcltk/tix |
189 |
+ ) |
190 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
191 |
+ !!<sys-apps/sandbox-2.21 |
192 |
+" |
193 |
+# bluetooth requires headers from bluez |
194 |
+DEPEND=" |
195 |
+ ${RDEPEND} |
196 |
+ bluetooth? ( net-wireless/bluez ) |
197 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
198 |
+" |
199 |
+# autoconf-archive needed to eautoreconf |
200 |
+BDEPEND=" |
201 |
+ sys-devel/autoconf-archive |
202 |
+ virtual/awk |
203 |
+ virtual/pkgconfig |
204 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
205 |
+ !sys-devel/gcc[libffi(-)] |
206 |
+" |
207 |
+RDEPEND+=" |
208 |
+ build? ( app-misc/mime-types ) |
209 |
+" |
210 |
+ |
211 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
212 |
+ |
213 |
+# large file tests involve a 2.5G file being copied (duplicated) |
214 |
+CHECKREQS_DISK_BUILD=5500M |
215 |
+ |
216 |
+pkg_pretend() { |
217 |
+ use test && check-reqs_pkg_pretend |
218 |
+} |
219 |
+ |
220 |
+pkg_setup() { |
221 |
+ use test && check-reqs_pkg_setup |
222 |
+} |
223 |
+ |
224 |
+src_unpack() { |
225 |
+ if use verify-sig; then |
226 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
227 |
+ fi |
228 |
+ default |
229 |
+} |
230 |
+ |
231 |
+src_prepare() { |
232 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
233 |
+ rm -fr Modules/expat || die |
234 |
+ rm -fr Modules/_ctypes/libffi* || die |
235 |
+ rm -fr Modules/zlib || die |
236 |
+ |
237 |
+ local PATCHES=( |
238 |
+ "${WORKDIR}/${PATCHSET}" |
239 |
+ "${FILESDIR}"/${PN}-3.10.3-libressl.patch |
240 |
+ ) |
241 |
+ |
242 |
+ default |
243 |
+ |
244 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
245 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
246 |
+ |
247 |
+ # force correct number of jobs |
248 |
+ # https://bugs.gentoo.org/737660 |
249 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
250 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
251 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
252 |
+ |
253 |
+ eautoreconf |
254 |
+} |
255 |
+ |
256 |
+src_configure() { |
257 |
+ local disable |
258 |
+ # disable automagic bluetooth headers detection |
259 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
260 |
+ use gdbm || disable+=" gdbm" |
261 |
+ use ncurses || disable+=" _curses _curses_panel" |
262 |
+ use readline || disable+=" readline" |
263 |
+ use sqlite || disable+=" _sqlite3" |
264 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
265 |
+ use tk || disable+=" _tkinter" |
266 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
267 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
268 |
+ |
269 |
+ if ! use xml; then |
270 |
+ ewarn "You have configured Python without XML support." |
271 |
+ ewarn "This is NOT a recommended configuration as you" |
272 |
+ ewarn "may face problems parsing any XML documents." |
273 |
+ fi |
274 |
+ |
275 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
276 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
277 |
+ fi |
278 |
+ |
279 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
280 |
+ append-flags -fwrapv |
281 |
+ fi |
282 |
+ |
283 |
+ filter-flags -malign-double |
284 |
+ |
285 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
286 |
+ if is-flagq -O3; then |
287 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
288 |
+ use hardened && replace-flags -O3 -O2 |
289 |
+ fi |
290 |
+ |
291 |
+ # https://bugs.gentoo.org/700012 |
292 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
293 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
294 |
+ fi |
295 |
+ |
296 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
297 |
+ tc-export CXX |
298 |
+ |
299 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
300 |
+ use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
301 |
+ |
302 |
+ local dbmliborder |
303 |
+ if use gdbm; then |
304 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
305 |
+ fi |
306 |
+ |
307 |
+ if use pgo; then |
308 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
309 |
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network" |
310 |
+ |
311 |
+ # All of these seem to occasionally hang for PGO inconsistently |
312 |
+ # They'll even hang here but be fine in src_test sometimes. |
313 |
+ # bug #828535 (and related: bug #788022) |
314 |
+ PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc" |
315 |
+ |
316 |
+ if has_version "app-arch/rpm" ; then |
317 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
318 |
+ PROFILE_TASK+=" -x test_distutils" |
319 |
+ fi |
320 |
+ fi |
321 |
+ |
322 |
+ local myeconfargs=( |
323 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
324 |
+ # Python on glibc upgrade, remove it proactively to give |
325 |
+ # a chance for users rebuilding python before glibc |
326 |
+ ac_cv_header_stropts_h=no |
327 |
+ |
328 |
+ --enable-shared |
329 |
+ --without-static-libpython |
330 |
+ --enable-ipv6 |
331 |
+ --infodir='${prefix}/share/info' |
332 |
+ --mandir='${prefix}/share/man' |
333 |
+ --with-computed-gotos |
334 |
+ --with-dbmliborder="${dbmliborder}" |
335 |
+ --with-libc= |
336 |
+ --enable-loadable-sqlite-extensions |
337 |
+ --without-ensurepip |
338 |
+ --with-system-expat |
339 |
+ --with-system-ffi |
340 |
+ |
341 |
+ $(use_with lto) |
342 |
+ $(use_enable pgo optimizations) |
343 |
+ $(use_with readline readline "$(usex libedit editline readline)") |
344 |
+ ) |
345 |
+ |
346 |
+ # disable implicit optimization/debugging flags |
347 |
+ local -x OPT= |
348 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
349 |
+ # propagated to sysconfig for built extensions |
350 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
351 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
352 |
+ local -x CFLAGS= LDFLAGS= |
353 |
+ |
354 |
+ econf "${myeconfargs[@]}" |
355 |
+ |
356 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
357 |
+ eerror "configure has detected that the sem_open function is broken." |
358 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
359 |
+ die "Broken sem_open function (bug 496328)" |
360 |
+ fi |
361 |
+} |
362 |
+ |
363 |
+src_compile() { |
364 |
+ # Ensure sed works as expected |
365 |
+ # https://bugs.gentoo.org/594768 |
366 |
+ local -x LC_ALL=C |
367 |
+ # Prevent using distutils bundled by setuptools. |
368 |
+ # https://bugs.gentoo.org/823728 |
369 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
370 |
+ |
371 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
372 |
+ # end up writing bytecode & violating sandbox. |
373 |
+ # bug #831897 |
374 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
375 |
+ |
376 |
+ if use pgo ; then |
377 |
+ # bug 660358 |
378 |
+ local -x COLUMNS=80 |
379 |
+ local -x PYTHONDONTWRITEBYTECODE= |
380 |
+ |
381 |
+ addpredict /usr/lib/python3.10/site-packages |
382 |
+ fi |
383 |
+ |
384 |
+ # also need to clear the flags explicitly here or they end up |
385 |
+ # in _sysconfigdata* |
386 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
387 |
+ |
388 |
+ # Restore saved value from above. |
389 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
390 |
+ |
391 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
392 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
393 |
+ pax-mark E python |
394 |
+ else |
395 |
+ pax-mark m python |
396 |
+ fi |
397 |
+} |
398 |
+ |
399 |
+src_test() { |
400 |
+ # Tests will not work when cross compiling. |
401 |
+ if tc-is-cross-compiler; then |
402 |
+ elog "Disabling tests due to crosscompiling." |
403 |
+ return |
404 |
+ fi |
405 |
+ |
406 |
+ # Skip failing tests. |
407 |
+ local skipped_tests="gdb" |
408 |
+ |
409 |
+ if use sparc ; then |
410 |
+ # bug #788022 |
411 |
+ skipped_tests+=" multiprocessing_fork" |
412 |
+ skipped_tests+=" multiprocessing_forkserver" |
413 |
+ fi |
414 |
+ |
415 |
+ for test in ${skipped_tests}; do |
416 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
417 |
+ done |
418 |
+ |
419 |
+ # bug 660358 |
420 |
+ local -x COLUMNS=80 |
421 |
+ local -x PYTHONDONTWRITEBYTECODE= |
422 |
+ # workaround https://bugs.gentoo.org/775416 |
423 |
+ addwrite /usr/lib/python3.10/site-packages |
424 |
+ |
425 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
426 |
+ |
427 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
428 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
429 |
+ local result=$? |
430 |
+ |
431 |
+ for test in ${skipped_tests}; do |
432 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
433 |
+ done |
434 |
+ |
435 |
+ elog "The following tests have been skipped:" |
436 |
+ for test in ${skipped_tests}; do |
437 |
+ elog "test_${test}.py" |
438 |
+ done |
439 |
+ |
440 |
+ elog "If you would like to run them, you may:" |
441 |
+ elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" |
442 |
+ elog "and run the tests separately." |
443 |
+ |
444 |
+ if [[ ${result} -ne 0 ]]; then |
445 |
+ die "emake test failed" |
446 |
+ fi |
447 |
+} |
448 |
+ |
449 |
+src_install() { |
450 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
451 |
+ |
452 |
+ emake DESTDIR="${D}" altinstall |
453 |
+ |
454 |
+ # Fix collisions between different slots of Python. |
455 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
456 |
+ |
457 |
+ # Cheap hack to get version with ABIFLAGS |
458 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
459 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
460 |
+ # Replace python3.X with a symlink to python3.Xm |
461 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
462 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
463 |
+ # Create python3.X-config symlink |
464 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
465 |
+ # Create python-3.5m.pc symlink |
466 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
467 |
+ fi |
468 |
+ |
469 |
+ # python seems to get rebuilt in src_install (bug 569908) |
470 |
+ # Work around it for now. |
471 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
472 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
473 |
+ else |
474 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
475 |
+ fi |
476 |
+ |
477 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
478 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
479 |
+ |
480 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
481 |
+ |
482 |
+ if use examples; then |
483 |
+ docinto examples |
484 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
485 |
+ dodoc -r Tools |
486 |
+ fi |
487 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
488 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
489 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
490 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
491 |
+ |
492 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
493 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
494 |
+ sed \ |
495 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
496 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
497 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
498 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
499 |
+ |
500 |
+ local -x EPYTHON=python${PYVER} |
501 |
+ # if not using a cross-compiler, use the fresh binary |
502 |
+ if ! tc-is-cross-compiler; then |
503 |
+ local -x PYTHON=./python |
504 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
505 |
+ else |
506 |
+ local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} |
507 |
+ fi |
508 |
+ |
509 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
510 |
+ python_domodule epython.py |
511 |
+ |
512 |
+ # python-exec wrapping support |
513 |
+ local pymajor=${PYVER%.*} |
514 |
+ local scriptdir=${D}$(python_get_scriptdir) |
515 |
+ mkdir -p "${scriptdir}" || die |
516 |
+ # python and pythonX |
517 |
+ ln -s "../../../bin/${abiver}" \ |
518 |
+ "${scriptdir}/python${pymajor}" || die |
519 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
520 |
+ # python-config and pythonX-config |
521 |
+ # note: we need to create a wrapper rather than symlinking it due |
522 |
+ # to some random dirname(argv[0]) magic performed by python-config |
523 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
524 |
+ #!/bin/sh |
525 |
+ exec "${abiver}-config" "\${@}" |
526 |
+ EOF |
527 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
528 |
+ ln -s "python${pymajor}-config" \ |
529 |
+ "${scriptdir}/python-config" || die |
530 |
+ # 2to3, pydoc |
531 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
532 |
+ "${scriptdir}/2to3" || die |
533 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
534 |
+ "${scriptdir}/pydoc" || die |
535 |
+ # idle |
536 |
+ if use tk; then |
537 |
+ ln -s "../../../bin/idle${PYVER}" \ |
538 |
+ "${scriptdir}/idle" || die |
539 |
+ fi |
540 |
+} |
541 |
|
542 |
diff --git a/dev-lang/python/python-3.10.4.ebuild b/dev-lang/python/python-3.10.4.ebuild |
543 |
new file mode 100644 |
544 |
index 0000000..8288304 |
545 |
--- /dev/null |
546 |
+++ b/dev-lang/python/python-3.10.4.ebuild |
547 |
@@ -0,0 +1,410 @@ |
548 |
+# Copyright 1999-2022 Gentoo Authors |
549 |
+# Distributed under the terms of the GNU General Public License v2 |
550 |
+ |
551 |
+EAPI="7" |
552 |
+WANT_LIBTOOL="none" |
553 |
+ |
554 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ |
555 |
+ python-utils-r1 toolchain-funcs verify-sig |
556 |
+ |
557 |
+MY_PV=${PV/_rc/rc} |
558 |
+MY_P="Python-${MY_PV%_p*}" |
559 |
+PYVER=$(ver_cut 1-2) |
560 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
561 |
+ |
562 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
563 |
+HOMEPAGE="https://www.python.org/" |
564 |
+SRC_URI=" |
565 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
566 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
567 |
+ verify-sig? ( |
568 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
569 |
+ ) |
570 |
+" |
571 |
+S="${WORKDIR}/${MY_P}" |
572 |
+ |
573 |
+LICENSE="PSF-2" |
574 |
+SLOT="${PYVER}" |
575 |
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" |
576 |
+IUSE="bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" |
577 |
+RESTRICT="!test? ( test )" |
578 |
+ |
579 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
580 |
+# If you need to apply a patch which requires python for bootstrapping, please |
581 |
+# run the bootstrap code on your dev box and include the results in the |
582 |
+# patchset. See bug 447752. |
583 |
+ |
584 |
+RDEPEND=" |
585 |
+ app-arch/bzip2:= |
586 |
+ app-arch/xz-utils:= |
587 |
+ dev-lang/python-exec[python_targets_python3_10(-)] |
588 |
+ dev-libs/libffi:= |
589 |
+ sys-apps/util-linux:= |
590 |
+ >=sys-libs/zlib-1.1.3:= |
591 |
+ virtual/libcrypt:= |
592 |
+ virtual/libintl |
593 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
594 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
595 |
+ readline? ( |
596 |
+ !libedit? ( >=sys-libs/readline-4.1:= ) |
597 |
+ libedit? ( dev-libs/libedit:= ) |
598 |
+ ) |
599 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
600 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
601 |
+ tk? ( |
602 |
+ >=dev-lang/tcl-8.0:= |
603 |
+ >=dev-lang/tk-8.0:= |
604 |
+ dev-tcltk/blt:= |
605 |
+ dev-tcltk/tix |
606 |
+ ) |
607 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
608 |
+ !!<sys-apps/sandbox-2.21 |
609 |
+" |
610 |
+# bluetooth requires headers from bluez |
611 |
+DEPEND=" |
612 |
+ ${RDEPEND} |
613 |
+ bluetooth? ( net-wireless/bluez ) |
614 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
615 |
+" |
616 |
+# autoconf-archive needed to eautoreconf |
617 |
+BDEPEND=" |
618 |
+ sys-devel/autoconf-archive |
619 |
+ virtual/awk |
620 |
+ virtual/pkgconfig |
621 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
622 |
+ !sys-devel/gcc[libffi(-)] |
623 |
+" |
624 |
+RDEPEND+=" |
625 |
+ build? ( app-misc/mime-types ) |
626 |
+" |
627 |
+ |
628 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
629 |
+ |
630 |
+# large file tests involve a 2.5G file being copied (duplicated) |
631 |
+CHECKREQS_DISK_BUILD=5500M |
632 |
+ |
633 |
+pkg_pretend() { |
634 |
+ use test && check-reqs_pkg_pretend |
635 |
+} |
636 |
+ |
637 |
+pkg_setup() { |
638 |
+ use test && check-reqs_pkg_setup |
639 |
+} |
640 |
+ |
641 |
+src_unpack() { |
642 |
+ if use verify-sig; then |
643 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
644 |
+ fi |
645 |
+ default |
646 |
+} |
647 |
+ |
648 |
+src_prepare() { |
649 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
650 |
+ rm -fr Modules/expat || die |
651 |
+ rm -fr Modules/_ctypes/libffi* || die |
652 |
+ rm -fr Modules/zlib || die |
653 |
+ |
654 |
+ local PATCHES=( |
655 |
+ "${WORKDIR}/${PATCHSET}" |
656 |
+ "${FILESDIR}"/${PN}-3.10.3-libressl.patch |
657 |
+ ) |
658 |
+ |
659 |
+ default |
660 |
+ |
661 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
662 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
663 |
+ |
664 |
+ # force correct number of jobs |
665 |
+ # https://bugs.gentoo.org/737660 |
666 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
667 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
668 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
669 |
+ |
670 |
+ eautoreconf |
671 |
+} |
672 |
+ |
673 |
+src_configure() { |
674 |
+ local disable |
675 |
+ # disable automagic bluetooth headers detection |
676 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
677 |
+ use gdbm || disable+=" gdbm" |
678 |
+ use ncurses || disable+=" _curses _curses_panel" |
679 |
+ use readline || disable+=" readline" |
680 |
+ use sqlite || disable+=" _sqlite3" |
681 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
682 |
+ use tk || disable+=" _tkinter" |
683 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
684 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
685 |
+ |
686 |
+ if ! use xml; then |
687 |
+ ewarn "You have configured Python without XML support." |
688 |
+ ewarn "This is NOT a recommended configuration as you" |
689 |
+ ewarn "may face problems parsing any XML documents." |
690 |
+ fi |
691 |
+ |
692 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
693 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
694 |
+ fi |
695 |
+ |
696 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
697 |
+ append-flags -fwrapv |
698 |
+ fi |
699 |
+ |
700 |
+ filter-flags -malign-double |
701 |
+ |
702 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
703 |
+ if is-flagq -O3; then |
704 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
705 |
+ use hardened && replace-flags -O3 -O2 |
706 |
+ fi |
707 |
+ |
708 |
+ # https://bugs.gentoo.org/700012 |
709 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
710 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
711 |
+ fi |
712 |
+ |
713 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
714 |
+ tc-export CXX |
715 |
+ |
716 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
717 |
+ use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
718 |
+ |
719 |
+ local dbmliborder |
720 |
+ if use gdbm; then |
721 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
722 |
+ fi |
723 |
+ |
724 |
+ if use pgo; then |
725 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
726 |
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network" |
727 |
+ |
728 |
+ # All of these seem to occasionally hang for PGO inconsistently |
729 |
+ # They'll even hang here but be fine in src_test sometimes. |
730 |
+ # bug #828535 (and related: bug #788022) |
731 |
+ PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc" |
732 |
+ |
733 |
+ if has_version "app-arch/rpm" ; then |
734 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
735 |
+ PROFILE_TASK+=" -x test_distutils" |
736 |
+ fi |
737 |
+ fi |
738 |
+ |
739 |
+ local myeconfargs=( |
740 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
741 |
+ # Python on glibc upgrade, remove it proactively to give |
742 |
+ # a chance for users rebuilding python before glibc |
743 |
+ ac_cv_header_stropts_h=no |
744 |
+ |
745 |
+ --enable-shared |
746 |
+ --without-static-libpython |
747 |
+ --enable-ipv6 |
748 |
+ --infodir='${prefix}/share/info' |
749 |
+ --mandir='${prefix}/share/man' |
750 |
+ --with-computed-gotos |
751 |
+ --with-dbmliborder="${dbmliborder}" |
752 |
+ --with-libc= |
753 |
+ --enable-loadable-sqlite-extensions |
754 |
+ --without-ensurepip |
755 |
+ --with-system-expat |
756 |
+ --with-system-ffi |
757 |
+ |
758 |
+ $(use_with lto) |
759 |
+ $(use_enable pgo optimizations) |
760 |
+ $(use_with readline readline "$(usex libedit editline readline)") |
761 |
+ ) |
762 |
+ |
763 |
+ # disable implicit optimization/debugging flags |
764 |
+ local -x OPT= |
765 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
766 |
+ # propagated to sysconfig for built extensions |
767 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
768 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
769 |
+ local -x CFLAGS= LDFLAGS= |
770 |
+ |
771 |
+ econf "${myeconfargs[@]}" |
772 |
+ |
773 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
774 |
+ eerror "configure has detected that the sem_open function is broken." |
775 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
776 |
+ die "Broken sem_open function (bug 496328)" |
777 |
+ fi |
778 |
+} |
779 |
+ |
780 |
+src_compile() { |
781 |
+ # Ensure sed works as expected |
782 |
+ # https://bugs.gentoo.org/594768 |
783 |
+ local -x LC_ALL=C |
784 |
+ # Prevent using distutils bundled by setuptools. |
785 |
+ # https://bugs.gentoo.org/823728 |
786 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
787 |
+ |
788 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
789 |
+ # end up writing bytecode & violating sandbox. |
790 |
+ # bug #831897 |
791 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
792 |
+ |
793 |
+ if use pgo ; then |
794 |
+ # bug 660358 |
795 |
+ local -x COLUMNS=80 |
796 |
+ local -x PYTHONDONTWRITEBYTECODE= |
797 |
+ |
798 |
+ addpredict /usr/lib/python3.10/site-packages |
799 |
+ fi |
800 |
+ |
801 |
+ # also need to clear the flags explicitly here or they end up |
802 |
+ # in _sysconfigdata* |
803 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
804 |
+ |
805 |
+ # Restore saved value from above. |
806 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
807 |
+ |
808 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
809 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
810 |
+ pax-mark E python |
811 |
+ else |
812 |
+ pax-mark m python |
813 |
+ fi |
814 |
+} |
815 |
+ |
816 |
+src_test() { |
817 |
+ # Tests will not work when cross compiling. |
818 |
+ if tc-is-cross-compiler; then |
819 |
+ elog "Disabling tests due to crosscompiling." |
820 |
+ return |
821 |
+ fi |
822 |
+ |
823 |
+ # Skip failing tests. |
824 |
+ local skipped_tests="gdb" |
825 |
+ |
826 |
+ if use sparc ; then |
827 |
+ # bug #788022 |
828 |
+ skipped_tests+=" multiprocessing_fork" |
829 |
+ skipped_tests+=" multiprocessing_forkserver" |
830 |
+ fi |
831 |
+ |
832 |
+ for test in ${skipped_tests}; do |
833 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
834 |
+ done |
835 |
+ |
836 |
+ # bug 660358 |
837 |
+ local -x COLUMNS=80 |
838 |
+ local -x PYTHONDONTWRITEBYTECODE= |
839 |
+ # workaround https://bugs.gentoo.org/775416 |
840 |
+ addwrite /usr/lib/python3.10/site-packages |
841 |
+ |
842 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
843 |
+ |
844 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
845 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
846 |
+ local result=$? |
847 |
+ |
848 |
+ for test in ${skipped_tests}; do |
849 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
850 |
+ done |
851 |
+ |
852 |
+ elog "The following tests have been skipped:" |
853 |
+ for test in ${skipped_tests}; do |
854 |
+ elog "test_${test}.py" |
855 |
+ done |
856 |
+ |
857 |
+ elog "If you would like to run them, you may:" |
858 |
+ elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" |
859 |
+ elog "and run the tests separately." |
860 |
+ |
861 |
+ if [[ ${result} -ne 0 ]]; then |
862 |
+ die "emake test failed" |
863 |
+ fi |
864 |
+} |
865 |
+ |
866 |
+src_install() { |
867 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
868 |
+ |
869 |
+ emake DESTDIR="${D}" altinstall |
870 |
+ |
871 |
+ # Fix collisions between different slots of Python. |
872 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
873 |
+ |
874 |
+ # Cheap hack to get version with ABIFLAGS |
875 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
876 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
877 |
+ # Replace python3.X with a symlink to python3.Xm |
878 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
879 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
880 |
+ # Create python3.X-config symlink |
881 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
882 |
+ # Create python-3.5m.pc symlink |
883 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
884 |
+ fi |
885 |
+ |
886 |
+ # python seems to get rebuilt in src_install (bug 569908) |
887 |
+ # Work around it for now. |
888 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
889 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
890 |
+ else |
891 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
892 |
+ fi |
893 |
+ |
894 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
895 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
896 |
+ |
897 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
898 |
+ |
899 |
+ if use examples; then |
900 |
+ docinto examples |
901 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
902 |
+ dodoc -r Tools |
903 |
+ fi |
904 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
905 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
906 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
907 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
908 |
+ |
909 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
910 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
911 |
+ sed \ |
912 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
913 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
914 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
915 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
916 |
+ |
917 |
+ local -x EPYTHON=python${PYVER} |
918 |
+ # if not using a cross-compiler, use the fresh binary |
919 |
+ if ! tc-is-cross-compiler; then |
920 |
+ local -x PYTHON=./python |
921 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
922 |
+ else |
923 |
+ local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} |
924 |
+ fi |
925 |
+ |
926 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
927 |
+ python_domodule epython.py |
928 |
+ |
929 |
+ # python-exec wrapping support |
930 |
+ local pymajor=${PYVER%.*} |
931 |
+ local scriptdir=${D}$(python_get_scriptdir) |
932 |
+ mkdir -p "${scriptdir}" || die |
933 |
+ # python and pythonX |
934 |
+ ln -s "../../../bin/${abiver}" \ |
935 |
+ "${scriptdir}/python${pymajor}" || die |
936 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
937 |
+ # python-config and pythonX-config |
938 |
+ # note: we need to create a wrapper rather than symlinking it due |
939 |
+ # to some random dirname(argv[0]) magic performed by python-config |
940 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
941 |
+ #!/bin/sh |
942 |
+ exec "${abiver}-config" "\${@}" |
943 |
+ EOF |
944 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
945 |
+ ln -s "python${pymajor}-config" \ |
946 |
+ "${scriptdir}/python-config" || die |
947 |
+ # 2to3, pydoc |
948 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
949 |
+ "${scriptdir}/2to3" || die |
950 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
951 |
+ "${scriptdir}/pydoc" || die |
952 |
+ # idle |
953 |
+ if use tk; then |
954 |
+ ln -s "../../../bin/idle${PYVER}" \ |
955 |
+ "${scriptdir}/idle" || die |
956 |
+ fi |
957 |
+} |
958 |
|
959 |
diff --git a/dev-lang/python/python-3.9.12.ebuild b/dev-lang/python/python-3.9.12.ebuild |
960 |
new file mode 100644 |
961 |
index 0000000..d49fc15 |
962 |
--- /dev/null |
963 |
+++ b/dev-lang/python/python-3.9.12.ebuild |
964 |
@@ -0,0 +1,406 @@ |
965 |
+# Copyright 1999-2022 Gentoo Authors |
966 |
+# Distributed under the terms of the GNU General Public License v2 |
967 |
+ |
968 |
+EAPI="7" |
969 |
+WANT_LIBTOOL="none" |
970 |
+ |
971 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ |
972 |
+ python-utils-r1 toolchain-funcs verify-sig |
973 |
+ |
974 |
+MY_PV=${PV/_rc/rc} |
975 |
+MY_P="Python-${MY_PV%_p*}" |
976 |
+PYVER=$(ver_cut 1-2) |
977 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
978 |
+ |
979 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
980 |
+HOMEPAGE="https://www.python.org/" |
981 |
+SRC_URI=" |
982 |
+ https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz |
983 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
984 |
+ verify-sig? ( |
985 |
+ https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc |
986 |
+ ) |
987 |
+" |
988 |
+S="${WORKDIR}/${MY_P}" |
989 |
+ |
990 |
+LICENSE="PSF-2" |
991 |
+SLOT="${PYVER}" |
992 |
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc ~x86" |
993 |
+IUSE="bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" |
994 |
+RESTRICT="!test? ( test )" |
995 |
+ |
996 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
997 |
+# If you need to apply a patch which requires python for bootstrapping, please |
998 |
+# run the bootstrap code on your dev box and include the results in the |
999 |
+# patchset. See bug 447752. |
1000 |
+ |
1001 |
+RDEPEND=" |
1002 |
+ app-arch/bzip2:= |
1003 |
+ app-arch/xz-utils:= |
1004 |
+ dev-lang/python-exec[python_targets_python3_9(-)] |
1005 |
+ dev-libs/libffi:= |
1006 |
+ sys-apps/util-linux:= |
1007 |
+ >=sys-libs/zlib-1.1.3:= |
1008 |
+ virtual/libcrypt:= |
1009 |
+ virtual/libintl |
1010 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
1011 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
1012 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
1013 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
1014 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
1015 |
+ tk? ( |
1016 |
+ >=dev-lang/tcl-8.0:= |
1017 |
+ >=dev-lang/tk-8.0:= |
1018 |
+ dev-tcltk/blt:= |
1019 |
+ dev-tcltk/tix |
1020 |
+ ) |
1021 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
1022 |
+" |
1023 |
+# bluetooth requires headers from bluez |
1024 |
+DEPEND=" |
1025 |
+ ${RDEPEND} |
1026 |
+ bluetooth? ( net-wireless/bluez ) |
1027 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
1028 |
+" |
1029 |
+BDEPEND=" |
1030 |
+ virtual/awk |
1031 |
+ virtual/pkgconfig |
1032 |
+ sys-devel/autoconf-archive |
1033 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
1034 |
+ !sys-devel/gcc[libffi(-)] |
1035 |
+" |
1036 |
+RDEPEND+=" |
1037 |
+ !build? ( app-misc/mime-types ) |
1038 |
+" |
1039 |
+ |
1040 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
1041 |
+ |
1042 |
+# large file tests involve a 2.5G file being copied (duplicated) |
1043 |
+CHECKREQS_DISK_BUILD=5500M |
1044 |
+ |
1045 |
+pkg_pretend() { |
1046 |
+ use test && check-reqs_pkg_pretend |
1047 |
+} |
1048 |
+ |
1049 |
+pkg_setup() { |
1050 |
+ use test && check-reqs_pkg_setup |
1051 |
+} |
1052 |
+ |
1053 |
+src_unpack() { |
1054 |
+ if use verify-sig; then |
1055 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
1056 |
+ fi |
1057 |
+ default |
1058 |
+} |
1059 |
+ |
1060 |
+src_prepare() { |
1061 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
1062 |
+ rm -fr Modules/expat || die |
1063 |
+ rm -fr Modules/_ctypes/libffi* || die |
1064 |
+ rm -fr Modules/zlib || die |
1065 |
+ |
1066 |
+ rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die |
1067 |
+ |
1068 |
+ local PATCHES=( |
1069 |
+ "${WORKDIR}/${PATCHSET}" |
1070 |
+ "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch |
1071 |
+ ) |
1072 |
+ |
1073 |
+ default |
1074 |
+ |
1075 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
1076 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
1077 |
+ |
1078 |
+ # force correct number of jobs |
1079 |
+ # https://bugs.gentoo.org/737660 |
1080 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
1081 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
1082 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
1083 |
+ |
1084 |
+ eautoreconf |
1085 |
+} |
1086 |
+ |
1087 |
+src_configure() { |
1088 |
+ local disable |
1089 |
+ # disable automagic bluetooth headers detection |
1090 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
1091 |
+ use gdbm || disable+=" gdbm" |
1092 |
+ use ncurses || disable+=" _curses _curses_panel" |
1093 |
+ use readline || disable+=" readline" |
1094 |
+ use sqlite || disable+=" _sqlite3" |
1095 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
1096 |
+ use tk || disable+=" _tkinter" |
1097 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1098 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
1099 |
+ |
1100 |
+ if ! use xml; then |
1101 |
+ ewarn "You have configured Python without XML support." |
1102 |
+ ewarn "This is NOT a recommended configuration as you" |
1103 |
+ ewarn "may face problems parsing any XML documents." |
1104 |
+ fi |
1105 |
+ |
1106 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
1107 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
1108 |
+ fi |
1109 |
+ |
1110 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
1111 |
+ append-flags -fwrapv |
1112 |
+ fi |
1113 |
+ |
1114 |
+ filter-flags -malign-double |
1115 |
+ |
1116 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
1117 |
+ if is-flagq -O3; then |
1118 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
1119 |
+ use hardened && replace-flags -O3 -O2 |
1120 |
+ fi |
1121 |
+ |
1122 |
+ # https://bugs.gentoo.org/700012 |
1123 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
1124 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
1125 |
+ fi |
1126 |
+ |
1127 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
1128 |
+ tc-export CXX |
1129 |
+ |
1130 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
1131 |
+ use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
1132 |
+ |
1133 |
+ local dbmliborder |
1134 |
+ if use gdbm; then |
1135 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
1136 |
+ fi |
1137 |
+ |
1138 |
+ if use pgo; then |
1139 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
1140 |
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network" |
1141 |
+ |
1142 |
+ # All of these seem to occasionally hang for PGO inconsistently |
1143 |
+ # They'll even hang here but be fine in src_test sometimes. |
1144 |
+ # bug #828535 (and related: bug #788022) |
1145 |
+ PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc" |
1146 |
+ |
1147 |
+ if has_version "app-arch/rpm" ; then |
1148 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
1149 |
+ PROFILE_TASK+=" -x test_distutils" |
1150 |
+ fi |
1151 |
+ fi |
1152 |
+ |
1153 |
+ local myeconfargs=( |
1154 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
1155 |
+ # Python on glibc upgrade, remove it proactively to give |
1156 |
+ # a chance for users rebuilding python before glibc |
1157 |
+ ac_cv_header_stropts_h=no |
1158 |
+ |
1159 |
+ --enable-shared |
1160 |
+ --enable-ipv6 |
1161 |
+ --infodir='${prefix}/share/info' |
1162 |
+ --mandir='${prefix}/share/man' |
1163 |
+ --with-computed-gotos |
1164 |
+ --with-dbmliborder="${dbmliborder}" |
1165 |
+ --with-libc= |
1166 |
+ --enable-loadable-sqlite-extensions |
1167 |
+ --without-ensurepip |
1168 |
+ --with-system-expat |
1169 |
+ --with-system-ffi |
1170 |
+ |
1171 |
+ $(use_with lto) |
1172 |
+ $(use_enable pgo optimizations) |
1173 |
+ ) |
1174 |
+ |
1175 |
+ # disable implicit optimization/debugging flags |
1176 |
+ local -x OPT= |
1177 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
1178 |
+ # propagated to sysconfig for built extensions |
1179 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
1180 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
1181 |
+ local -x CFLAGS= LDFLAGS= |
1182 |
+ |
1183 |
+ econf "${myeconfargs[@]}" |
1184 |
+ |
1185 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
1186 |
+ eerror "configure has detected that the sem_open function is broken." |
1187 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
1188 |
+ die "Broken sem_open function (bug 496328)" |
1189 |
+ fi |
1190 |
+} |
1191 |
+ |
1192 |
+src_compile() { |
1193 |
+ # Ensure sed works as expected |
1194 |
+ # https://bugs.gentoo.org/594768 |
1195 |
+ local -x LC_ALL=C |
1196 |
+ # Prevent using distutils bundled by setuptools. |
1197 |
+ # https://bugs.gentoo.org/823728 |
1198 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
1199 |
+ |
1200 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
1201 |
+ # end up writing bytecode & violating sandbox. |
1202 |
+ # bug #831897 |
1203 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
1204 |
+ |
1205 |
+ if use pgo ; then |
1206 |
+ # bug 660358 |
1207 |
+ local -x COLUMNS=80 |
1208 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1209 |
+ |
1210 |
+ addpredict /usr/lib/python3.9/site-packages |
1211 |
+ fi |
1212 |
+ |
1213 |
+ # also need to clear the flags explicitly here or they end up |
1214 |
+ # in _sysconfigdata* |
1215 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
1216 |
+ |
1217 |
+ # Restore saved value from above. |
1218 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
1219 |
+ |
1220 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
1221 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1222 |
+ pax-mark E python |
1223 |
+ else |
1224 |
+ pax-mark m python |
1225 |
+ fi |
1226 |
+} |
1227 |
+ |
1228 |
+src_test() { |
1229 |
+ # Tests will not work when cross compiling. |
1230 |
+ if tc-is-cross-compiler; then |
1231 |
+ elog "Disabling tests due to crosscompiling." |
1232 |
+ return |
1233 |
+ fi |
1234 |
+ |
1235 |
+ # Skip failing tests. |
1236 |
+ local skipped_tests="gdb" |
1237 |
+ |
1238 |
+ if use sparc ; then |
1239 |
+ # bug #788022 |
1240 |
+ skipped_tests+=" multiprocessing_fork" |
1241 |
+ skipped_tests+=" multiprocessing_forkserver" |
1242 |
+ fi |
1243 |
+ |
1244 |
+ for test in ${skipped_tests}; do |
1245 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
1246 |
+ done |
1247 |
+ |
1248 |
+ # bug 660358 |
1249 |
+ local -x COLUMNS=80 |
1250 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1251 |
+ |
1252 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
1253 |
+ |
1254 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
1255 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
1256 |
+ local result=$? |
1257 |
+ |
1258 |
+ for test in ${skipped_tests}; do |
1259 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
1260 |
+ done |
1261 |
+ |
1262 |
+ elog "The following tests have been skipped:" |
1263 |
+ for test in ${skipped_tests}; do |
1264 |
+ elog "test_${test}.py" |
1265 |
+ done |
1266 |
+ |
1267 |
+ elog "If you would like to run them, you may:" |
1268 |
+ elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" |
1269 |
+ elog "and run the tests separately." |
1270 |
+ |
1271 |
+ if [[ ${result} -ne 0 ]]; then |
1272 |
+ die "emake test failed" |
1273 |
+ fi |
1274 |
+} |
1275 |
+ |
1276 |
+src_install() { |
1277 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
1278 |
+ |
1279 |
+ emake DESTDIR="${D}" altinstall |
1280 |
+ |
1281 |
+ # Remove static library |
1282 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
1283 |
+ |
1284 |
+ # Fix collisions between different slots of Python. |
1285 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
1286 |
+ |
1287 |
+ # Cheap hack to get version with ABIFLAGS |
1288 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
1289 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
1290 |
+ # Replace python3.X with a symlink to python3.Xm |
1291 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
1292 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
1293 |
+ # Create python3.X-config symlink |
1294 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1295 |
+ # Create python-3.5m.pc symlink |
1296 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1297 |
+ fi |
1298 |
+ |
1299 |
+ # python seems to get rebuilt in src_install (bug 569908) |
1300 |
+ # Work around it for now. |
1301 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1302 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
1303 |
+ else |
1304 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
1305 |
+ fi |
1306 |
+ |
1307 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
1308 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
1309 |
+ |
1310 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
1311 |
+ |
1312 |
+ if use examples; then |
1313 |
+ docinto examples |
1314 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
1315 |
+ dodoc -r Tools |
1316 |
+ fi |
1317 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1318 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
1319 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
1320 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
1321 |
+ |
1322 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
1323 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
1324 |
+ sed \ |
1325 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1326 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
1327 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
1328 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1329 |
+ |
1330 |
+ local -x EPYTHON=python${PYVER} |
1331 |
+ # if not using a cross-compiler, use the fresh binary |
1332 |
+ if ! tc-is-cross-compiler; then |
1333 |
+ local -x PYTHON=./python |
1334 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
1335 |
+ else |
1336 |
+ local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} |
1337 |
+ fi |
1338 |
+ |
1339 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
1340 |
+ python_domodule epython.py |
1341 |
+ |
1342 |
+ # python-exec wrapping support |
1343 |
+ local pymajor=${PYVER%.*} |
1344 |
+ local scriptdir=${D}$(python_get_scriptdir) |
1345 |
+ mkdir -p "${scriptdir}" || die |
1346 |
+ # python and pythonX |
1347 |
+ ln -s "../../../bin/${abiver}" \ |
1348 |
+ "${scriptdir}/python${pymajor}" || die |
1349 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
1350 |
+ # python-config and pythonX-config |
1351 |
+ # note: we need to create a wrapper rather than symlinking it due |
1352 |
+ # to some random dirname(argv[0]) magic performed by python-config |
1353 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
1354 |
+ #!/bin/sh |
1355 |
+ exec "${abiver}-config" "\${@}" |
1356 |
+ EOF |
1357 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
1358 |
+ ln -s "python${pymajor}-config" \ |
1359 |
+ "${scriptdir}/python-config" || die |
1360 |
+ # 2to3, pydoc |
1361 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
1362 |
+ "${scriptdir}/2to3" || die |
1363 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
1364 |
+ "${scriptdir}/pydoc" || die |
1365 |
+ # idle |
1366 |
+ if use tk; then |
1367 |
+ ln -s "../../../bin/idle${PYVER}" \ |
1368 |
+ "${scriptdir}/idle" || die |
1369 |
+ fi |
1370 |
+} |