Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/python/
Date: Wed, 01 Jun 2022 06:21:57
Message-Id: 1654064510.b6a98fa191a5e0787268fdd2a64380b59c7e2997.mgorny@gentoo
1 commit: b6a98fa191a5e0787268fdd2a64380b59c7e2997
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 1 06:08:48 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 1 06:21:50 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b6a98fa1
7
8 dev-lang/python: Backport end_lineno fix to 3.11.0_beta2_p1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-lang/python/Manifest | 1 +
13 dev-lang/python/python-3.11.0_beta2_p1.ebuild | 421 ++++++++++++++++++++++++++
14 2 files changed, 422 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index ce21c328dd6a..0583e1fdf579 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -19,6 +19,7 @@ DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da9
21 DIST python-gentoo-patches-3.10.4_p1.tar.xz 9648 BLAKE2B e89fa6d4d0d56614242e23d112931cab3447db258548f86e6d09af3db95a3c4f97bb4a939659b85fcc897c0ce4d613c5d55af5da3ae2bd074c2cfc91210d4d34 SHA512 d6bb91ce471cb01891bf5bc1f03914714a34e6a1780f279b937dfb21aea1cf65d84c89c792e0d46286f3c9030ad99bc42b2657aa7e8c6bf0ed0d973b381fb5f9
22 DIST python-gentoo-patches-3.11.0b1.tar.xz 3324 BLAKE2B aa54baab51376b63d7ec4783f9dd9d18581a07c935aaf3619d009d32e754b3a54cbcc2b4f9b0dd556bb91f74198a27ebee4e31baaac04907ba0f1fa87ad04121 SHA512 d609d95fe2e89550f70bb0cb3e4b468e571d00fa3e8a60020193a048c089685b7452146d8bb51e5e39203f08b0b53c661c156ba7711bdd7b107ceebd4ceec440
23 DIST python-gentoo-patches-3.11.0b2.tar.xz 3324 BLAKE2B 6368fed7be55e0a04d19be09fe1a935ecba5f6f7a12ff4e7926e6f611cd7448bb7ffd83240022e245b5f4452529e7469de65bf9a388e93bbdd0ffef2ba352209 SHA512 fe2ecf265f94ef3954b528bbd7b25ee8f3bdb27ffde4e94dd105c440848509ba5da05614d855859ad56b840e8858ee1435af51e84add9fb212d8827044158da3
24 +DIST python-gentoo-patches-3.11.0b2_p1.tar.xz 4888 BLAKE2B d82a1c2e6e18a8d9ab8fbe5e1f81268442f45114f6ac58ce8d6204f8874c06769b725d480d5aaa7c624ef7f9d59c9dcff5371622a5b8c44d37ea0f9d960304fe SHA512 3b8b1859e4ca941d0ec21171d3ee491a19bffb612935217f9a0a59361270dcae3b97e366b6ef14aa4e5e6415871b2b1509e9a276a0783c86af9883e1345f71e7
25 DIST python-gentoo-patches-3.8.13.tar.xz 16004 BLAKE2B 5c0c6c9263570a467391e60c324d1dbc1e50ffda9cad1e204df124441b593146f18e5f1529eb7d385b35c5f4b9e597807971b6b66f7f8eef156ad87c9ad32743 SHA512 4ceb831e2d62bd73909b53a3b553b2cd73d08bcf2a1c92b47eaeb1221d40daabcaed14977265bcb265df00b6bf363dbebbd61a62dca4bf6ef40c6b911e980597
26 DIST python-gentoo-patches-3.8.13_p1.tar.xz 17704 BLAKE2B 9b8fa78945f62809cd146b8009a5bbdf7570bd3e470e602bc20567089f343ed99c2c4b9f99440dde0a7e7ea05e7be280c4756fcd50c88d6b9a39829736b2a435 SHA512 520b521b61128970481202eed57bc56eaeb491a1fb920aa65aa7c80fb96fe4e70e0b5c3ed0813583f6ac22dfc9738ba38247bc639f448c9756aa0dfd1e907b19
27 DIST python-gentoo-patches-3.8.13_p2.tar.xz 18816 BLAKE2B 8612ca33e5569319c5d1a5a3fb1a81e860bd515bfde656b79f087ccf7020923fbd06b315178bef8630e4c36bb22c27299fe439aadc6a161f1ec93be8778314ee SHA512 be5668a0a4be0a03e61466436973125a3be4f33a61524e4a5c8d86745727cfcae59e5048477887c9f6bfc09727f3aef3652ad47a13a6bf0f1452d3172f1c34dc
28
29 diff --git a/dev-lang/python/python-3.11.0_beta2_p1.ebuild b/dev-lang/python/python-3.11.0_beta2_p1.ebuild
30 new file mode 100644
31 index 000000000000..e756eecece06
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.11.0_beta2_p1.ebuild
34 @@ -0,0 +1,421 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI="7"
39 +WANT_LIBTOOL="none"
40 +
41 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \
42 + python-utils-r1 toolchain-funcs verify-sig
43 +
44 +MY_PV=${PV/_beta/b}
45 +MY_P="Python-${MY_PV%_p*}"
46 +PYVER=$(ver_cut 1-2)
47 +PATCHSET="python-gentoo-patches-${MY_PV}"
48 +
49 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
50 +HOMEPAGE="
51 + https://www.python.org/
52 + https://github.com/python/cpython/
53 +"
54 +SRC_URI="
55 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
56 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
57 + verify-sig? (
58 + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
59 + )
60 +"
61 +S="${WORKDIR}/${MY_P}"
62 +
63 +LICENSE="PSF-2"
64 +SLOT="${PYVER}"
65 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
66 +IUSE="bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst"
67 +RESTRICT="!test? ( test )"
68 +
69 +# Do not add a dependency on dev-lang/python to this ebuild.
70 +# If you need to apply a patch which requires python for bootstrapping, please
71 +# run the bootstrap code on your dev box and include the results in the
72 +# patchset. See bug 447752.
73 +
74 +RDEPEND="
75 + app-arch/bzip2:=
76 + app-arch/xz-utils:=
77 + app-crypt/libb2
78 + >=dev-libs/expat-2.1:=
79 + dev-libs/libffi:=
80 + sys-apps/util-linux:=
81 + >=sys-libs/zlib-1.1.3:=
82 + virtual/libcrypt:=
83 + virtual/libintl
84 + gdbm? ( sys-libs/gdbm:=[berkdb] )
85 + ncurses? ( >=sys-libs/ncurses-5.2:= )
86 + readline? (
87 + !libedit? ( >=sys-libs/readline-4.1:= )
88 + libedit? ( dev-libs/libedit:= )
89 + )
90 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
91 + ssl? ( >=dev-libs/openssl-1.1.1:= )
92 + tk? (
93 + >=dev-lang/tcl-8.0:=
94 + >=dev-lang/tk-8.0:=
95 + dev-tcltk/blt:=
96 + dev-tcltk/tix
97 + )
98 + !!<sys-apps/sandbox-2.21
99 +"
100 +# bluetooth requires headers from bluez
101 +DEPEND="
102 + ${RDEPEND}
103 + bluetooth? ( net-wireless/bluez )
104 + test? ( app-arch/xz-utils[extra-filters(+)] )
105 +"
106 +# autoconf-archive needed to eautoreconf
107 +BDEPEND="
108 + sys-devel/autoconf-archive
109 + virtual/awk
110 + virtual/pkgconfig
111 + verify-sig? ( sec-keys/openpgp-keys-python )
112 + !sys-devel/gcc[libffi(-)]
113 +"
114 +RDEPEND+="
115 + !build? ( app-misc/mime-types )
116 +"
117 +if [[ ${PV} != *_alpha* ]]; then
118 + RDEPEND+="
119 + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
120 + "
121 +fi
122 +
123 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
124 +
125 +# large file tests involve a 2.5G file being copied (duplicated)
126 +CHECKREQS_DISK_BUILD=5500M
127 +
128 +QA_PKGCONFIG_VERSION=${PYVER}
129 +
130 +pkg_pretend() {
131 + use test && check-reqs_pkg_pretend
132 +}
133 +
134 +pkg_setup() {
135 + use test && check-reqs_pkg_setup
136 +}
137 +
138 +src_unpack() {
139 + if use verify-sig; then
140 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
141 + fi
142 + default
143 +}
144 +
145 +src_prepare() {
146 + # Ensure that internal copies of expat, libffi and zlib are not used.
147 + rm -fr Modules/expat || die
148 + rm -fr Modules/_ctypes/libffi* || die
149 + rm -fr Modules/zlib || die
150 +
151 + local PATCHES=(
152 + "${WORKDIR}/${PATCHSET}"
153 + )
154 +
155 + default
156 +
157 + # force correct number of jobs
158 + # https://bugs.gentoo.org/737660
159 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
160 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
161 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
162 +
163 + eautoreconf
164 +}
165 +
166 +src_configure() {
167 + local disable
168 + # disable automagic bluetooth headers detection
169 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
170 +
171 + append-flags -fwrapv
172 +
173 + filter-flags -malign-double
174 +
175 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
176 + if is-flagq -O3; then
177 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
178 + use hardened && replace-flags -O3 -O2
179 + fi
180 +
181 + # https://bugs.gentoo.org/700012
182 + if is-flagq -flto || is-flagq '-flto=*'; then
183 + append-cflags $(test-flags-CC -ffat-lto-objects)
184 + fi
185 +
186 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
187 + tc-export CXX
188 +
189 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
190 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
191 +
192 + local dbmliborder
193 + if use gdbm; then
194 + dbmliborder+="${dbmliborder:+:}gdbm"
195 + fi
196 +
197 + if use pgo; then
198 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
199 + export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network"
200 +
201 + # All of these seem to occasionally hang for PGO inconsistently
202 + # They'll even hang here but be fine in src_test sometimes.
203 + # bug #828535 (and related: bug #788022)
204 + PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc"
205 +
206 + if has_version "app-arch/rpm" ; then
207 + # Avoid sandbox failure (attempts to write to /var/lib/rpm)
208 + PROFILE_TASK+=" -x test_distutils"
209 + fi
210 + fi
211 +
212 + local myeconfargs=(
213 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
214 + # Python on glibc upgrade, remove it proactively to give
215 + # a chance for users rebuilding python before glibc
216 + ac_cv_header_stropts_h=no
217 +
218 + --enable-shared
219 + --without-static-libpython
220 + --enable-ipv6
221 + --infodir='${prefix}/share/info'
222 + --mandir='${prefix}/share/man'
223 + --with-computed-gotos
224 + --with-dbmliborder="${dbmliborder}"
225 + --with-libc=
226 + --enable-loadable-sqlite-extensions
227 + --without-ensurepip
228 + --with-system-expat
229 + --with-system-ffi
230 + --with-platlibdir=lib
231 + --with-pkg-config=yes
232 +
233 + $(use_with lto)
234 + $(use_enable pgo optimizations)
235 + $(use_with readline readline "$(usex libedit editline readline)")
236 + )
237 +
238 + # disable implicit optimization/debugging flags
239 + local -x OPT=
240 + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
241 + # propagated to sysconfig for built extensions
242 + local -x CFLAGS_NODIST=${CFLAGS}
243 + local -x LDFLAGS_NODIST=${LDFLAGS}
244 + local -x CFLAGS= LDFLAGS=
245 +
246 + econf "${myeconfargs[@]}"
247 +
248 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
249 + eerror "configure has detected that the sem_open function is broken."
250 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
251 + die "Broken sem_open function (bug 496328)"
252 + fi
253 +
254 + # force-disable modules we don't want built
255 + local disable_modules=(
256 + NIS
257 + )
258 + use gdbm || disable_modules+=( _GDBM _DBM )
259 + use sqlite || disable_modules+=( _SQLITE3 )
260 + use ssl || disable_modules+=( _HASHLIB _SSL )
261 + use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
262 + use readline || disable_modules+=( READLINE )
263 + use tk || disable_modules+=( _TKINTER )
264 +
265 + local mod
266 + for mod in "${disable_modules[@]}"; do
267 + echo "MODULE_${mod}=disabled"
268 + done >> Makefile || die
269 +}
270 +
271 +src_compile() {
272 + # Ensure sed works as expected
273 + # https://bugs.gentoo.org/594768
274 + local -x LC_ALL=C
275 + # Prevent using distutils bundled by setuptools.
276 + # https://bugs.gentoo.org/823728
277 + export SETUPTOOLS_USE_DISTUTILS=stdlib
278 + export PYTHONSTRICTEXTENSIONBUILD=1
279 +
280 + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
281 + # end up writing bytecode & violating sandbox.
282 + # bug #831897
283 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
284 +
285 + if use pgo ; then
286 + # bug 660358
287 + local -x COLUMNS=80
288 + local -x PYTHONDONTWRITEBYTECODE=
289 +
290 + addpredict /usr/lib/python3.11/site-packages
291 + fi
292 +
293 + # also need to clear the flags explicitly here or they end up
294 + # in _sysconfigdata*
295 + emake CPPFLAGS= CFLAGS= LDFLAGS=
296 +
297 + # Restore saved value from above.
298 + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
299 +
300 + # Work around bug 329499. See also bug 413751 and 457194.
301 + if has_version dev-libs/libffi[pax-kernel]; then
302 + pax-mark E python
303 + else
304 + pax-mark m python
305 + fi
306 +}
307 +
308 +src_test() {
309 + # Tests will not work when cross compiling.
310 + if tc-is-cross-compiler; then
311 + elog "Disabling tests due to crosscompiling."
312 + return
313 + fi
314 +
315 + # Skip failing tests.
316 + local skipped_tests="gdb"
317 +
318 + if use sparc ; then
319 + # bug #788022
320 + skipped_tests+=" multiprocessing_fork"
321 + skipped_tests+=" multiprocessing_forkserver"
322 + fi
323 +
324 + for test in ${skipped_tests}; do
325 + mv "${S}"/Lib/test/test_${test}.py "${T}"
326 + done
327 +
328 + # Expects to find skipped tests and fails
329 + mv "${S}"/Lib/test/test_tools/test_freeze.py "${T}" || die
330 +
331 + # bug 660358
332 + local -x COLUMNS=80
333 + local -x PYTHONDONTWRITEBYTECODE=
334 + # workaround https://bugs.gentoo.org/775416
335 + addwrite /usr/lib/python3.11/site-packages
336 +
337 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
338 +
339 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
340 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
341 + local result=$?
342 +
343 + for test in ${skipped_tests}; do
344 + mv "${T}/test_${test}.py" "${S}"/Lib/test
345 + done
346 +
347 + mv "${T}"/test_freeze.py "${S}"/Lib/test/test_tools/test_freeze.py || die
348 +
349 + elog "The following tests have been skipped:"
350 + for test in ${skipped_tests}; do
351 + elog "test_${test}.py"
352 + done
353 +
354 + elog "If you would like to run them, you may:"
355 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
356 + elog "and run the tests separately."
357 +
358 + if [[ ${result} -ne 0 ]]; then
359 + die "emake test failed"
360 + fi
361 +}
362 +
363 +src_install() {
364 + local libdir=${ED}/usr/lib/python${PYVER}
365 +
366 + # -j1 hack for now for bug #843458
367 + emake -j1 DESTDIR="${D}" altinstall
368 +
369 + # Fix collisions between different slots of Python.
370 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
371 +
372 + # Cheap hack to get version with ABIFLAGS
373 + local abiver=$(cd "${ED}/usr/include"; echo python*)
374 + if [[ ${abiver} != python${PYVER} ]]; then
375 + # Replace python3.X with a symlink to python3.Xm
376 + rm "${ED}/usr/bin/python${PYVER}" || die
377 + dosym "${abiver}" "/usr/bin/python${PYVER}"
378 + # Create python3.X-config symlink
379 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
380 + # Create python-3.5m.pc symlink
381 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
382 + fi
383 +
384 + # python seems to get rebuilt in src_install (bug 569908)
385 + # Work around it for now.
386 + if has_version dev-libs/libffi[pax-kernel]; then
387 + pax-mark E "${ED}/usr/bin/${abiver}"
388 + else
389 + pax-mark m "${ED}/usr/bin/${abiver}"
390 + fi
391 +
392 + use sqlite || rm -r "${libdir}/"sqlite3 || die
393 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
394 +
395 + dodoc Misc/{ACKS,HISTORY,NEWS}
396 +
397 + if use examples; then
398 + docinto examples
399 + find Tools -name __pycache__ -exec rm -fr {} + || die
400 + dodoc -r Tools
401 + fi
402 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
403 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
404 + emake --no-print-directory -s -f - 2>/dev/null)
405 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
406 +
407 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
408 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
409 + sed \
410 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
411 + -e "s:@PYDOC@:pydoc${PYVER}:" \
412 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
413 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
414 +
415 + local -x EPYTHON=python${PYVER}
416 + # if not using a cross-compiler, use the fresh binary
417 + if ! tc-is-cross-compiler; then
418 + local -x PYTHON=./python
419 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
420 + else
421 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
422 + fi
423 +
424 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
425 + python_domodule epython.py
426 +
427 + # python-exec wrapping support
428 + local pymajor=${PYVER%.*}
429 + local scriptdir=${D}$(python_get_scriptdir)
430 + mkdir -p "${scriptdir}" || die
431 + # python and pythonX
432 + ln -s "../../../bin/${abiver}" \
433 + "${scriptdir}/python${pymajor}" || die
434 + ln -s "python${pymajor}" "${scriptdir}/python" || die
435 + # python-config and pythonX-config
436 + # note: we need to create a wrapper rather than symlinking it due
437 + # to some random dirname(argv[0]) magic performed by python-config
438 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
439 + #!/bin/sh
440 + exec "${abiver}-config" "\${@}"
441 + EOF
442 + chmod +x "${scriptdir}/python${pymajor}-config" || die
443 + ln -s "python${pymajor}-config" \
444 + "${scriptdir}/python-config" || die
445 + # 2to3, pydoc
446 + ln -s "../../../bin/2to3-${PYVER}" \
447 + "${scriptdir}/2to3" || die
448 + ln -s "../../../bin/pydoc${PYVER}" \
449 + "${scriptdir}/pydoc" || die
450 + # idle
451 + if use tk; then
452 + ln -s "../../../bin/idle${PYVER}" \
453 + "${scriptdir}/idle" || die
454 + fi
455 +}