Gentoo Archives: gentoo-commits

From: Quentin Retornaz <gentoo@××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/libressl:master commit in: dev-lang/python/
Date: Fri, 26 Aug 2022 20:59:19
Message-Id: 1661547520.8e937320a08850523d59d11dfa9d7c38e16ab6f8.quentin@gentoo
1 commit: 8e937320a08850523d59d11dfa9d7c38e16ab6f8
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Fri Aug 26 14:28:20 2022 +0000
4 Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
5 CommitDate: Fri Aug 26 20:58:40 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=8e937320
7
8 dev-lang/python: Add 3.9.13_p4 + 3.10.6_p2
9
10 Signed-off-by: orbea <orbea <AT> riseup.net>
11 Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>
12
13 dev-lang/python/Manifest | 4 +
14 dev-lang/python/python-3.10.6_p2.ebuild | 409 ++++++++++++++++++++++++++++++++
15 dev-lang/python/python-3.9.13_p4.ebuild | 405 +++++++++++++++++++++++++++++++
16 3 files changed, 818 insertions(+)
17
18 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
19 index fd2e44d..b5bb2ab 100644
20 --- a/dev-lang/python/Manifest
21 +++ b/dev-lang/python/Manifest
22 @@ -2,11 +2,15 @@ DIST Python-3.10.4.tar.xz 19342692 BLAKE2B c430ad9bed71729fda29433af0614b6c0110a
23 DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf SHA512 699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d
24 DIST Python-3.10.5.tar.xz 19361320 BLAKE2B 7f3629f8a16faeb0311947b7d5162bc45d9ed6b2c051f776027d01ebbbdd42e4849efd67921fa57975f68ec67dc34f3135345ce216f2d3f02bfcfa4245d266f1 SHA512 aa7f58a9b31de9824185b3e7bfa7da0dcf64ae9e89840664eae9d98d9048a650fa012cd5b873a62ff44b65b856db86f095c4003117406ec5e9583ec5f7e78e90
25 DIST Python-3.10.5.tar.xz.asc 833 BLAKE2B 36da2d557a5c38cfc473b2138412f9bc011d19c8538475e623bf41d81eb2c8f8e977945a3065a48c5b234d2b2c7d0dd5e83112c948591628cec344651dc9055c SHA512 72d0ab09900e2a10b85ccac804efd5536251152798e7347576e0e28bff4ab4a84b08d646329b225f9949047586686f9f4e7f05652526657a0948951b739c14e0
26 +DIST Python-3.10.6.tar.xz 19600672 BLAKE2B b21398f68e13cf8464077aa2c7f08d9044198cc3d2e2829d12239d420c1c922cbad8427f3e0fae3fe62a4b8ebb7db7eff441266eff82f0c78d7a98a62d8e64c3 SHA512 f2bf424bf4f4caa524ee1248b431e8e06d0745c3fc3ba457710d75f3698e653733feb4b059cd124f1de2a9e851c30d847f567aa47abef12898c9dc8a6507b476
27 +DIST Python-3.10.6.tar.xz.asc 833 BLAKE2B ea6546c01a4fbfe3f3e56b2f980da53f0692d9c638534bd25fb96a0f657424f979b6a82a01c77c05ddfded30441b4a0348cc407d5b29290ffc653a508ca32ec8 SHA512 9288e2f62f2e8c8208ad176372261545a64e675d737bb616403bcd888bc91177909257632e4cc0b5d688d612bea38a274030ec6989dc7d56c03064e32ad9903e
28 DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25 SHA512 081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97
29 DIST Python-3.9.12.tar.xz.asc 833 BLAKE2B 33436d0404a643215a8fd2b967ffd216201da24f374941bf65b888159ccfabcbe79b751eca2dd489b06605604338c8bbaab74aa10abbe4bcffaa54236301228e SHA512 dddaa27f8a29034f458edb6739398a5455c87fe37b6349e161865a9deedca118ffe9cb82663cc75bbe60b3b556399c0c6855f5262aac1fe90d36a3694fca65b2
30 DIST Python-3.9.13.tar.xz 19754368 BLAKE2B 4f583f66c28b791e19cd6d79695fe9eb815fd333542be22aec8bd73d1f4d3f17f2c4e9de198e7b16c1ca6362a613a8a02fb965c7dc7db3e510fd31de15ba2d19 SHA512 e9664e7f908092df11236b22465d217531d6f0378e88d889108d19fe77f28f46ffb629b8733f84b41409e255367321893a2b1bd64518930d9d8cae5d1b774d23
31 DIST Python-3.9.13.tar.xz.asc 833 BLAKE2B db01c01be9d56cd15f9ab4a9e2cfa800faf4ebecb92b01c133865d3b3134bc910258a33b766306c3d01f98e35bbf9c03c7cba697760b7095999cbd63ed6c276c SHA512 9367afe8ec32195adbb64fa32eb9e3881cfdbbb38efcb5e0804a15486232aecbc81ed20a8ffed652f06a881744f3efd2c2df3cc652d70671c94d6668a17a391e
32 DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2
33 DIST python-gentoo-patches-3.10.5.tar.xz 8584 BLAKE2B d4a812a33e485b1eae5629e519dca4dc6625b743b07c7f7bbc62562f345d87723ba499893702310b1e96e443d2946e27a8d4971f32ca1125d4827d0d594ccaa6 SHA512 77f0478f7d0491e103857a83a97d6e04a9ec68740a7f9357cbbdd316462e7d98ea8236bd05a30e7556457ece5fbcfa4a7a78a25d4eb12779455ce2bb5b6f30d0
34 +DIST python-gentoo-patches-3.10.6_p2.tar.xz 12040 BLAKE2B 75c93fab19137a966b3775308bc20142f4d3648bbb9364e82c4eaffae93beda54011192881c52b85d2e2493a06cfe2a90f50675609908c3d5ebdb0103fe41644 SHA512 7e451a8a18a62592c2cd7b2db71065b77256960f43e172a0d7856b22b69138dcb1552f53b39bec14585a761cfe729c81613551c1b616fe1ec8d2b59856b11453
35 DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b SHA512 07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91
36 DIST python-gentoo-patches-3.9.13.tar.xz 12836 BLAKE2B ba687a3d6e00baf4d9640ab78a29c3e21bf1872b5019198991521cf37bb0780f592db742ee4fdfe6bfb1cab1c1f6587889dfdb024cae72766b6c83c2ffe319be SHA512 e393992ff92625771c6ffeb500637862f0163c689c685fd245a6e5bbdd3128154ce439ecab56eaf1359e67ea0d173dfb19f65a4098ea2266922bfb43aba517dc
37 +DIST python-gentoo-patches-3.9.13_p4.tar.xz 22072 BLAKE2B a0e084eff35d075d2255b139d0db114d282cb6c9c0c2ea51a8ecb7f5f1dc8096d6578ae5f804b7583a2b7842152b5723ad802ca816d46813c40aaa756118afc8 SHA512 cdf8d43fd5263c4956be234f36c0767215ab2495705d4f2a060b32ecbfbe159e618e31693b0538a1b970f7b27ebe4953063f585930d074dcaf59f2f61486e6b6
38
39 diff --git a/dev-lang/python/python-3.10.6_p2.ebuild b/dev-lang/python/python-3.10.6_p2.ebuild
40 new file mode 100644
41 index 0000000..163d9a7
42 --- /dev/null
43 +++ b/dev-lang/python/python-3.10.6_p2.ebuild
44 @@ -0,0 +1,409 @@
45 +# Copyright 1999-2022 Gentoo Authors
46 +# Distributed under the terms of the GNU General Public License v2
47 +
48 +EAPI="7"
49 +WANT_LIBTOOL="none"
50 +
51 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
52 +inherit python-utils-r1 toolchain-funcs verify-sig
53 +
54 +MY_PV=${PV/_rc/rc}
55 +MY_P="Python-${MY_PV%_p*}"
56 +PYVER=$(ver_cut 1-2)
57 +PATCHSET="python-gentoo-patches-${MY_PV}"
58 +
59 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
60 +HOMEPAGE="
61 + https://www.python.org/
62 + https://github.com/python/cpython/
63 +"
64 +SRC_URI="
65 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
66 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
67 + verify-sig? (
68 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
69 + )
70 +"
71 +S="${WORKDIR}/${MY_P}"
72 +
73 +LICENSE="PSF-2"
74 +SLOT="${PYVER}"
75 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
76 +IUSE="
77 + bluetooth build +ensurepip examples gdbm hardened libedit lto
78 + +ncurses pgo +readline +sqlite +ssl test tk +xml
79 +"
80 +RESTRICT="!test? ( test )"
81 +
82 +# Do not add a dependency on dev-lang/python to this ebuild.
83 +# If you need to apply a patch which requires python for bootstrapping, please
84 +# run the bootstrap code on your dev box and include the results in the
85 +# patchset. See bug 447752.
86 +
87 +RDEPEND="
88 + app-arch/bzip2:=
89 + app-arch/xz-utils:=
90 + dev-lang/python-exec[python_targets_python3_10(-)]
91 + dev-libs/libffi:=
92 + sys-apps/util-linux:=
93 + >=sys-libs/zlib-1.1.3:=
94 + virtual/libcrypt:=
95 + virtual/libintl
96 + ensurepip? ( dev-python/ensurepip-wheels )
97 + gdbm? ( sys-libs/gdbm:=[berkdb] )
98 + ncurses? ( >=sys-libs/ncurses-5.2:= )
99 + readline? (
100 + !libedit? ( >=sys-libs/readline-4.1:= )
101 + libedit? ( dev-libs/libedit:= )
102 + )
103 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
104 + ssl? ( >=dev-libs/openssl-1.1.1:= )
105 + tk? (
106 + >=dev-lang/tcl-8.0:=
107 + >=dev-lang/tk-8.0:=
108 + dev-tcltk/blt:=
109 + dev-tcltk/tix
110 + )
111 + xml? ( >=dev-libs/expat-2.1:= )
112 + !!<sys-apps/sandbox-2.21
113 +"
114 +# bluetooth requires headers from bluez
115 +DEPEND="
116 + ${RDEPEND}
117 + bluetooth? ( net-wireless/bluez )
118 + test? ( app-arch/xz-utils[extra-filters(+)] )
119 +"
120 +# autoconf-archive needed to eautoreconf
121 +BDEPEND="
122 + sys-devel/autoconf-archive
123 + virtual/awk
124 + virtual/pkgconfig
125 + verify-sig? ( sec-keys/openpgp-keys-python )
126 + !sys-devel/gcc[libffi(-)]
127 +"
128 +RDEPEND+="
129 + !build? ( app-misc/mime-types )
130 +"
131 +
132 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
133 +
134 +# large file tests involve a 2.5G file being copied (duplicated)
135 +CHECKREQS_DISK_BUILD=5500M
136 +
137 +QA_PKGCONFIG_VERSION=${PYVER}
138 +
139 +pkg_pretend() {
140 + use test && check-reqs_pkg_pretend
141 +}
142 +
143 +pkg_setup() {
144 + use test && check-reqs_pkg_setup
145 +}
146 +
147 +src_unpack() {
148 + if use verify-sig; then
149 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
150 + fi
151 + default
152 +}
153 +
154 +src_prepare() {
155 + # Ensure that internal copies of expat and libffi are not used.
156 + rm -r Modules/expat || die
157 + rm -r Modules/_ctypes/libffi* || die
158 +
159 + local PATCHES=(
160 + "${WORKDIR}/${PATCHSET}"
161 + "${FILESDIR}"/${PN}-3.10.3-libressl.patch
162 + )
163 +
164 + default
165 +
166 + # https://bugs.gentoo.org/850151
167 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
168 +
169 + # force the correct number of jobs
170 + # https://bugs.gentoo.org/737660
171 + local jobs=$(makeopts_jobs)
172 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
173 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
174 +
175 + eautoreconf
176 +}
177 +
178 +src_configure() {
179 + # disable automagic bluetooth headers detection
180 + if ! use bluetooth; then
181 + local -x ac_cv_header_bluetooth_bluetooth_h=no
182 + fi
183 + local disable
184 + use gdbm || disable+=" gdbm"
185 + use ncurses || disable+=" _curses _curses_panel"
186 + use readline || disable+=" readline"
187 + use sqlite || disable+=" _sqlite3"
188 + use ssl || export PYTHON_DISABLE_SSL="1"
189 + use tk || disable+=" _tkinter"
190 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
191 + export PYTHON_DISABLE_MODULES="${disable}"
192 +
193 + if ! use xml; then
194 + ewarn "You have configured Python without XML support."
195 + ewarn "This is NOT a recommended configuration as you"
196 + ewarn "may face problems parsing any XML documents."
197 + fi
198 +
199 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
200 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
201 + fi
202 +
203 + append-flags -fwrapv
204 + filter-flags -malign-double
205 +
206 + # https://bugs.gentoo.org/700012
207 + if is-flagq -flto || is-flagq '-flto=*'; then
208 + append-cflags $(test-flags-CC -ffat-lto-objects)
209 + fi
210 +
211 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
212 + # PKG_CONFIG needed for cross.
213 + tc-export CXX PKG_CONFIG
214 +
215 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
216 + if use ncurses; then
217 + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
218 + fi
219 +
220 + local dbmliborder=
221 + if use gdbm; then
222 + dbmliborder+="${dbmliborder:+:}gdbm"
223 + fi
224 +
225 + if use pgo; then
226 + local profile_task_flags=(
227 + -m test
228 + "-j$(makeopts_jobs)"
229 + --pgo-extended
230 + -x test_gdb
231 + -u-network
232 +
233 + # All of these seem to occasionally hang for PGO inconsistently
234 + # They'll even hang here but be fine in src_test sometimes.
235 + # bug #828535 (and related: bug #788022)
236 + -x test_asyncio
237 + -x test_httpservers
238 + -x test_logging
239 + -x test_multiprocessing_fork
240 + -x test_socket
241 + -x test_xmlrpc
242 + )
243 +
244 + if has_version "app-arch/rpm" ; then
245 + # Avoid sandbox failure (attempts to write to /var/lib/rpm)
246 + profile_task_flags+=(
247 + -x test_distutils
248 + )
249 + fi
250 + local -x PROFILE_TASK="${profile_task_flags[*]}"
251 + fi
252 +
253 + local myeconfargs=(
254 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
255 + # Python on glibc upgrade, remove it proactively to give
256 + # a chance for users rebuilding python before glibc
257 + ac_cv_header_stropts_h=no
258 +
259 + --enable-shared
260 + --without-static-libpython
261 + --enable-ipv6
262 + --infodir='${prefix}/share/info'
263 + --mandir='${prefix}/share/man'
264 + --with-computed-gotos
265 + --with-dbmliborder="${dbmliborder}"
266 + --with-libc=
267 + --enable-loadable-sqlite-extensions
268 + --without-ensurepip
269 + --with-system-expat
270 + --with-system-ffi
271 + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
272 +
273 + $(use_with lto)
274 + $(use_enable pgo optimizations)
275 + $(use_with readline readline "$(usex libedit editline readline)")
276 + )
277 +
278 + # disable implicit optimization/debugging flags
279 + local -x OPT=
280 + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
281 + # propagated to sysconfig for built extensions
282 + local -x CFLAGS_NODIST=${CFLAGS}
283 + local -x LDFLAGS_NODIST=${LDFLAGS}
284 + local -x CFLAGS= LDFLAGS=
285 +
286 + econf "${myeconfargs[@]}"
287 +
288 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
289 + eerror "configure has detected that the sem_open function is broken."
290 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
291 + die "Broken sem_open function (bug 496328)"
292 + fi
293 +
294 + # install epython.py as part of stdlib
295 + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
296 +}
297 +
298 +src_compile() {
299 + # Ensure sed works as expected
300 + # https://bugs.gentoo.org/594768
301 + local -x LC_ALL=C
302 + # Prevent using distutils bundled by setuptools.
303 + # https://bugs.gentoo.org/823728
304 + export SETUPTOOLS_USE_DISTUTILS=stdlib
305 +
306 + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
307 + # end up writing bytecode & violating sandbox.
308 + # bug #831897
309 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
310 +
311 + if use pgo ; then
312 + # bug 660358
313 + local -x COLUMNS=80
314 + local -x PYTHONDONTWRITEBYTECODE=
315 +
316 + addpredict /usr/lib/python3.10/site-packages
317 + fi
318 +
319 + # also need to clear the flags explicitly here or they end up
320 + # in _sysconfigdata*
321 + emake CPPFLAGS= CFLAGS= LDFLAGS=
322 +
323 + # Restore saved value from above.
324 + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
325 +
326 + # Work around bug 329499. See also bug 413751 and 457194.
327 + if has_version dev-libs/libffi[pax-kernel]; then
328 + pax-mark E python
329 + else
330 + pax-mark m python
331 + fi
332 +}
333 +
334 +src_test() {
335 + # Tests will not work when cross compiling.
336 + if tc-is-cross-compiler; then
337 + elog "Disabling tests due to crosscompiling."
338 + return
339 + fi
340 +
341 + local test_opts=(
342 + -u-network
343 + -j "$(makeopts_jobs)"
344 +
345 + # fails
346 + -x test_gdb
347 + )
348 +
349 + if use sparc ; then
350 + # bug #788022
351 + test_opts+=(
352 + -x test_multiprocessing_fork
353 + -x test_multiprocessing_forkserver
354 + )
355 + fi
356 +
357 + # bug 660358
358 + local -x COLUMNS=80
359 + local -x PYTHONDONTWRITEBYTECODE=
360 + # workaround https://bugs.gentoo.org/775416
361 + addwrite /usr/lib/python3.10/site-packages
362 +
363 + emake test EXTRATESTOPTS="${test_opts[*]}" \
364 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed"
365 +}
366 +
367 +src_install() {
368 + local libdir=${ED}/usr/lib/python${PYVER}
369 +
370 + emake DESTDIR="${D}" altinstall
371 +
372 + # Fix collisions between different slots of Python.
373 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
374 +
375 + # Cheap hack to get version with ABIFLAGS
376 + local abiver=$(cd "${ED}/usr/include"; echo python*)
377 + if [[ ${abiver} != python${PYVER} ]]; then
378 + # Replace python3.X with a symlink to python3.Xm
379 + rm "${ED}/usr/bin/python${PYVER}" || die
380 + dosym "${abiver}" "/usr/bin/python${PYVER}"
381 + # Create python3.X-config symlink
382 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
383 + # Create python-3.5m.pc symlink
384 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
385 + fi
386 +
387 + # python seems to get rebuilt in src_install (bug 569908)
388 + # Work around it for now.
389 + if has_version dev-libs/libffi[pax-kernel]; then
390 + pax-mark E "${ED}/usr/bin/${abiver}"
391 + else
392 + pax-mark m "${ED}/usr/bin/${abiver}"
393 + fi
394 +
395 + rm -r "${libdir}"/ensurepip/_bundled || die
396 + if ! use ensurepip; then
397 + rm -r "${libdir}"/ensurepip || die
398 + fi
399 + if ! use sqlite; then
400 + rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
401 + fi
402 + if ! use tk; then
403 + rm -r "${ED}/usr/bin/idle${PYVER}" || die
404 + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
405 + fi
406 +
407 + dodoc Misc/{ACKS,HISTORY,NEWS}
408 +
409 + if use examples; then
410 + docinto examples
411 + find Tools -name __pycache__ -exec rm -fr {} + || die
412 + dodoc -r Tools
413 + fi
414 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
415 + local libname=$(
416 + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
417 + emake --no-print-directory -s -f - 2>/dev/null
418 + )
419 + newins Tools/gdb/libpython.py "${libname}"-gdb.py
420 +
421 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
422 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
423 + sed \
424 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
425 + -e "s:@PYDOC@:pydoc${PYVER}:" \
426 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
427 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
428 +
429 + # python-exec wrapping support
430 + local pymajor=${PYVER%.*}
431 + local EPYTHON=python${PYVER}
432 + local scriptdir=${D}$(python_get_scriptdir)
433 + mkdir -p "${scriptdir}" || die
434 + # python and pythonX
435 + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
436 + ln -s "python${pymajor}" "${scriptdir}/python" || die
437 + # python-config and pythonX-config
438 + # note: we need to create a wrapper rather than symlinking it due
439 + # to some random dirname(argv[0]) magic performed by python-config
440 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
441 + #!/bin/sh
442 + exec "${abiver}-config" "\${@}"
443 + EOF
444 + chmod +x "${scriptdir}/python${pymajor}-config" || die
445 + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
446 + # 2to3, pydoc
447 + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
448 + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
449 + # idle
450 + if use tk; then
451 + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
452 + fi
453 +}
454
455 diff --git a/dev-lang/python/python-3.9.13_p4.ebuild b/dev-lang/python/python-3.9.13_p4.ebuild
456 new file mode 100644
457 index 0000000..54c6114
458 --- /dev/null
459 +++ b/dev-lang/python/python-3.9.13_p4.ebuild
460 @@ -0,0 +1,405 @@
461 +# Copyright 1999-2022 Gentoo Authors
462 +# Distributed under the terms of the GNU General Public License v2
463 +
464 +EAPI="7"
465 +WANT_LIBTOOL="none"
466 +
467 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
468 +inherit python-utils-r1 toolchain-funcs verify-sig
469 +
470 +MY_PV=${PV/_rc/rc}
471 +MY_P="Python-${MY_PV%_p*}"
472 +PYVER=$(ver_cut 1-2)
473 +PATCHSET="python-gentoo-patches-${MY_PV}"
474 +
475 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
476 +HOMEPAGE="
477 + https://www.python.org/
478 + https://github.com/python/cpython/
479 +"
480 +SRC_URI="
481 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
482 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
483 + verify-sig? (
484 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
485 + )
486 +"
487 +S="${WORKDIR}/${MY_P}"
488 +
489 +LICENSE="PSF-2"
490 +SLOT="${PYVER}"
491 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
492 +IUSE="
493 + bluetooth build +ensurepip examples gdbm hardened lto +ncurses pgo
494 + +readline +sqlite +ssl test tk +xml
495 +"
496 +RESTRICT="!test? ( test )"
497 +
498 +# Do not add a dependency on dev-lang/python to this ebuild.
499 +# If you need to apply a patch which requires python for bootstrapping, please
500 +# run the bootstrap code on your dev box and include the results in the
501 +# patchset. See bug 447752.
502 +
503 +RDEPEND="
504 + app-arch/bzip2:=
505 + app-arch/xz-utils:=
506 + dev-lang/python-exec[python_targets_python3_9(-)]
507 + dev-libs/libffi:=
508 + sys-apps/util-linux:=
509 + >=sys-libs/zlib-1.1.3:=
510 + virtual/libcrypt:=
511 + virtual/libintl
512 + ensurepip? ( dev-python/ensurepip-wheels )
513 + gdbm? ( sys-libs/gdbm:=[berkdb] )
514 + ncurses? ( >=sys-libs/ncurses-5.2:= )
515 + readline? ( >=sys-libs/readline-4.1:= )
516 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
517 + ssl? ( >=dev-libs/openssl-1.1.1:= )
518 + tk? (
519 + >=dev-lang/tcl-8.0:=
520 + >=dev-lang/tk-8.0:=
521 + dev-tcltk/blt:=
522 + dev-tcltk/tix
523 + )
524 + xml? ( >=dev-libs/expat-2.1:= )
525 +"
526 +# bluetooth requires headers from bluez
527 +DEPEND="
528 + ${RDEPEND}
529 + bluetooth? ( net-wireless/bluez )
530 + test? ( app-arch/xz-utils[extra-filters(+)] )
531 +"
532 +# autoconf-archive needed to eautoreconf
533 +BDEPEND="
534 + sys-devel/autoconf-archive
535 + virtual/awk
536 + virtual/pkgconfig
537 + verify-sig? ( sec-keys/openpgp-keys-python )
538 + !sys-devel/gcc[libffi(-)]
539 +"
540 +RDEPEND+="
541 + !build? ( app-misc/mime-types )
542 +"
543 +
544 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
545 +
546 +# large file tests involve a 2.5G file being copied (duplicated)
547 +CHECKREQS_DISK_BUILD=5500M
548 +
549 +QA_PKGCONFIG_VERSION=${PYVER}
550 +
551 +pkg_pretend() {
552 + use test && check-reqs_pkg_pretend
553 +}
554 +
555 +pkg_setup() {
556 + use test && check-reqs_pkg_setup
557 +}
558 +
559 +src_unpack() {
560 + if use verify-sig; then
561 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
562 + fi
563 + default
564 +}
565 +
566 +src_prepare() {
567 + # Ensure that internal copies of expat and libffi are not used.
568 + rm -r Modules/expat || die
569 + rm -r Modules/_ctypes/libffi* || die
570 + rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die
571 +
572 + local PATCHES=(
573 + "${WORKDIR}/${PATCHSET}"
574 + "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch
575 + )
576 +
577 + default
578 +
579 + # https://bugs.gentoo.org/850151
580 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
581 +
582 + # force the correct number of jobs
583 + # https://bugs.gentoo.org/737660
584 + local jobs=$(makeopts_jobs)
585 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
586 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
587 +
588 + eautoreconf
589 +}
590 +
591 +src_configure() {
592 + # disable automagic bluetooth headers detection
593 + if ! use bluetooth; then
594 + local -x ac_cv_header_bluetooth_bluetooth_h=no
595 + fi
596 + local disable
597 + use gdbm || disable+=" gdbm"
598 + use ncurses || disable+=" _curses _curses_panel"
599 + use readline || disable+=" readline"
600 + use sqlite || disable+=" _sqlite3"
601 + use ssl || export PYTHON_DISABLE_SSL="1"
602 + use tk || disable+=" _tkinter"
603 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
604 + export PYTHON_DISABLE_MODULES="${disable}"
605 +
606 + if ! use xml; then
607 + ewarn "You have configured Python without XML support."
608 + ewarn "This is NOT a recommended configuration as you"
609 + ewarn "may face problems parsing any XML documents."
610 + fi
611 +
612 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
613 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
614 + fi
615 +
616 + append-flags -fwrapv
617 + filter-flags -malign-double
618 +
619 + # https://bugs.gentoo.org/700012
620 + if is-flagq -flto || is-flagq '-flto=*'; then
621 + append-cflags $(test-flags-CC -ffat-lto-objects)
622 + fi
623 +
624 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
625 + # PKG_CONFIG needed for cross.
626 + tc-export CXX PKG_CONFIG
627 +
628 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
629 + if use ncurses; then
630 + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
631 + fi
632 +
633 + local dbmliborder=
634 + if use gdbm; then
635 + dbmliborder+="${dbmliborder:+:}gdbm"
636 + fi
637 +
638 + if use pgo; then
639 + local profile_task_flags=(
640 + -m test
641 + "-j$(makeopts_jobs)"
642 + --pgo-extended
643 + -x test_gdb
644 + -u-network
645 +
646 + # All of these seem to occasionally hang for PGO inconsistently
647 + # They'll even hang here but be fine in src_test sometimes.
648 + # bug #828535 (and related: bug #788022)
649 + -x test_asyncio
650 + -x test_httpservers
651 + -x test_logging
652 + -x test_multiprocessing_fork
653 + -x test_socket
654 + -x test_xmlrpc
655 + )
656 +
657 + if has_version "app-arch/rpm" ; then
658 + # Avoid sandbox failure (attempts to write to /var/lib/rpm)
659 + profile_task_flags+=(
660 + -x test_distutils
661 + )
662 + fi
663 + local -x PROFILE_TASK="${profile_task_flags[*]}"
664 + fi
665 +
666 + local myeconfargs=(
667 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
668 + # Python on glibc upgrade, remove it proactively to give
669 + # a chance for users rebuilding python before glibc
670 + ac_cv_header_stropts_h=no
671 +
672 + --enable-shared
673 + --enable-ipv6
674 + --infodir='${prefix}/share/info'
675 + --mandir='${prefix}/share/man'
676 + --with-computed-gotos
677 + --with-dbmliborder="${dbmliborder}"
678 + --with-libc=
679 + --enable-loadable-sqlite-extensions
680 + --without-ensurepip
681 + --with-system-expat
682 + --with-system-ffi
683 + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
684 +
685 + $(use_with lto)
686 + $(use_enable pgo optimizations)
687 + )
688 +
689 + # disable implicit optimization/debugging flags
690 + local -x OPT=
691 + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
692 + # propagated to sysconfig for built extensions
693 + local -x CFLAGS_NODIST=${CFLAGS}
694 + local -x LDFLAGS_NODIST=${LDFLAGS}
695 + local -x CFLAGS= LDFLAGS=
696 +
697 + econf "${myeconfargs[@]}"
698 +
699 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
700 + eerror "configure has detected that the sem_open function is broken."
701 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
702 + die "Broken sem_open function (bug 496328)"
703 + fi
704 +
705 + # install epython.py as part of stdlib
706 + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
707 +}
708 +
709 +src_compile() {
710 + # Ensure sed works as expected
711 + # https://bugs.gentoo.org/594768
712 + local -x LC_ALL=C
713 + # Prevent using distutils bundled by setuptools.
714 + # https://bugs.gentoo.org/823728
715 + export SETUPTOOLS_USE_DISTUTILS=stdlib
716 +
717 + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
718 + # end up writing bytecode & violating sandbox.
719 + # bug #831897
720 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
721 +
722 + if use pgo ; then
723 + # bug 660358
724 + local -x COLUMNS=80
725 + local -x PYTHONDONTWRITEBYTECODE=
726 +
727 + addpredict /usr/lib/python3.9/site-packages
728 + fi
729 +
730 + # also need to clear the flags explicitly here or they end up
731 + # in _sysconfigdata*
732 + emake CPPFLAGS= CFLAGS= LDFLAGS=
733 +
734 + # Restore saved value from above.
735 + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
736 +
737 + # Work around bug 329499. See also bug 413751 and 457194.
738 + if has_version dev-libs/libffi[pax-kernel]; then
739 + pax-mark E python
740 + else
741 + pax-mark m python
742 + fi
743 +}
744 +
745 +src_test() {
746 + # Tests will not work when cross compiling.
747 + if tc-is-cross-compiler; then
748 + elog "Disabling tests due to crosscompiling."
749 + return
750 + fi
751 +
752 + local test_opts=(
753 + -u-network
754 + -j "$(makeopts_jobs)"
755 +
756 + # fails
757 + -x test_gdb
758 + )
759 +
760 + if use sparc ; then
761 + # bug #788022
762 + test_opts+=(
763 + -x test_multiprocessing_fork
764 + -x test_multiprocessing_forkserver
765 + )
766 + fi
767 +
768 + # bug 660358
769 + local -x COLUMNS=80
770 + local -x PYTHONDONTWRITEBYTECODE=
771 +
772 + emake test EXTRATESTOPTS="${test_opts[*]}" \
773 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed"
774 +}
775 +
776 +src_install() {
777 + local libdir=${ED}/usr/lib/python${PYVER}
778 +
779 + emake DESTDIR="${D}" altinstall
780 +
781 + # Remove static library
782 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
783 +
784 + # Fix collisions between different slots of Python.
785 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
786 +
787 + # Cheap hack to get version with ABIFLAGS
788 + local abiver=$(cd "${ED}/usr/include"; echo python*)
789 + if [[ ${abiver} != python${PYVER} ]]; then
790 + # Replace python3.X with a symlink to python3.Xm
791 + rm "${ED}/usr/bin/python${PYVER}" || die
792 + dosym "${abiver}" "/usr/bin/python${PYVER}"
793 + # Create python3.X-config symlink
794 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
795 + # Create python-3.5m.pc symlink
796 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
797 + fi
798 +
799 + # python seems to get rebuilt in src_install (bug 569908)
800 + # Work around it for now.
801 + if has_version dev-libs/libffi[pax-kernel]; then
802 + pax-mark E "${ED}/usr/bin/${abiver}"
803 + else
804 + pax-mark m "${ED}/usr/bin/${abiver}"
805 + fi
806 +
807 + rm -r "${libdir}"/ensurepip/_bundled || die
808 + if ! use ensurepip; then
809 + rm -r "${libdir}"/ensurepip || die
810 + fi
811 + if ! use sqlite; then
812 + rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
813 + fi
814 + if ! use tk; then
815 + rm -r "${ED}/usr/bin/idle${PYVER}" || die
816 + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
817 + fi
818 +
819 + dodoc Misc/{ACKS,HISTORY,NEWS}
820 +
821 + if use examples; then
822 + docinto examples
823 + find Tools -name __pycache__ -exec rm -fr {} + || die
824 + dodoc -r Tools
825 + fi
826 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
827 + local libname=$(
828 + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
829 + emake --no-print-directory -s -f - 2>/dev/null
830 + )
831 + newins Tools/gdb/libpython.py "${libname}"-gdb.py
832 +
833 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
834 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
835 + sed \
836 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
837 + -e "s:@PYDOC@:pydoc${PYVER}:" \
838 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
839 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
840 +
841 + # python-exec wrapping support
842 + local pymajor=${PYVER%.*}
843 + local EPYTHON=python${PYVER}
844 + local scriptdir=${D}$(python_get_scriptdir)
845 + mkdir -p "${scriptdir}" || die
846 + # python and pythonX
847 + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
848 + ln -s "python${pymajor}" "${scriptdir}/python" || die
849 + # python-config and pythonX-config
850 + # note: we need to create a wrapper rather than symlinking it due
851 + # to some random dirname(argv[0]) magic performed by python-config
852 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
853 + #!/bin/sh
854 + exec "${abiver}-config" "\${@}"
855 + EOF
856 + chmod +x "${scriptdir}/python${pymajor}-config" || die
857 + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
858 + # 2to3, pydoc
859 + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
860 + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
861 + # idle
862 + if use tk; then
863 + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
864 + fi
865 +}