1 |
commit: 574c6647dd98130272a39f61f84017242911b7b1 |
2 |
Author: orbea <orbea <AT> riseup <DOT> net> |
3 |
AuthorDate: Wed Sep 21 17:03:16 2022 +0000 |
4 |
Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com> |
5 |
CommitDate: Fri Sep 23 15:59:51 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=574c6647 |
7 |
|
8 |
dev-lang/python: Add new versions |
9 |
|
10 |
Signed-off-by: orbea <orbea <AT> riseup.net> |
11 |
Closes: https://github.com/gentoo/libressl/pull/453 |
12 |
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com> |
13 |
|
14 |
dev-lang/python/Manifest | 4 + |
15 |
dev-lang/python/metadata.xml | 42 +++- |
16 |
dev-lang/python/python-3.10.6_p3.ebuild | 408 ++++++++++++++++++++++++++++++++ |
17 |
dev-lang/python/python-3.10.6_p4.ebuild | 408 ++++++++++++++++++++++++++++++++ |
18 |
dev-lang/python/python-3.9.13_p5.ebuild | 404 +++++++++++++++++++++++++++++++ |
19 |
dev-lang/python/python-3.9.13_p6.ebuild | 404 +++++++++++++++++++++++++++++++ |
20 |
6 files changed, 1659 insertions(+), 11 deletions(-) |
21 |
|
22 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
23 |
index 50d403c..9a78d10 100644 |
24 |
--- a/dev-lang/python/Manifest |
25 |
+++ b/dev-lang/python/Manifest |
26 |
@@ -3,4 +3,8 @@ DIST Python-3.10.6.tar.xz.asc 833 BLAKE2B ea6546c01a4fbfe3f3e56b2f980da53f0692d9 |
27 |
DIST Python-3.9.13.tar.xz 19754368 BLAKE2B 4f583f66c28b791e19cd6d79695fe9eb815fd333542be22aec8bd73d1f4d3f17f2c4e9de198e7b16c1ca6362a613a8a02fb965c7dc7db3e510fd31de15ba2d19 SHA512 e9664e7f908092df11236b22465d217531d6f0378e88d889108d19fe77f28f46ffb629b8733f84b41409e255367321893a2b1bd64518930d9d8cae5d1b774d23 |
28 |
DIST Python-3.9.13.tar.xz.asc 833 BLAKE2B db01c01be9d56cd15f9ab4a9e2cfa800faf4ebecb92b01c133865d3b3134bc910258a33b766306c3d01f98e35bbf9c03c7cba697760b7095999cbd63ed6c276c SHA512 9367afe8ec32195adbb64fa32eb9e3881cfdbbb38efcb5e0804a15486232aecbc81ed20a8ffed652f06a881744f3efd2c2df3cc652d70671c94d6668a17a391e |
29 |
DIST python-gentoo-patches-3.10.6_p2.tar.xz 12040 BLAKE2B 75c93fab19137a966b3775308bc20142f4d3648bbb9364e82c4eaffae93beda54011192881c52b85d2e2493a06cfe2a90f50675609908c3d5ebdb0103fe41644 SHA512 7e451a8a18a62592c2cd7b2db71065b77256960f43e172a0d7856b22b69138dcb1552f53b39bec14585a761cfe729c81613551c1b616fe1ec8d2b59856b11453 |
30 |
+DIST python-gentoo-patches-3.10.6_p3.tar.xz 26712 BLAKE2B 701a7a4da1a09f71dee8fdf924a45e030b8ae93e469a2789b28b904d2fd6b011589fb940eb0c262e8b19005af523a2f66075d053fb60892d6ebd473159fce718 SHA512 ed43ba18735ddf72c434bfe905894d156a144a77f9fb8266378d384e840b376c6220859d8d1af83f304293368bf1dd45881316c1797ba25d618a064daaacab17 |
31 |
+DIST python-gentoo-patches-3.10.6_p4.tar.xz 28612 BLAKE2B 197ef33c3086cb9efaf09868145826e2889f61d6fb207df8b60ac6cfc4ca637c8a87fd10afa2d8a7a47ae81bcf0ae589085c694523e1ca6f85acdc4e517b7d07 SHA512 8bd0aa8f7a775d12914d542dbb04c7b555055228002dd826a815255d4a35392e09c44d560cc5da7df1feae98e2f73e8fbf476e2811ae5269f91120c11cbb6291 |
32 |
DIST python-gentoo-patches-3.9.13_p4.tar.xz 22072 BLAKE2B a0e084eff35d075d2255b139d0db114d282cb6c9c0c2ea51a8ecb7f5f1dc8096d6578ae5f804b7583a2b7842152b5723ad802ca816d46813c40aaa756118afc8 SHA512 cdf8d43fd5263c4956be234f36c0767215ab2495705d4f2a060b32ecbfbe159e618e31693b0538a1b970f7b27ebe4953063f585930d074dcaf59f2f61486e6b6 |
33 |
+DIST python-gentoo-patches-3.9.13_p5.tar.xz 35660 BLAKE2B be3fe3a4db5e94a06c6bcb36eee71fd7e33cf27a4f3a259e5d0bd332b4765e77d5753247ddf5bbc3cbf10647f55e1897c943a7149afc76a9649d634fbfaff682 SHA512 7d6f1d215df0e50b1b4837f62c160d3262c6d9a29dad1a3f82590f5f84245defcd9b3de500ec78f01a3308275647b7a5e72a16c7425aec1edb841ba079100e1b |
34 |
+DIST python-gentoo-patches-3.9.13_p6.tar.xz 37508 BLAKE2B 6d55aec9ae139cbe6d35b84335174d5fba5784bf52eb665e2d3a27693a2abb843bce1f190c92bfd173359c3782cae06a6b3520932b08aec678332928c5a27277 SHA512 1b1dec45d959849bf72b0646329e8cf74301e0f5373d6e2dbefb63d60fdddbe9fc33abda7d2312af8c52feadf3bacd04b627626d876acecc8984d3192a2d029d |
35 |
|
36 |
diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml |
37 |
index 54c2aa9..d3ddcf0 100644 |
38 |
--- a/dev-lang/python/metadata.xml |
39 |
+++ b/dev-lang/python/metadata.xml |
40 |
@@ -1,15 +1,35 @@ |
41 |
<?xml version="1.0" encoding="UTF-8"?> |
42 |
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
43 |
<pkgmetadata> |
44 |
-<maintainer type="project"> |
45 |
- <email>python@g.o</email> |
46 |
- <name>Python</name> |
47 |
-</maintainer> |
48 |
-<use> |
49 |
- <flag name="bluetooth">Build Bluetooth protocol support in socket module</flag> |
50 |
- <flag name="libedit">Link readline extension against <pkg>dev-libs/libedit</pkg> instead of <pkg>sys-libs/readline</pkg>.</flag> |
51 |
- <flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag> |
52 |
- <flag name="lto">Optimize the build using Link Time Optimization (LTO)</flag> |
53 |
- <flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag> |
54 |
-</use> |
55 |
+ <maintainer type="project"> |
56 |
+ <email>python@g.o</email> |
57 |
+ <name>Python</name> |
58 |
+ </maintainer> |
59 |
+ <use> |
60 |
+ <flag name="bluetooth"> |
61 |
+ Build Bluetooth protocol support in socket module |
62 |
+ </flag> |
63 |
+ <flag name="ensurepip"> |
64 |
+ Install the ensurepip module that uses bundled wheels |
65 |
+ to bootstrap pip and setuptools (if disabled, it will |
66 |
+ be only possible to use venv `--without-pip`) |
67 |
+ </flag> |
68 |
+ <flag name="libedit"> |
69 |
+ Link readline extension against <pkg>dev-libs/libedit</pkg> |
70 |
+ instead of <pkg>sys-libs/readline</pkg> |
71 |
+ </flag> |
72 |
+ <flag name="pgo"> |
73 |
+ Optimize the build using Profile Guided Optimization (PGO) |
74 |
+ </flag> |
75 |
+ <flag name="lto"> |
76 |
+ Optimize the build using Link Time Optimization (LTO) |
77 |
+ </flag> |
78 |
+ <flag name="wininst"> |
79 |
+ Install Windows executables required to create an executable |
80 |
+ installer for MS Windows |
81 |
+ </flag> |
82 |
+ </use> |
83 |
+ <upstream> |
84 |
+ <remote-id type="github">python/cpython</remote-id> |
85 |
+ </upstream> |
86 |
</pkgmetadata> |
87 |
|
88 |
diff --git a/dev-lang/python/python-3.10.6_p3.ebuild b/dev-lang/python/python-3.10.6_p3.ebuild |
89 |
new file mode 100644 |
90 |
index 0000000..ed334f0 |
91 |
--- /dev/null |
92 |
+++ b/dev-lang/python/python-3.10.6_p3.ebuild |
93 |
@@ -0,0 +1,408 @@ |
94 |
+# Copyright 1999-2022 Gentoo Authors |
95 |
+# Distributed under the terms of the GNU General Public License v2 |
96 |
+ |
97 |
+EAPI="7" |
98 |
+WANT_LIBTOOL="none" |
99 |
+ |
100 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils |
101 |
+inherit python-utils-r1 toolchain-funcs verify-sig |
102 |
+ |
103 |
+MY_PV=${PV/_rc/rc} |
104 |
+MY_P="Python-${MY_PV%_p*}" |
105 |
+PYVER=$(ver_cut 1-2) |
106 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
107 |
+ |
108 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
109 |
+HOMEPAGE=" |
110 |
+ https://www.python.org/ |
111 |
+ https://github.com/python/cpython/ |
112 |
+" |
113 |
+SRC_URI=" |
114 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
115 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
116 |
+ verify-sig? ( |
117 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
118 |
+ ) |
119 |
+" |
120 |
+S="${WORKDIR}/${MY_P}" |
121 |
+ |
122 |
+LICENSE="PSF-2" |
123 |
+SLOT="${PYVER}" |
124 |
+KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
125 |
+IUSE=" |
126 |
+ bluetooth build +ensurepip examples gdbm hardened libedit lto |
127 |
+ +ncurses pgo +readline +sqlite +ssl test tk +xml |
128 |
+" |
129 |
+RESTRICT="!test? ( test )" |
130 |
+ |
131 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
132 |
+# If you need to apply a patch which requires python for bootstrapping, please |
133 |
+# run the bootstrap code on your dev box and include the results in the |
134 |
+# patchset. See bug 447752. |
135 |
+ |
136 |
+RDEPEND=" |
137 |
+ app-arch/bzip2:= |
138 |
+ app-arch/xz-utils:= |
139 |
+ dev-lang/python-exec[python_targets_python3_10(-)] |
140 |
+ dev-libs/libffi:= |
141 |
+ sys-apps/util-linux:= |
142 |
+ >=sys-libs/zlib-1.1.3:= |
143 |
+ virtual/libcrypt:= |
144 |
+ virtual/libintl |
145 |
+ ensurepip? ( dev-python/ensurepip-wheels ) |
146 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
147 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
148 |
+ readline? ( |
149 |
+ !libedit? ( >=sys-libs/readline-4.1:= ) |
150 |
+ libedit? ( dev-libs/libedit:= ) |
151 |
+ ) |
152 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
153 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
154 |
+ tk? ( |
155 |
+ >=dev-lang/tcl-8.0:= |
156 |
+ >=dev-lang/tk-8.0:= |
157 |
+ dev-tcltk/blt:= |
158 |
+ dev-tcltk/tix |
159 |
+ ) |
160 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
161 |
+ !!<sys-apps/sandbox-2.21 |
162 |
+" |
163 |
+# bluetooth requires headers from bluez |
164 |
+DEPEND=" |
165 |
+ ${RDEPEND} |
166 |
+ bluetooth? ( net-wireless/bluez ) |
167 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
168 |
+" |
169 |
+# autoconf-archive needed to eautoreconf |
170 |
+BDEPEND=" |
171 |
+ sys-devel/autoconf-archive |
172 |
+ virtual/awk |
173 |
+ virtual/pkgconfig |
174 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
175 |
+" |
176 |
+RDEPEND+=" |
177 |
+ !build? ( app-misc/mime-types ) |
178 |
+" |
179 |
+ |
180 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
181 |
+ |
182 |
+# large file tests involve a 2.5G file being copied (duplicated) |
183 |
+CHECKREQS_DISK_BUILD=5500M |
184 |
+ |
185 |
+QA_PKGCONFIG_VERSION=${PYVER} |
186 |
+ |
187 |
+pkg_pretend() { |
188 |
+ use test && check-reqs_pkg_pretend |
189 |
+} |
190 |
+ |
191 |
+pkg_setup() { |
192 |
+ use test && check-reqs_pkg_setup |
193 |
+} |
194 |
+ |
195 |
+src_unpack() { |
196 |
+ if use verify-sig; then |
197 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
198 |
+ fi |
199 |
+ default |
200 |
+} |
201 |
+ |
202 |
+src_prepare() { |
203 |
+ # Ensure that internal copies of expat and libffi are not used. |
204 |
+ rm -r Modules/expat || die |
205 |
+ rm -r Modules/_ctypes/libffi* || die |
206 |
+ |
207 |
+ local PATCHES=( |
208 |
+ "${WORKDIR}/${PATCHSET}" |
209 |
+ "${FILESDIR}"/${PN}-3.10.3-libressl.patch |
210 |
+ ) |
211 |
+ |
212 |
+ default |
213 |
+ |
214 |
+ # https://bugs.gentoo.org/850151 |
215 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die |
216 |
+ |
217 |
+ # force the correct number of jobs |
218 |
+ # https://bugs.gentoo.org/737660 |
219 |
+ local jobs=$(makeopts_jobs) |
220 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
221 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
222 |
+ |
223 |
+ eautoreconf |
224 |
+} |
225 |
+ |
226 |
+src_configure() { |
227 |
+ # disable automagic bluetooth headers detection |
228 |
+ if ! use bluetooth; then |
229 |
+ local -x ac_cv_header_bluetooth_bluetooth_h=no |
230 |
+ fi |
231 |
+ local disable |
232 |
+ use gdbm || disable+=" gdbm" |
233 |
+ use ncurses || disable+=" _curses _curses_panel" |
234 |
+ use readline || disable+=" readline" |
235 |
+ use sqlite || disable+=" _sqlite3" |
236 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
237 |
+ use tk || disable+=" _tkinter" |
238 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
239 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
240 |
+ |
241 |
+ if ! use xml; then |
242 |
+ ewarn "You have configured Python without XML support." |
243 |
+ ewarn "This is NOT a recommended configuration as you" |
244 |
+ ewarn "may face problems parsing any XML documents." |
245 |
+ fi |
246 |
+ |
247 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
248 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
249 |
+ fi |
250 |
+ |
251 |
+ append-flags -fwrapv |
252 |
+ filter-flags -malign-double |
253 |
+ |
254 |
+ # https://bugs.gentoo.org/700012 |
255 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
256 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
257 |
+ fi |
258 |
+ |
259 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
260 |
+ # PKG_CONFIG needed for cross. |
261 |
+ tc-export CXX PKG_CONFIG |
262 |
+ |
263 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
264 |
+ if use ncurses; then |
265 |
+ append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
266 |
+ fi |
267 |
+ |
268 |
+ local dbmliborder= |
269 |
+ if use gdbm; then |
270 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
271 |
+ fi |
272 |
+ |
273 |
+ if use pgo; then |
274 |
+ local profile_task_flags=( |
275 |
+ -m test |
276 |
+ "-j$(makeopts_jobs)" |
277 |
+ --pgo-extended |
278 |
+ -x test_gdb |
279 |
+ -u-network |
280 |
+ |
281 |
+ # All of these seem to occasionally hang for PGO inconsistently |
282 |
+ # They'll even hang here but be fine in src_test sometimes. |
283 |
+ # bug #828535 (and related: bug #788022) |
284 |
+ -x test_asyncio |
285 |
+ -x test_httpservers |
286 |
+ -x test_logging |
287 |
+ -x test_multiprocessing_fork |
288 |
+ -x test_socket |
289 |
+ -x test_xmlrpc |
290 |
+ ) |
291 |
+ |
292 |
+ if has_version "app-arch/rpm" ; then |
293 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
294 |
+ profile_task_flags+=( |
295 |
+ -x test_distutils |
296 |
+ ) |
297 |
+ fi |
298 |
+ local -x PROFILE_TASK="${profile_task_flags[*]}" |
299 |
+ fi |
300 |
+ |
301 |
+ local myeconfargs=( |
302 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
303 |
+ # Python on glibc upgrade, remove it proactively to give |
304 |
+ # a chance for users rebuilding python before glibc |
305 |
+ ac_cv_header_stropts_h=no |
306 |
+ |
307 |
+ --enable-shared |
308 |
+ --without-static-libpython |
309 |
+ --enable-ipv6 |
310 |
+ --infodir='${prefix}/share/info' |
311 |
+ --mandir='${prefix}/share/man' |
312 |
+ --with-computed-gotos |
313 |
+ --with-dbmliborder="${dbmliborder}" |
314 |
+ --with-libc= |
315 |
+ --enable-loadable-sqlite-extensions |
316 |
+ --without-ensurepip |
317 |
+ --with-system-expat |
318 |
+ --with-system-ffi |
319 |
+ --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip |
320 |
+ |
321 |
+ $(use_with lto) |
322 |
+ $(use_enable pgo optimizations) |
323 |
+ $(use_with readline readline "$(usex libedit editline readline)") |
324 |
+ ) |
325 |
+ |
326 |
+ # disable implicit optimization/debugging flags |
327 |
+ local -x OPT= |
328 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
329 |
+ # propagated to sysconfig for built extensions |
330 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
331 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
332 |
+ local -x CFLAGS= LDFLAGS= |
333 |
+ |
334 |
+ econf "${myeconfargs[@]}" |
335 |
+ |
336 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
337 |
+ eerror "configure has detected that the sem_open function is broken." |
338 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
339 |
+ die "Broken sem_open function (bug 496328)" |
340 |
+ fi |
341 |
+ |
342 |
+ # install epython.py as part of stdlib |
343 |
+ echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die |
344 |
+} |
345 |
+ |
346 |
+src_compile() { |
347 |
+ # Ensure sed works as expected |
348 |
+ # https://bugs.gentoo.org/594768 |
349 |
+ local -x LC_ALL=C |
350 |
+ # Prevent using distutils bundled by setuptools. |
351 |
+ # https://bugs.gentoo.org/823728 |
352 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
353 |
+ |
354 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
355 |
+ # end up writing bytecode & violating sandbox. |
356 |
+ # bug #831897 |
357 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
358 |
+ |
359 |
+ if use pgo ; then |
360 |
+ # bug 660358 |
361 |
+ local -x COLUMNS=80 |
362 |
+ local -x PYTHONDONTWRITEBYTECODE= |
363 |
+ |
364 |
+ addpredict /usr/lib/python3.10/site-packages |
365 |
+ fi |
366 |
+ |
367 |
+ # also need to clear the flags explicitly here or they end up |
368 |
+ # in _sysconfigdata* |
369 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
370 |
+ |
371 |
+ # Restore saved value from above. |
372 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
373 |
+ |
374 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
375 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
376 |
+ pax-mark E python |
377 |
+ else |
378 |
+ pax-mark m python |
379 |
+ fi |
380 |
+} |
381 |
+ |
382 |
+src_test() { |
383 |
+ # Tests will not work when cross compiling. |
384 |
+ if tc-is-cross-compiler; then |
385 |
+ elog "Disabling tests due to crosscompiling." |
386 |
+ return |
387 |
+ fi |
388 |
+ |
389 |
+ local test_opts=( |
390 |
+ -u-network |
391 |
+ -j "$(makeopts_jobs)" |
392 |
+ |
393 |
+ # fails |
394 |
+ -x test_gdb |
395 |
+ ) |
396 |
+ |
397 |
+ if use sparc ; then |
398 |
+ # bug #788022 |
399 |
+ test_opts+=( |
400 |
+ -x test_multiprocessing_fork |
401 |
+ -x test_multiprocessing_forkserver |
402 |
+ ) |
403 |
+ fi |
404 |
+ |
405 |
+ # bug 660358 |
406 |
+ local -x COLUMNS=80 |
407 |
+ local -x PYTHONDONTWRITEBYTECODE= |
408 |
+ # workaround https://bugs.gentoo.org/775416 |
409 |
+ addwrite /usr/lib/python3.10/site-packages |
410 |
+ |
411 |
+ emake test EXTRATESTOPTS="${test_opts[*]}" \ |
412 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed" |
413 |
+} |
414 |
+ |
415 |
+src_install() { |
416 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
417 |
+ |
418 |
+ emake DESTDIR="${D}" altinstall |
419 |
+ |
420 |
+ # Fix collisions between different slots of Python. |
421 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
422 |
+ |
423 |
+ # Cheap hack to get version with ABIFLAGS |
424 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
425 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
426 |
+ # Replace python3.X with a symlink to python3.Xm |
427 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
428 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
429 |
+ # Create python3.X-config symlink |
430 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
431 |
+ # Create python-3.5m.pc symlink |
432 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
433 |
+ fi |
434 |
+ |
435 |
+ # python seems to get rebuilt in src_install (bug 569908) |
436 |
+ # Work around it for now. |
437 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
438 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
439 |
+ else |
440 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
441 |
+ fi |
442 |
+ |
443 |
+ rm -r "${libdir}"/ensurepip/_bundled || die |
444 |
+ if ! use ensurepip; then |
445 |
+ rm -r "${libdir}"/ensurepip || die |
446 |
+ fi |
447 |
+ if ! use sqlite; then |
448 |
+ rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
449 |
+ fi |
450 |
+ if ! use tk; then |
451 |
+ rm -r "${ED}/usr/bin/idle${PYVER}" || die |
452 |
+ rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
453 |
+ fi |
454 |
+ |
455 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
456 |
+ |
457 |
+ if use examples; then |
458 |
+ docinto examples |
459 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
460 |
+ dodoc -r Tools |
461 |
+ fi |
462 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
463 |
+ local libname=$( |
464 |
+ printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | |
465 |
+ emake --no-print-directory -s -f - 2>/dev/null |
466 |
+ ) |
467 |
+ newins Tools/gdb/libpython.py "${libname}"-gdb.py |
468 |
+ |
469 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
470 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
471 |
+ sed \ |
472 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
473 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
474 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
475 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
476 |
+ |
477 |
+ # python-exec wrapping support |
478 |
+ local pymajor=${PYVER%.*} |
479 |
+ local EPYTHON=python${PYVER} |
480 |
+ local scriptdir=${D}$(python_get_scriptdir) |
481 |
+ mkdir -p "${scriptdir}" || die |
482 |
+ # python and pythonX |
483 |
+ ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die |
484 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
485 |
+ # python-config and pythonX-config |
486 |
+ # note: we need to create a wrapper rather than symlinking it due |
487 |
+ # to some random dirname(argv[0]) magic performed by python-config |
488 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
489 |
+ #!/bin/sh |
490 |
+ exec "${abiver}-config" "\${@}" |
491 |
+ EOF |
492 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
493 |
+ ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die |
494 |
+ # 2to3, pydoc |
495 |
+ ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die |
496 |
+ ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die |
497 |
+ # idle |
498 |
+ if use tk; then |
499 |
+ ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die |
500 |
+ fi |
501 |
+} |
502 |
|
503 |
diff --git a/dev-lang/python/python-3.10.6_p4.ebuild b/dev-lang/python/python-3.10.6_p4.ebuild |
504 |
new file mode 100644 |
505 |
index 0000000..23c9e9d |
506 |
--- /dev/null |
507 |
+++ b/dev-lang/python/python-3.10.6_p4.ebuild |
508 |
@@ -0,0 +1,408 @@ |
509 |
+# Copyright 1999-2022 Gentoo Authors |
510 |
+# Distributed under the terms of the GNU General Public License v2 |
511 |
+ |
512 |
+EAPI="7" |
513 |
+WANT_LIBTOOL="none" |
514 |
+ |
515 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils |
516 |
+inherit python-utils-r1 toolchain-funcs verify-sig |
517 |
+ |
518 |
+MY_PV=${PV/_rc/rc} |
519 |
+MY_P="Python-${MY_PV%_p*}" |
520 |
+PYVER=$(ver_cut 1-2) |
521 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
522 |
+ |
523 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
524 |
+HOMEPAGE=" |
525 |
+ https://www.python.org/ |
526 |
+ https://github.com/python/cpython/ |
527 |
+" |
528 |
+SRC_URI=" |
529 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
530 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
531 |
+ verify-sig? ( |
532 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
533 |
+ ) |
534 |
+" |
535 |
+S="${WORKDIR}/${MY_P}" |
536 |
+ |
537 |
+LICENSE="PSF-2" |
538 |
+SLOT="${PYVER}" |
539 |
+KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86" |
540 |
+IUSE=" |
541 |
+ bluetooth build +ensurepip examples gdbm hardened libedit lto |
542 |
+ +ncurses pgo +readline +sqlite +ssl test tk +xml |
543 |
+" |
544 |
+RESTRICT="!test? ( test )" |
545 |
+ |
546 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
547 |
+# If you need to apply a patch which requires python for bootstrapping, please |
548 |
+# run the bootstrap code on your dev box and include the results in the |
549 |
+# patchset. See bug 447752. |
550 |
+ |
551 |
+RDEPEND=" |
552 |
+ app-arch/bzip2:= |
553 |
+ app-arch/xz-utils:= |
554 |
+ dev-lang/python-exec[python_targets_python3_10(-)] |
555 |
+ dev-libs/libffi:= |
556 |
+ sys-apps/util-linux:= |
557 |
+ >=sys-libs/zlib-1.1.3:= |
558 |
+ virtual/libcrypt:= |
559 |
+ virtual/libintl |
560 |
+ ensurepip? ( dev-python/ensurepip-wheels ) |
561 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
562 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
563 |
+ readline? ( |
564 |
+ !libedit? ( >=sys-libs/readline-4.1:= ) |
565 |
+ libedit? ( dev-libs/libedit:= ) |
566 |
+ ) |
567 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
568 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
569 |
+ tk? ( |
570 |
+ >=dev-lang/tcl-8.0:= |
571 |
+ >=dev-lang/tk-8.0:= |
572 |
+ dev-tcltk/blt:= |
573 |
+ dev-tcltk/tix |
574 |
+ ) |
575 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
576 |
+ !!<sys-apps/sandbox-2.21 |
577 |
+" |
578 |
+# bluetooth requires headers from bluez |
579 |
+DEPEND=" |
580 |
+ ${RDEPEND} |
581 |
+ bluetooth? ( net-wireless/bluez ) |
582 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
583 |
+" |
584 |
+# autoconf-archive needed to eautoreconf |
585 |
+BDEPEND=" |
586 |
+ sys-devel/autoconf-archive |
587 |
+ virtual/awk |
588 |
+ virtual/pkgconfig |
589 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
590 |
+" |
591 |
+RDEPEND+=" |
592 |
+ !build? ( app-misc/mime-types ) |
593 |
+" |
594 |
+ |
595 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
596 |
+ |
597 |
+# large file tests involve a 2.5G file being copied (duplicated) |
598 |
+CHECKREQS_DISK_BUILD=5500M |
599 |
+ |
600 |
+QA_PKGCONFIG_VERSION=${PYVER} |
601 |
+ |
602 |
+pkg_pretend() { |
603 |
+ use test && check-reqs_pkg_pretend |
604 |
+} |
605 |
+ |
606 |
+pkg_setup() { |
607 |
+ use test && check-reqs_pkg_setup |
608 |
+} |
609 |
+ |
610 |
+src_unpack() { |
611 |
+ if use verify-sig; then |
612 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
613 |
+ fi |
614 |
+ default |
615 |
+} |
616 |
+ |
617 |
+src_prepare() { |
618 |
+ # Ensure that internal copies of expat and libffi are not used. |
619 |
+ rm -r Modules/expat || die |
620 |
+ rm -r Modules/_ctypes/libffi* || die |
621 |
+ |
622 |
+ local PATCHES=( |
623 |
+ "${WORKDIR}/${PATCHSET}" |
624 |
+ "${FILESDIR}"/${PN}-3.10.3-libressl.patch |
625 |
+ ) |
626 |
+ |
627 |
+ default |
628 |
+ |
629 |
+ # https://bugs.gentoo.org/850151 |
630 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die |
631 |
+ |
632 |
+ # force the correct number of jobs |
633 |
+ # https://bugs.gentoo.org/737660 |
634 |
+ local jobs=$(makeopts_jobs) |
635 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
636 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
637 |
+ |
638 |
+ eautoreconf |
639 |
+} |
640 |
+ |
641 |
+src_configure() { |
642 |
+ # disable automagic bluetooth headers detection |
643 |
+ if ! use bluetooth; then |
644 |
+ local -x ac_cv_header_bluetooth_bluetooth_h=no |
645 |
+ fi |
646 |
+ local disable |
647 |
+ use gdbm || disable+=" gdbm" |
648 |
+ use ncurses || disable+=" _curses _curses_panel" |
649 |
+ use readline || disable+=" readline" |
650 |
+ use sqlite || disable+=" _sqlite3" |
651 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
652 |
+ use tk || disable+=" _tkinter" |
653 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
654 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
655 |
+ |
656 |
+ if ! use xml; then |
657 |
+ ewarn "You have configured Python without XML support." |
658 |
+ ewarn "This is NOT a recommended configuration as you" |
659 |
+ ewarn "may face problems parsing any XML documents." |
660 |
+ fi |
661 |
+ |
662 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
663 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
664 |
+ fi |
665 |
+ |
666 |
+ append-flags -fwrapv |
667 |
+ filter-flags -malign-double |
668 |
+ |
669 |
+ # https://bugs.gentoo.org/700012 |
670 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
671 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
672 |
+ fi |
673 |
+ |
674 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
675 |
+ # PKG_CONFIG needed for cross. |
676 |
+ tc-export CXX PKG_CONFIG |
677 |
+ |
678 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
679 |
+ if use ncurses; then |
680 |
+ append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
681 |
+ fi |
682 |
+ |
683 |
+ local dbmliborder= |
684 |
+ if use gdbm; then |
685 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
686 |
+ fi |
687 |
+ |
688 |
+ if use pgo; then |
689 |
+ local profile_task_flags=( |
690 |
+ -m test |
691 |
+ "-j$(makeopts_jobs)" |
692 |
+ --pgo-extended |
693 |
+ -x test_gdb |
694 |
+ -u-network |
695 |
+ |
696 |
+ # All of these seem to occasionally hang for PGO inconsistently |
697 |
+ # They'll even hang here but be fine in src_test sometimes. |
698 |
+ # bug #828535 (and related: bug #788022) |
699 |
+ -x test_asyncio |
700 |
+ -x test_httpservers |
701 |
+ -x test_logging |
702 |
+ -x test_multiprocessing_fork |
703 |
+ -x test_socket |
704 |
+ -x test_xmlrpc |
705 |
+ ) |
706 |
+ |
707 |
+ if has_version "app-arch/rpm" ; then |
708 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
709 |
+ profile_task_flags+=( |
710 |
+ -x test_distutils |
711 |
+ ) |
712 |
+ fi |
713 |
+ local -x PROFILE_TASK="${profile_task_flags[*]}" |
714 |
+ fi |
715 |
+ |
716 |
+ local myeconfargs=( |
717 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
718 |
+ # Python on glibc upgrade, remove it proactively to give |
719 |
+ # a chance for users rebuilding python before glibc |
720 |
+ ac_cv_header_stropts_h=no |
721 |
+ |
722 |
+ --enable-shared |
723 |
+ --without-static-libpython |
724 |
+ --enable-ipv6 |
725 |
+ --infodir='${prefix}/share/info' |
726 |
+ --mandir='${prefix}/share/man' |
727 |
+ --with-computed-gotos |
728 |
+ --with-dbmliborder="${dbmliborder}" |
729 |
+ --with-libc= |
730 |
+ --enable-loadable-sqlite-extensions |
731 |
+ --without-ensurepip |
732 |
+ --with-system-expat |
733 |
+ --with-system-ffi |
734 |
+ --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip |
735 |
+ |
736 |
+ $(use_with lto) |
737 |
+ $(use_enable pgo optimizations) |
738 |
+ $(use_with readline readline "$(usex libedit editline readline)") |
739 |
+ ) |
740 |
+ |
741 |
+ # disable implicit optimization/debugging flags |
742 |
+ local -x OPT= |
743 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
744 |
+ # propagated to sysconfig for built extensions |
745 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
746 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
747 |
+ local -x CFLAGS= LDFLAGS= |
748 |
+ |
749 |
+ econf "${myeconfargs[@]}" |
750 |
+ |
751 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
752 |
+ eerror "configure has detected that the sem_open function is broken." |
753 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
754 |
+ die "Broken sem_open function (bug 496328)" |
755 |
+ fi |
756 |
+ |
757 |
+ # install epython.py as part of stdlib |
758 |
+ echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die |
759 |
+} |
760 |
+ |
761 |
+src_compile() { |
762 |
+ # Ensure sed works as expected |
763 |
+ # https://bugs.gentoo.org/594768 |
764 |
+ local -x LC_ALL=C |
765 |
+ # Prevent using distutils bundled by setuptools. |
766 |
+ # https://bugs.gentoo.org/823728 |
767 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
768 |
+ |
769 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
770 |
+ # end up writing bytecode & violating sandbox. |
771 |
+ # bug #831897 |
772 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
773 |
+ |
774 |
+ if use pgo ; then |
775 |
+ # bug 660358 |
776 |
+ local -x COLUMNS=80 |
777 |
+ local -x PYTHONDONTWRITEBYTECODE= |
778 |
+ |
779 |
+ addpredict /usr/lib/python3.10/site-packages |
780 |
+ fi |
781 |
+ |
782 |
+ # also need to clear the flags explicitly here or they end up |
783 |
+ # in _sysconfigdata* |
784 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
785 |
+ |
786 |
+ # Restore saved value from above. |
787 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
788 |
+ |
789 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
790 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
791 |
+ pax-mark E python |
792 |
+ else |
793 |
+ pax-mark m python |
794 |
+ fi |
795 |
+} |
796 |
+ |
797 |
+src_test() { |
798 |
+ # Tests will not work when cross compiling. |
799 |
+ if tc-is-cross-compiler; then |
800 |
+ elog "Disabling tests due to crosscompiling." |
801 |
+ return |
802 |
+ fi |
803 |
+ |
804 |
+ local test_opts=( |
805 |
+ -u-network |
806 |
+ -j "$(makeopts_jobs)" |
807 |
+ |
808 |
+ # fails |
809 |
+ -x test_gdb |
810 |
+ ) |
811 |
+ |
812 |
+ if use sparc ; then |
813 |
+ # bug #788022 |
814 |
+ test_opts+=( |
815 |
+ -x test_multiprocessing_fork |
816 |
+ -x test_multiprocessing_forkserver |
817 |
+ ) |
818 |
+ fi |
819 |
+ |
820 |
+ # bug 660358 |
821 |
+ local -x COLUMNS=80 |
822 |
+ local -x PYTHONDONTWRITEBYTECODE= |
823 |
+ # workaround https://bugs.gentoo.org/775416 |
824 |
+ addwrite /usr/lib/python3.10/site-packages |
825 |
+ |
826 |
+ emake test EXTRATESTOPTS="${test_opts[*]}" \ |
827 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed" |
828 |
+} |
829 |
+ |
830 |
+src_install() { |
831 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
832 |
+ |
833 |
+ emake DESTDIR="${D}" altinstall |
834 |
+ |
835 |
+ # Fix collisions between different slots of Python. |
836 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
837 |
+ |
838 |
+ # Cheap hack to get version with ABIFLAGS |
839 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
840 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
841 |
+ # Replace python3.X with a symlink to python3.Xm |
842 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
843 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
844 |
+ # Create python3.X-config symlink |
845 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
846 |
+ # Create python-3.5m.pc symlink |
847 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
848 |
+ fi |
849 |
+ |
850 |
+ # python seems to get rebuilt in src_install (bug 569908) |
851 |
+ # Work around it for now. |
852 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
853 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
854 |
+ else |
855 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
856 |
+ fi |
857 |
+ |
858 |
+ rm -r "${libdir}"/ensurepip/_bundled || die |
859 |
+ if ! use ensurepip; then |
860 |
+ rm -r "${libdir}"/ensurepip || die |
861 |
+ fi |
862 |
+ if ! use sqlite; then |
863 |
+ rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
864 |
+ fi |
865 |
+ if ! use tk; then |
866 |
+ rm -r "${ED}/usr/bin/idle${PYVER}" || die |
867 |
+ rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
868 |
+ fi |
869 |
+ |
870 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
871 |
+ |
872 |
+ if use examples; then |
873 |
+ docinto examples |
874 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
875 |
+ dodoc -r Tools |
876 |
+ fi |
877 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
878 |
+ local libname=$( |
879 |
+ printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | |
880 |
+ emake --no-print-directory -s -f - 2>/dev/null |
881 |
+ ) |
882 |
+ newins Tools/gdb/libpython.py "${libname}"-gdb.py |
883 |
+ |
884 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
885 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
886 |
+ sed \ |
887 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
888 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
889 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
890 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
891 |
+ |
892 |
+ # python-exec wrapping support |
893 |
+ local pymajor=${PYVER%.*} |
894 |
+ local EPYTHON=python${PYVER} |
895 |
+ local scriptdir=${D}$(python_get_scriptdir) |
896 |
+ mkdir -p "${scriptdir}" || die |
897 |
+ # python and pythonX |
898 |
+ ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die |
899 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
900 |
+ # python-config and pythonX-config |
901 |
+ # note: we need to create a wrapper rather than symlinking it due |
902 |
+ # to some random dirname(argv[0]) magic performed by python-config |
903 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
904 |
+ #!/bin/sh |
905 |
+ exec "${abiver}-config" "\${@}" |
906 |
+ EOF |
907 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
908 |
+ ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die |
909 |
+ # 2to3, pydoc |
910 |
+ ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die |
911 |
+ ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die |
912 |
+ # idle |
913 |
+ if use tk; then |
914 |
+ ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die |
915 |
+ fi |
916 |
+} |
917 |
|
918 |
diff --git a/dev-lang/python/python-3.9.13_p5.ebuild b/dev-lang/python/python-3.9.13_p5.ebuild |
919 |
new file mode 100644 |
920 |
index 0000000..1bbe432 |
921 |
--- /dev/null |
922 |
+++ b/dev-lang/python/python-3.9.13_p5.ebuild |
923 |
@@ -0,0 +1,404 @@ |
924 |
+# Copyright 1999-2022 Gentoo Authors |
925 |
+# Distributed under the terms of the GNU General Public License v2 |
926 |
+ |
927 |
+EAPI="7" |
928 |
+WANT_LIBTOOL="none" |
929 |
+ |
930 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils |
931 |
+inherit python-utils-r1 toolchain-funcs verify-sig |
932 |
+ |
933 |
+MY_PV=${PV/_rc/rc} |
934 |
+MY_P="Python-${MY_PV%_p*}" |
935 |
+PYVER=$(ver_cut 1-2) |
936 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
937 |
+ |
938 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
939 |
+HOMEPAGE=" |
940 |
+ https://www.python.org/ |
941 |
+ https://github.com/python/cpython/ |
942 |
+" |
943 |
+SRC_URI=" |
944 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
945 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
946 |
+ verify-sig? ( |
947 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
948 |
+ ) |
949 |
+" |
950 |
+S="${WORKDIR}/${MY_P}" |
951 |
+ |
952 |
+LICENSE="PSF-2" |
953 |
+SLOT="${PYVER}" |
954 |
+KEYWORDS="~alpha ~amd64 ~arm arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
955 |
+IUSE=" |
956 |
+ bluetooth build +ensurepip examples gdbm hardened lto +ncurses pgo |
957 |
+ +readline +sqlite +ssl test tk +xml |
958 |
+" |
959 |
+RESTRICT="!test? ( test )" |
960 |
+ |
961 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
962 |
+# If you need to apply a patch which requires python for bootstrapping, please |
963 |
+# run the bootstrap code on your dev box and include the results in the |
964 |
+# patchset. See bug 447752. |
965 |
+ |
966 |
+RDEPEND=" |
967 |
+ app-arch/bzip2:= |
968 |
+ app-arch/xz-utils:= |
969 |
+ dev-lang/python-exec[python_targets_python3_9(-)] |
970 |
+ dev-libs/libffi:= |
971 |
+ sys-apps/util-linux:= |
972 |
+ >=sys-libs/zlib-1.1.3:= |
973 |
+ virtual/libcrypt:= |
974 |
+ virtual/libintl |
975 |
+ ensurepip? ( dev-python/ensurepip-wheels ) |
976 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
977 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
978 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
979 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
980 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
981 |
+ tk? ( |
982 |
+ >=dev-lang/tcl-8.0:= |
983 |
+ >=dev-lang/tk-8.0:= |
984 |
+ dev-tcltk/blt:= |
985 |
+ dev-tcltk/tix |
986 |
+ ) |
987 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
988 |
+" |
989 |
+# bluetooth requires headers from bluez |
990 |
+DEPEND=" |
991 |
+ ${RDEPEND} |
992 |
+ bluetooth? ( net-wireless/bluez ) |
993 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
994 |
+" |
995 |
+# autoconf-archive needed to eautoreconf |
996 |
+BDEPEND=" |
997 |
+ sys-devel/autoconf-archive |
998 |
+ virtual/awk |
999 |
+ virtual/pkgconfig |
1000 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
1001 |
+" |
1002 |
+RDEPEND+=" |
1003 |
+ !build? ( app-misc/mime-types ) |
1004 |
+" |
1005 |
+ |
1006 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
1007 |
+ |
1008 |
+# large file tests involve a 2.5G file being copied (duplicated) |
1009 |
+CHECKREQS_DISK_BUILD=5500M |
1010 |
+ |
1011 |
+QA_PKGCONFIG_VERSION=${PYVER} |
1012 |
+ |
1013 |
+pkg_pretend() { |
1014 |
+ use test && check-reqs_pkg_pretend |
1015 |
+} |
1016 |
+ |
1017 |
+pkg_setup() { |
1018 |
+ use test && check-reqs_pkg_setup |
1019 |
+} |
1020 |
+ |
1021 |
+src_unpack() { |
1022 |
+ if use verify-sig; then |
1023 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
1024 |
+ fi |
1025 |
+ default |
1026 |
+} |
1027 |
+ |
1028 |
+src_prepare() { |
1029 |
+ # Ensure that internal copies of expat and libffi are not used. |
1030 |
+ rm -r Modules/expat || die |
1031 |
+ rm -r Modules/_ctypes/libffi* || die |
1032 |
+ rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die |
1033 |
+ |
1034 |
+ local PATCHES=( |
1035 |
+ "${WORKDIR}/${PATCHSET}" |
1036 |
+ "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch |
1037 |
+ ) |
1038 |
+ |
1039 |
+ default |
1040 |
+ |
1041 |
+ # https://bugs.gentoo.org/850151 |
1042 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die |
1043 |
+ |
1044 |
+ # force the correct number of jobs |
1045 |
+ # https://bugs.gentoo.org/737660 |
1046 |
+ local jobs=$(makeopts_jobs) |
1047 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
1048 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
1049 |
+ |
1050 |
+ eautoreconf |
1051 |
+} |
1052 |
+ |
1053 |
+src_configure() { |
1054 |
+ # disable automagic bluetooth headers detection |
1055 |
+ if ! use bluetooth; then |
1056 |
+ local -x ac_cv_header_bluetooth_bluetooth_h=no |
1057 |
+ fi |
1058 |
+ local disable |
1059 |
+ use gdbm || disable+=" gdbm" |
1060 |
+ use ncurses || disable+=" _curses _curses_panel" |
1061 |
+ use readline || disable+=" readline" |
1062 |
+ use sqlite || disable+=" _sqlite3" |
1063 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
1064 |
+ use tk || disable+=" _tkinter" |
1065 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1066 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
1067 |
+ |
1068 |
+ if ! use xml; then |
1069 |
+ ewarn "You have configured Python without XML support." |
1070 |
+ ewarn "This is NOT a recommended configuration as you" |
1071 |
+ ewarn "may face problems parsing any XML documents." |
1072 |
+ fi |
1073 |
+ |
1074 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
1075 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
1076 |
+ fi |
1077 |
+ |
1078 |
+ append-flags -fwrapv |
1079 |
+ filter-flags -malign-double |
1080 |
+ |
1081 |
+ # https://bugs.gentoo.org/700012 |
1082 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
1083 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
1084 |
+ fi |
1085 |
+ |
1086 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
1087 |
+ # PKG_CONFIG needed for cross. |
1088 |
+ tc-export CXX PKG_CONFIG |
1089 |
+ |
1090 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
1091 |
+ if use ncurses; then |
1092 |
+ append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
1093 |
+ fi |
1094 |
+ |
1095 |
+ local dbmliborder= |
1096 |
+ if use gdbm; then |
1097 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
1098 |
+ fi |
1099 |
+ |
1100 |
+ if use pgo; then |
1101 |
+ local profile_task_flags=( |
1102 |
+ -m test |
1103 |
+ "-j$(makeopts_jobs)" |
1104 |
+ --pgo-extended |
1105 |
+ -x test_gdb |
1106 |
+ -u-network |
1107 |
+ |
1108 |
+ # All of these seem to occasionally hang for PGO inconsistently |
1109 |
+ # They'll even hang here but be fine in src_test sometimes. |
1110 |
+ # bug #828535 (and related: bug #788022) |
1111 |
+ -x test_asyncio |
1112 |
+ -x test_httpservers |
1113 |
+ -x test_logging |
1114 |
+ -x test_multiprocessing_fork |
1115 |
+ -x test_socket |
1116 |
+ -x test_xmlrpc |
1117 |
+ ) |
1118 |
+ |
1119 |
+ if has_version "app-arch/rpm" ; then |
1120 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
1121 |
+ profile_task_flags+=( |
1122 |
+ -x test_distutils |
1123 |
+ ) |
1124 |
+ fi |
1125 |
+ local -x PROFILE_TASK="${profile_task_flags[*]}" |
1126 |
+ fi |
1127 |
+ |
1128 |
+ local myeconfargs=( |
1129 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
1130 |
+ # Python on glibc upgrade, remove it proactively to give |
1131 |
+ # a chance for users rebuilding python before glibc |
1132 |
+ ac_cv_header_stropts_h=no |
1133 |
+ |
1134 |
+ --enable-shared |
1135 |
+ --enable-ipv6 |
1136 |
+ --infodir='${prefix}/share/info' |
1137 |
+ --mandir='${prefix}/share/man' |
1138 |
+ --with-computed-gotos |
1139 |
+ --with-dbmliborder="${dbmliborder}" |
1140 |
+ --with-libc= |
1141 |
+ --enable-loadable-sqlite-extensions |
1142 |
+ --without-ensurepip |
1143 |
+ --with-system-expat |
1144 |
+ --with-system-ffi |
1145 |
+ --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip |
1146 |
+ |
1147 |
+ $(use_with lto) |
1148 |
+ $(use_enable pgo optimizations) |
1149 |
+ ) |
1150 |
+ |
1151 |
+ # disable implicit optimization/debugging flags |
1152 |
+ local -x OPT= |
1153 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
1154 |
+ # propagated to sysconfig for built extensions |
1155 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
1156 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
1157 |
+ local -x CFLAGS= LDFLAGS= |
1158 |
+ |
1159 |
+ econf "${myeconfargs[@]}" |
1160 |
+ |
1161 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
1162 |
+ eerror "configure has detected that the sem_open function is broken." |
1163 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
1164 |
+ die "Broken sem_open function (bug 496328)" |
1165 |
+ fi |
1166 |
+ |
1167 |
+ # install epython.py as part of stdlib |
1168 |
+ echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die |
1169 |
+} |
1170 |
+ |
1171 |
+src_compile() { |
1172 |
+ # Ensure sed works as expected |
1173 |
+ # https://bugs.gentoo.org/594768 |
1174 |
+ local -x LC_ALL=C |
1175 |
+ # Prevent using distutils bundled by setuptools. |
1176 |
+ # https://bugs.gentoo.org/823728 |
1177 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
1178 |
+ |
1179 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
1180 |
+ # end up writing bytecode & violating sandbox. |
1181 |
+ # bug #831897 |
1182 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
1183 |
+ |
1184 |
+ if use pgo ; then |
1185 |
+ # bug 660358 |
1186 |
+ local -x COLUMNS=80 |
1187 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1188 |
+ |
1189 |
+ addpredict /usr/lib/python3.9/site-packages |
1190 |
+ fi |
1191 |
+ |
1192 |
+ # also need to clear the flags explicitly here or they end up |
1193 |
+ # in _sysconfigdata* |
1194 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
1195 |
+ |
1196 |
+ # Restore saved value from above. |
1197 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
1198 |
+ |
1199 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
1200 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1201 |
+ pax-mark E python |
1202 |
+ else |
1203 |
+ pax-mark m python |
1204 |
+ fi |
1205 |
+} |
1206 |
+ |
1207 |
+src_test() { |
1208 |
+ # Tests will not work when cross compiling. |
1209 |
+ if tc-is-cross-compiler; then |
1210 |
+ elog "Disabling tests due to crosscompiling." |
1211 |
+ return |
1212 |
+ fi |
1213 |
+ |
1214 |
+ local test_opts=( |
1215 |
+ -u-network |
1216 |
+ -j "$(makeopts_jobs)" |
1217 |
+ |
1218 |
+ # fails |
1219 |
+ -x test_gdb |
1220 |
+ ) |
1221 |
+ |
1222 |
+ if use sparc ; then |
1223 |
+ # bug #788022 |
1224 |
+ test_opts+=( |
1225 |
+ -x test_multiprocessing_fork |
1226 |
+ -x test_multiprocessing_forkserver |
1227 |
+ ) |
1228 |
+ fi |
1229 |
+ |
1230 |
+ # bug 660358 |
1231 |
+ local -x COLUMNS=80 |
1232 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1233 |
+ |
1234 |
+ emake test EXTRATESTOPTS="${test_opts[*]}" \ |
1235 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed" |
1236 |
+} |
1237 |
+ |
1238 |
+src_install() { |
1239 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
1240 |
+ |
1241 |
+ emake DESTDIR="${D}" altinstall |
1242 |
+ |
1243 |
+ # Remove static library |
1244 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
1245 |
+ |
1246 |
+ # Fix collisions between different slots of Python. |
1247 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
1248 |
+ |
1249 |
+ # Cheap hack to get version with ABIFLAGS |
1250 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
1251 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
1252 |
+ # Replace python3.X with a symlink to python3.Xm |
1253 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
1254 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
1255 |
+ # Create python3.X-config symlink |
1256 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1257 |
+ # Create python-3.5m.pc symlink |
1258 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1259 |
+ fi |
1260 |
+ |
1261 |
+ # python seems to get rebuilt in src_install (bug 569908) |
1262 |
+ # Work around it for now. |
1263 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1264 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
1265 |
+ else |
1266 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
1267 |
+ fi |
1268 |
+ |
1269 |
+ rm -r "${libdir}"/ensurepip/_bundled || die |
1270 |
+ if ! use ensurepip; then |
1271 |
+ rm -r "${libdir}"/ensurepip || die |
1272 |
+ fi |
1273 |
+ if ! use sqlite; then |
1274 |
+ rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
1275 |
+ fi |
1276 |
+ if ! use tk; then |
1277 |
+ rm -r "${ED}/usr/bin/idle${PYVER}" || die |
1278 |
+ rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
1279 |
+ fi |
1280 |
+ |
1281 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
1282 |
+ |
1283 |
+ if use examples; then |
1284 |
+ docinto examples |
1285 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
1286 |
+ dodoc -r Tools |
1287 |
+ fi |
1288 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1289 |
+ local libname=$( |
1290 |
+ printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | |
1291 |
+ emake --no-print-directory -s -f - 2>/dev/null |
1292 |
+ ) |
1293 |
+ newins Tools/gdb/libpython.py "${libname}"-gdb.py |
1294 |
+ |
1295 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
1296 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
1297 |
+ sed \ |
1298 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1299 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
1300 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
1301 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1302 |
+ |
1303 |
+ # python-exec wrapping support |
1304 |
+ local pymajor=${PYVER%.*} |
1305 |
+ local EPYTHON=python${PYVER} |
1306 |
+ local scriptdir=${D}$(python_get_scriptdir) |
1307 |
+ mkdir -p "${scriptdir}" || die |
1308 |
+ # python and pythonX |
1309 |
+ ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die |
1310 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
1311 |
+ # python-config and pythonX-config |
1312 |
+ # note: we need to create a wrapper rather than symlinking it due |
1313 |
+ # to some random dirname(argv[0]) magic performed by python-config |
1314 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
1315 |
+ #!/bin/sh |
1316 |
+ exec "${abiver}-config" "\${@}" |
1317 |
+ EOF |
1318 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
1319 |
+ ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die |
1320 |
+ # 2to3, pydoc |
1321 |
+ ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die |
1322 |
+ ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die |
1323 |
+ # idle |
1324 |
+ if use tk; then |
1325 |
+ ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die |
1326 |
+ fi |
1327 |
+} |
1328 |
|
1329 |
diff --git a/dev-lang/python/python-3.9.13_p6.ebuild b/dev-lang/python/python-3.9.13_p6.ebuild |
1330 |
new file mode 100644 |
1331 |
index 0000000..e67d70d |
1332 |
--- /dev/null |
1333 |
+++ b/dev-lang/python/python-3.9.13_p6.ebuild |
1334 |
@@ -0,0 +1,404 @@ |
1335 |
+# Copyright 1999-2022 Gentoo Authors |
1336 |
+# Distributed under the terms of the GNU General Public License v2 |
1337 |
+ |
1338 |
+EAPI="7" |
1339 |
+WANT_LIBTOOL="none" |
1340 |
+ |
1341 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils |
1342 |
+inherit python-utils-r1 toolchain-funcs verify-sig |
1343 |
+ |
1344 |
+MY_PV=${PV/_rc/rc} |
1345 |
+MY_P="Python-${MY_PV%_p*}" |
1346 |
+PYVER=$(ver_cut 1-2) |
1347 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
1348 |
+ |
1349 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
1350 |
+HOMEPAGE=" |
1351 |
+ https://www.python.org/ |
1352 |
+ https://github.com/python/cpython/ |
1353 |
+" |
1354 |
+SRC_URI=" |
1355 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
1356 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
1357 |
+ verify-sig? ( |
1358 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
1359 |
+ ) |
1360 |
+" |
1361 |
+S="${WORKDIR}/${MY_P}" |
1362 |
+ |
1363 |
+LICENSE="PSF-2" |
1364 |
+SLOT="${PYVER}" |
1365 |
+KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 sparc x86" |
1366 |
+IUSE=" |
1367 |
+ bluetooth build +ensurepip examples gdbm hardened lto +ncurses pgo |
1368 |
+ +readline +sqlite +ssl test tk +xml |
1369 |
+" |
1370 |
+RESTRICT="!test? ( test )" |
1371 |
+ |
1372 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
1373 |
+# If you need to apply a patch which requires python for bootstrapping, please |
1374 |
+# run the bootstrap code on your dev box and include the results in the |
1375 |
+# patchset. See bug 447752. |
1376 |
+ |
1377 |
+RDEPEND=" |
1378 |
+ app-arch/bzip2:= |
1379 |
+ app-arch/xz-utils:= |
1380 |
+ dev-lang/python-exec[python_targets_python3_9(-)] |
1381 |
+ dev-libs/libffi:= |
1382 |
+ sys-apps/util-linux:= |
1383 |
+ >=sys-libs/zlib-1.1.3:= |
1384 |
+ virtual/libcrypt:= |
1385 |
+ virtual/libintl |
1386 |
+ ensurepip? ( dev-python/ensurepip-wheels ) |
1387 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
1388 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
1389 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
1390 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
1391 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
1392 |
+ tk? ( |
1393 |
+ >=dev-lang/tcl-8.0:= |
1394 |
+ >=dev-lang/tk-8.0:= |
1395 |
+ dev-tcltk/blt:= |
1396 |
+ dev-tcltk/tix |
1397 |
+ ) |
1398 |
+ xml? ( >=dev-libs/expat-2.1:= ) |
1399 |
+" |
1400 |
+# bluetooth requires headers from bluez |
1401 |
+DEPEND=" |
1402 |
+ ${RDEPEND} |
1403 |
+ bluetooth? ( net-wireless/bluez ) |
1404 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
1405 |
+" |
1406 |
+# autoconf-archive needed to eautoreconf |
1407 |
+BDEPEND=" |
1408 |
+ sys-devel/autoconf-archive |
1409 |
+ virtual/awk |
1410 |
+ virtual/pkgconfig |
1411 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
1412 |
+" |
1413 |
+RDEPEND+=" |
1414 |
+ !build? ( app-misc/mime-types ) |
1415 |
+" |
1416 |
+ |
1417 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
1418 |
+ |
1419 |
+# large file tests involve a 2.5G file being copied (duplicated) |
1420 |
+CHECKREQS_DISK_BUILD=5500M |
1421 |
+ |
1422 |
+QA_PKGCONFIG_VERSION=${PYVER} |
1423 |
+ |
1424 |
+pkg_pretend() { |
1425 |
+ use test && check-reqs_pkg_pretend |
1426 |
+} |
1427 |
+ |
1428 |
+pkg_setup() { |
1429 |
+ use test && check-reqs_pkg_setup |
1430 |
+} |
1431 |
+ |
1432 |
+src_unpack() { |
1433 |
+ if use verify-sig; then |
1434 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
1435 |
+ fi |
1436 |
+ default |
1437 |
+} |
1438 |
+ |
1439 |
+src_prepare() { |
1440 |
+ # Ensure that internal copies of expat and libffi are not used. |
1441 |
+ rm -r Modules/expat || die |
1442 |
+ rm -r Modules/_ctypes/libffi* || die |
1443 |
+ rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die |
1444 |
+ |
1445 |
+ local PATCHES=( |
1446 |
+ "${WORKDIR}/${PATCHSET}" |
1447 |
+ "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch |
1448 |
+ ) |
1449 |
+ |
1450 |
+ default |
1451 |
+ |
1452 |
+ # https://bugs.gentoo.org/850151 |
1453 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die |
1454 |
+ |
1455 |
+ # force the correct number of jobs |
1456 |
+ # https://bugs.gentoo.org/737660 |
1457 |
+ local jobs=$(makeopts_jobs) |
1458 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
1459 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
1460 |
+ |
1461 |
+ eautoreconf |
1462 |
+} |
1463 |
+ |
1464 |
+src_configure() { |
1465 |
+ # disable automagic bluetooth headers detection |
1466 |
+ if ! use bluetooth; then |
1467 |
+ local -x ac_cv_header_bluetooth_bluetooth_h=no |
1468 |
+ fi |
1469 |
+ local disable |
1470 |
+ use gdbm || disable+=" gdbm" |
1471 |
+ use ncurses || disable+=" _curses _curses_panel" |
1472 |
+ use readline || disable+=" readline" |
1473 |
+ use sqlite || disable+=" _sqlite3" |
1474 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
1475 |
+ use tk || disable+=" _tkinter" |
1476 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1477 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
1478 |
+ |
1479 |
+ if ! use xml; then |
1480 |
+ ewarn "You have configured Python without XML support." |
1481 |
+ ewarn "This is NOT a recommended configuration as you" |
1482 |
+ ewarn "may face problems parsing any XML documents." |
1483 |
+ fi |
1484 |
+ |
1485 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
1486 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
1487 |
+ fi |
1488 |
+ |
1489 |
+ append-flags -fwrapv |
1490 |
+ filter-flags -malign-double |
1491 |
+ |
1492 |
+ # https://bugs.gentoo.org/700012 |
1493 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
1494 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
1495 |
+ fi |
1496 |
+ |
1497 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
1498 |
+ # PKG_CONFIG needed for cross. |
1499 |
+ tc-export CXX PKG_CONFIG |
1500 |
+ |
1501 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
1502 |
+ if use ncurses; then |
1503 |
+ append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
1504 |
+ fi |
1505 |
+ |
1506 |
+ local dbmliborder= |
1507 |
+ if use gdbm; then |
1508 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
1509 |
+ fi |
1510 |
+ |
1511 |
+ if use pgo; then |
1512 |
+ local profile_task_flags=( |
1513 |
+ -m test |
1514 |
+ "-j$(makeopts_jobs)" |
1515 |
+ --pgo-extended |
1516 |
+ -x test_gdb |
1517 |
+ -u-network |
1518 |
+ |
1519 |
+ # All of these seem to occasionally hang for PGO inconsistently |
1520 |
+ # They'll even hang here but be fine in src_test sometimes. |
1521 |
+ # bug #828535 (and related: bug #788022) |
1522 |
+ -x test_asyncio |
1523 |
+ -x test_httpservers |
1524 |
+ -x test_logging |
1525 |
+ -x test_multiprocessing_fork |
1526 |
+ -x test_socket |
1527 |
+ -x test_xmlrpc |
1528 |
+ ) |
1529 |
+ |
1530 |
+ if has_version "app-arch/rpm" ; then |
1531 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
1532 |
+ profile_task_flags+=( |
1533 |
+ -x test_distutils |
1534 |
+ ) |
1535 |
+ fi |
1536 |
+ local -x PROFILE_TASK="${profile_task_flags[*]}" |
1537 |
+ fi |
1538 |
+ |
1539 |
+ local myeconfargs=( |
1540 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
1541 |
+ # Python on glibc upgrade, remove it proactively to give |
1542 |
+ # a chance for users rebuilding python before glibc |
1543 |
+ ac_cv_header_stropts_h=no |
1544 |
+ |
1545 |
+ --enable-shared |
1546 |
+ --enable-ipv6 |
1547 |
+ --infodir='${prefix}/share/info' |
1548 |
+ --mandir='${prefix}/share/man' |
1549 |
+ --with-computed-gotos |
1550 |
+ --with-dbmliborder="${dbmliborder}" |
1551 |
+ --with-libc= |
1552 |
+ --enable-loadable-sqlite-extensions |
1553 |
+ --without-ensurepip |
1554 |
+ --with-system-expat |
1555 |
+ --with-system-ffi |
1556 |
+ --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip |
1557 |
+ |
1558 |
+ $(use_with lto) |
1559 |
+ $(use_enable pgo optimizations) |
1560 |
+ ) |
1561 |
+ |
1562 |
+ # disable implicit optimization/debugging flags |
1563 |
+ local -x OPT= |
1564 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
1565 |
+ # propagated to sysconfig for built extensions |
1566 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
1567 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
1568 |
+ local -x CFLAGS= LDFLAGS= |
1569 |
+ |
1570 |
+ econf "${myeconfargs[@]}" |
1571 |
+ |
1572 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
1573 |
+ eerror "configure has detected that the sem_open function is broken." |
1574 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
1575 |
+ die "Broken sem_open function (bug 496328)" |
1576 |
+ fi |
1577 |
+ |
1578 |
+ # install epython.py as part of stdlib |
1579 |
+ echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die |
1580 |
+} |
1581 |
+ |
1582 |
+src_compile() { |
1583 |
+ # Ensure sed works as expected |
1584 |
+ # https://bugs.gentoo.org/594768 |
1585 |
+ local -x LC_ALL=C |
1586 |
+ # Prevent using distutils bundled by setuptools. |
1587 |
+ # https://bugs.gentoo.org/823728 |
1588 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
1589 |
+ |
1590 |
+ # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't |
1591 |
+ # end up writing bytecode & violating sandbox. |
1592 |
+ # bug #831897 |
1593 |
+ local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} |
1594 |
+ |
1595 |
+ if use pgo ; then |
1596 |
+ # bug 660358 |
1597 |
+ local -x COLUMNS=80 |
1598 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1599 |
+ |
1600 |
+ addpredict /usr/lib/python3.9/site-packages |
1601 |
+ fi |
1602 |
+ |
1603 |
+ # also need to clear the flags explicitly here or they end up |
1604 |
+ # in _sysconfigdata* |
1605 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
1606 |
+ |
1607 |
+ # Restore saved value from above. |
1608 |
+ local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} |
1609 |
+ |
1610 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
1611 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1612 |
+ pax-mark E python |
1613 |
+ else |
1614 |
+ pax-mark m python |
1615 |
+ fi |
1616 |
+} |
1617 |
+ |
1618 |
+src_test() { |
1619 |
+ # Tests will not work when cross compiling. |
1620 |
+ if tc-is-cross-compiler; then |
1621 |
+ elog "Disabling tests due to crosscompiling." |
1622 |
+ return |
1623 |
+ fi |
1624 |
+ |
1625 |
+ local test_opts=( |
1626 |
+ -u-network |
1627 |
+ -j "$(makeopts_jobs)" |
1628 |
+ |
1629 |
+ # fails |
1630 |
+ -x test_gdb |
1631 |
+ ) |
1632 |
+ |
1633 |
+ if use sparc ; then |
1634 |
+ # bug #788022 |
1635 |
+ test_opts+=( |
1636 |
+ -x test_multiprocessing_fork |
1637 |
+ -x test_multiprocessing_forkserver |
1638 |
+ ) |
1639 |
+ fi |
1640 |
+ |
1641 |
+ # bug 660358 |
1642 |
+ local -x COLUMNS=80 |
1643 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1644 |
+ |
1645 |
+ emake test EXTRATESTOPTS="${test_opts[*]}" \ |
1646 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed" |
1647 |
+} |
1648 |
+ |
1649 |
+src_install() { |
1650 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
1651 |
+ |
1652 |
+ emake DESTDIR="${D}" altinstall |
1653 |
+ |
1654 |
+ # Remove static library |
1655 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
1656 |
+ |
1657 |
+ # Fix collisions between different slots of Python. |
1658 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
1659 |
+ |
1660 |
+ # Cheap hack to get version with ABIFLAGS |
1661 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
1662 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
1663 |
+ # Replace python3.X with a symlink to python3.Xm |
1664 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
1665 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
1666 |
+ # Create python3.X-config symlink |
1667 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1668 |
+ # Create python-3.5m.pc symlink |
1669 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1670 |
+ fi |
1671 |
+ |
1672 |
+ # python seems to get rebuilt in src_install (bug 569908) |
1673 |
+ # Work around it for now. |
1674 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
1675 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
1676 |
+ else |
1677 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
1678 |
+ fi |
1679 |
+ |
1680 |
+ rm -r "${libdir}"/ensurepip/_bundled || die |
1681 |
+ if ! use ensurepip; then |
1682 |
+ rm -r "${libdir}"/ensurepip || die |
1683 |
+ fi |
1684 |
+ if ! use sqlite; then |
1685 |
+ rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
1686 |
+ fi |
1687 |
+ if ! use tk; then |
1688 |
+ rm -r "${ED}/usr/bin/idle${PYVER}" || die |
1689 |
+ rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
1690 |
+ fi |
1691 |
+ |
1692 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
1693 |
+ |
1694 |
+ if use examples; then |
1695 |
+ docinto examples |
1696 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
1697 |
+ dodoc -r Tools |
1698 |
+ fi |
1699 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1700 |
+ local libname=$( |
1701 |
+ printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | |
1702 |
+ emake --no-print-directory -s -f - 2>/dev/null |
1703 |
+ ) |
1704 |
+ newins Tools/gdb/libpython.py "${libname}"-gdb.py |
1705 |
+ |
1706 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
1707 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
1708 |
+ sed \ |
1709 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1710 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
1711 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
1712 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1713 |
+ |
1714 |
+ # python-exec wrapping support |
1715 |
+ local pymajor=${PYVER%.*} |
1716 |
+ local EPYTHON=python${PYVER} |
1717 |
+ local scriptdir=${D}$(python_get_scriptdir) |
1718 |
+ mkdir -p "${scriptdir}" || die |
1719 |
+ # python and pythonX |
1720 |
+ ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die |
1721 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
1722 |
+ # python-config and pythonX-config |
1723 |
+ # note: we need to create a wrapper rather than symlinking it due |
1724 |
+ # to some random dirname(argv[0]) magic performed by python-config |
1725 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
1726 |
+ #!/bin/sh |
1727 |
+ exec "${abiver}-config" "\${@}" |
1728 |
+ EOF |
1729 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
1730 |
+ ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die |
1731 |
+ # 2to3, pydoc |
1732 |
+ ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die |
1733 |
+ ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die |
1734 |
+ # idle |
1735 |
+ if use tk; then |
1736 |
+ ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die |
1737 |
+ fi |
1738 |
+} |