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: Thu, 28 Apr 2022 23:41:05
Message-Id: 1651189176.5d50dbedddc127ef3e1ed6ac0b5306ef567a6f17.quentin@gentoo
1 commit: 5d50dbedddc127ef3e1ed6ac0b5306ef567a6f17
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Wed Apr 27 16:33:20 2022 +0000
4 Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
5 CommitDate: Thu Apr 28 23:39:36 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=5d50dbed
7
8 dev-lang/python: Updated for version 3.9.11.
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 | 3 +
14 dev-lang/python/python-3.9.11.ebuild | 397 +++++++++++++++++++++++++++++++++++
15 2 files changed, 400 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 6ac1ee9..99c95f6 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -1,3 +1,6 @@
22 +DIST Python-3.9.11.tar.xz 19724780 BLAKE2B 25b017e36b22235790633eb1a88f52092225252f39963fc365c1ea863f5b5d98a796bceb01e5e34c02d9690f2a664959766b214b8c13350d6e22839218d0c097 SHA512 804e6e6b31922378f07f290023f6efc870c6fd3010204c499c2b375880f6e6ec0f72ce96a8fff81956f6fa3bea2123df2138ef0fda23a3d5d3cf757174a930c3
23 +DIST Python-3.9.11.tar.xz.asc 833 BLAKE2B c60c291f3dad39c842d16717239006f3ee703eaa586d95ea02ba4486d20a1e82065bbaf7af6f7cf6a04799229359791a72834096b6ce5f5d2b583ba5962d441b SHA512 a84bbfa68ec1c0e45bbd64af4481be7d68885021287731c69346a3cb25c9bf607be84dd72af2d3a6fbeabbde64975f37c4bb4f61274e72b92b4277fa48543e52
24 DIST Python-3.9.9.tar.xz 19144372 BLAKE2B 3a144ca5e4b11b2fd09d05a4a40ddf3f622c077338602c519b21ea827c96e0f14ab97563c0a9d306ae4a5c3f44753573a07474dc084fb364d24b2128bb378ddd SHA512 0ab29fb9a7ecb808bd08d84d28908d5a934e0f021853da0f7a9c94670eb30c8dbbc233d461afdb3995b0de59275ef7e1de43e82d7f848802cbd6e6e50b7b25a6
25 DIST Python-3.9.9.tar.xz.asc 833 BLAKE2B 41d05ee1ec256f0cab4e9d3540877783745f0f30e3f1177d01096b352341a90893c5c9523926bed8176bd304cbb1fd6619be3b4e375103874eac5e5ebc113135 SHA512 84fb739c60216ab9a7a487a0ec4039a7e85c7684ef1f71d8b3bc415ff2ae284f79474103ae05385502bc2510401f8cfb33d84dccf5d0ea9a0dd62528519d935f
26 +DIST python-gentoo-patches-3.9.11.tar.xz 12844 BLAKE2B de7ffa39e96127949d2b894fe15c8c1345180842791743af14a3728a7c950e877ab7c74f3e72da5518b16ecb2f3ff13e6132740bb067fe43a8359c673befbaf5 SHA512 0507792188587e66d63a70dde17c6aea1c9aab9e40ace3aeb585adbd2c62acf828782312ba7523f7a4ea49ab1125a30c7b091d10fe02874b018f2733fb8e141d
27 DIST python-gentoo-patches-3.9.9.tar.xz 13200 BLAKE2B 672e3b79094cbc791988639a5dde4c9e5622e91bef4310d26838716c65763ca69a12c6afef2f19487f4389974af009896e452c19783b0a491072d13f893af7e9 SHA512 3cd4ddd070ab48d9978e1136d237fc24030fd3ce6704371ce99815702a45d839ee26c7e9552b004661827759edd30222434e4166f9ee16f873ad4783c83f723f
28
29 diff --git a/dev-lang/python/python-3.9.11.ebuild b/dev-lang/python/python-3.9.11.ebuild
30 new file mode 100644
31 index 0000000..b46705c
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.9.11.ebuild
34 @@ -0,0 +1,397 @@
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/_rc/rc}
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="https://www.python.org/"
51 +SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz
52 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
53 + verify-sig? (
54 + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc
55 + )"
56 +S="${WORKDIR}/${MY_P}"
57 +
58 +LICENSE="PSF-2"
59 +SLOT="${PYVER}"
60 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
61 +IUSE="bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml"
62 +RESTRICT="!test? ( test )"
63 +
64 +# Do not add a dependency on dev-lang/python to this ebuild.
65 +# If you need to apply a patch which requires python for bootstrapping, please
66 +# run the bootstrap code on your dev box and include the results in the
67 +# patchset. See bug 447752.
68 +
69 +RDEPEND="app-arch/bzip2:=
70 + app-arch/xz-utils:=
71 + dev-lang/python-exec[python_targets_python3_9(-)]
72 + dev-libs/libffi:=
73 + sys-apps/util-linux:=
74 + >=sys-libs/zlib-1.1.3:=
75 + virtual/libcrypt:=
76 + virtual/libintl
77 + gdbm? ( sys-libs/gdbm:=[berkdb] )
78 + ncurses? ( >=sys-libs/ncurses-5.2:= )
79 + readline? ( >=sys-libs/readline-4.1:= )
80 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
81 + ssl? ( >=dev-libs/openssl-1.1.1:= )
82 + tk? (
83 + >=dev-lang/tcl-8.0:=
84 + >=dev-lang/tk-8.0:=
85 + dev-tcltk/blt:=
86 + dev-tcltk/tix
87 + )
88 + xml? ( >=dev-libs/expat-2.1:= )"
89 +# bluetooth requires headers from bluez
90 +DEPEND="${RDEPEND}
91 + bluetooth? ( net-wireless/bluez )
92 + test? ( app-arch/xz-utils[extra-filters(+)] )"
93 +BDEPEND="
94 + virtual/awk
95 + virtual/pkgconfig
96 + sys-devel/autoconf-archive
97 + verify-sig? ( sec-keys/openpgp-keys-python )
98 + !sys-devel/gcc[libffi(-)]"
99 +RDEPEND+=" !build? ( app-misc/mime-types )"
100 +
101 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
102 +
103 +# large file tests involve a 2.5G file being copied (duplicated)
104 +CHECKREQS_DISK_BUILD=5500M
105 +
106 +pkg_pretend() {
107 + use test && check-reqs_pkg_pretend
108 +}
109 +
110 +pkg_setup() {
111 + use test && check-reqs_pkg_setup
112 +}
113 +
114 +src_unpack() {
115 + if use verify-sig; then
116 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
117 + fi
118 + default
119 +}
120 +
121 +src_prepare() {
122 + # Ensure that internal copies of expat, libffi and zlib are not used.
123 + rm -fr Modules/expat || die
124 + rm -fr Modules/_ctypes/libffi* || die
125 + rm -fr Modules/zlib || die
126 +
127 + rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die
128 +
129 + local PATCHES=(
130 + "${WORKDIR}/${PATCHSET}"
131 + "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch
132 + )
133 +
134 + default
135 +
136 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
137 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
138 +
139 + # force correct number of jobs
140 + # https://bugs.gentoo.org/737660
141 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
142 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
143 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
144 +
145 + eautoreconf
146 +}
147 +
148 +src_configure() {
149 + local disable
150 + # disable automagic bluetooth headers detection
151 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
152 + use gdbm || disable+=" gdbm"
153 + use ncurses || disable+=" _curses _curses_panel"
154 + use readline || disable+=" readline"
155 + use sqlite || disable+=" _sqlite3"
156 + use ssl || export PYTHON_DISABLE_SSL="1"
157 + use tk || disable+=" _tkinter"
158 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
159 + export PYTHON_DISABLE_MODULES="${disable}"
160 +
161 + if ! use xml; then
162 + ewarn "You have configured Python without XML support."
163 + ewarn "This is NOT a recommended configuration as you"
164 + ewarn "may face problems parsing any XML documents."
165 + fi
166 +
167 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
168 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
169 + fi
170 +
171 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
172 + append-flags -fwrapv
173 + fi
174 +
175 + filter-flags -malign-double
176 +
177 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
178 + if is-flagq -O3; then
179 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
180 + use hardened && replace-flags -O3 -O2
181 + fi
182 +
183 + # https://bugs.gentoo.org/700012
184 + if is-flagq -flto || is-flagq '-flto=*'; then
185 + append-cflags $(test-flags-CC -ffat-lto-objects)
186 + fi
187 +
188 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
189 + tc-export CXX
190 +
191 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
192 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
193 +
194 + local dbmliborder
195 + if use gdbm; then
196 + dbmliborder+="${dbmliborder:+:}gdbm"
197 + fi
198 +
199 + if use pgo; then
200 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
201 + export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network"
202 +
203 + # All of these seem to occasionally hang for PGO inconsistently
204 + # They'll even hang here but be fine in src_test sometimes.
205 + # bug #828535 (and related: bug #788022)
206 + PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc"
207 +
208 + if has_version "app-arch/rpm" ; then
209 + # Avoid sandbox failure (attempts to write to /var/lib/rpm)
210 + PROFILE_TASK+=" -x test_distutils"
211 + fi
212 + fi
213 +
214 + local myeconfargs=(
215 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
216 + # Python on glibc upgrade, remove it proactively to give
217 + # a chance for users rebuilding python before glibc
218 + ac_cv_header_stropts_h=no
219 +
220 + --enable-shared
221 + --enable-ipv6
222 + --infodir='${prefix}/share/info'
223 + --mandir='${prefix}/share/man'
224 + --with-computed-gotos
225 + --with-dbmliborder="${dbmliborder}"
226 + --with-libc=
227 + --enable-loadable-sqlite-extensions
228 + --without-ensurepip
229 + --with-system-expat
230 + --with-system-ffi
231 +
232 + $(use_with lto)
233 + $(use_enable pgo optimizations)
234 + )
235 +
236 + # disable implicit optimization/debugging flags
237 + local -x OPT=
238 + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
239 + # propagated to sysconfig for built extensions
240 + local -x CFLAGS_NODIST=${CFLAGS}
241 + local -x LDFLAGS_NODIST=${LDFLAGS}
242 + local -x CFLAGS= LDFLAGS=
243 +
244 + econf "${myeconfargs[@]}"
245 +
246 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
247 + eerror "configure has detected that the sem_open function is broken."
248 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
249 + die "Broken sem_open function (bug 496328)"
250 + fi
251 +}
252 +
253 +src_compile() {
254 + # Ensure sed works as expected
255 + # https://bugs.gentoo.org/594768
256 + local -x LC_ALL=C
257 + # Prevent using distutils bundled by setuptools.
258 + # https://bugs.gentoo.org/823728
259 + export SETUPTOOLS_USE_DISTUTILS=stdlib
260 +
261 + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
262 + # end up writing bytecode & violating sandbox.
263 + # bug #831897
264 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
265 +
266 + if use pgo ; then
267 + # bug 660358
268 + local -x COLUMNS=80
269 + local -x PYTHONDONTWRITEBYTECODE=
270 +
271 + addpredict /usr/lib/python3.9/site-packages
272 + fi
273 +
274 + # also need to clear the flags explicitly here or they end up
275 + # in _sysconfigdata*
276 + emake CPPFLAGS= CFLAGS= LDFLAGS=
277 +
278 + # Restore saved value from above.
279 + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
280 +
281 + # Work around bug 329499. See also bug 413751 and 457194.
282 + if has_version dev-libs/libffi[pax-kernel]; then
283 + pax-mark E python
284 + else
285 + pax-mark m python
286 + fi
287 +}
288 +
289 +src_test() {
290 + # Tests will not work when cross compiling.
291 + if tc-is-cross-compiler; then
292 + elog "Disabling tests due to crosscompiling."
293 + return
294 + fi
295 +
296 + # Skip failing tests.
297 + local skipped_tests="gdb"
298 +
299 + if use sparc ; then
300 + # bug #788022
301 + skipped_tests+=" multiprocessing_fork"
302 + skipped_tests+=" multiprocessing_forkserver"
303 + fi
304 +
305 + for test in ${skipped_tests}; do
306 + mv "${S}"/Lib/test/test_${test}.py "${T}"
307 + done
308 +
309 + # bug 660358
310 + local -x COLUMNS=80
311 + local -x PYTHONDONTWRITEBYTECODE=
312 +
313 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
314 +
315 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
316 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
317 + local result=$?
318 +
319 + for test in ${skipped_tests}; do
320 + mv "${T}/test_${test}.py" "${S}"/Lib/test
321 + done
322 +
323 + elog "The following tests have been skipped:"
324 + for test in ${skipped_tests}; do
325 + elog "test_${test}.py"
326 + done
327 +
328 + elog "If you would like to run them, you may:"
329 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
330 + elog "and run the tests separately."
331 +
332 + if [[ ${result} -ne 0 ]]; then
333 + die "emake test failed"
334 + fi
335 +}
336 +
337 +src_install() {
338 + local libdir=${ED}/usr/lib/python${PYVER}
339 +
340 + emake DESTDIR="${D}" altinstall
341 +
342 + # Remove static library
343 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
344 +
345 + # Fix collisions between different slots of Python.
346 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
347 +
348 + # Cheap hack to get version with ABIFLAGS
349 + local abiver=$(cd "${ED}/usr/include"; echo python*)
350 + if [[ ${abiver} != python${PYVER} ]]; then
351 + # Replace python3.X with a symlink to python3.Xm
352 + rm "${ED}/usr/bin/python${PYVER}" || die
353 + dosym "${abiver}" "/usr/bin/python${PYVER}"
354 + # Create python3.X-config symlink
355 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
356 + # Create python-3.5m.pc symlink
357 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
358 + fi
359 +
360 + # python seems to get rebuilt in src_install (bug 569908)
361 + # Work around it for now.
362 + if has_version dev-libs/libffi[pax-kernel]; then
363 + pax-mark E "${ED}/usr/bin/${abiver}"
364 + else
365 + pax-mark m "${ED}/usr/bin/${abiver}"
366 + fi
367 +
368 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
369 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
370 +
371 + dodoc Misc/{ACKS,HISTORY,NEWS}
372 +
373 + if use examples; then
374 + docinto examples
375 + find Tools -name __pycache__ -exec rm -fr {} + || die
376 + dodoc -r Tools
377 + fi
378 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
379 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
380 + emake --no-print-directory -s -f - 2>/dev/null)
381 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
382 +
383 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
384 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
385 + sed \
386 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
387 + -e "s:@PYDOC@:pydoc${PYVER}:" \
388 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
389 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
390 +
391 + local -x EPYTHON=python${PYVER}
392 + # if not using a cross-compiler, use the fresh binary
393 + if ! tc-is-cross-compiler; then
394 + local -x PYTHON=./python
395 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
396 + else
397 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
398 + fi
399 +
400 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
401 + python_domodule epython.py
402 +
403 + # python-exec wrapping support
404 + local pymajor=${PYVER%.*}
405 + local scriptdir=${D}$(python_get_scriptdir)
406 + mkdir -p "${scriptdir}" || die
407 + # python and pythonX
408 + ln -s "../../../bin/${abiver}" \
409 + "${scriptdir}/python${pymajor}" || die
410 + ln -s "python${pymajor}" "${scriptdir}/python" || die
411 + # python-config and pythonX-config
412 + # note: we need to create a wrapper rather than symlinking it due
413 + # to some random dirname(argv[0]) magic performed by python-config
414 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
415 + #!/bin/sh
416 + exec "${abiver}-config" "\${@}"
417 + EOF
418 + chmod +x "${scriptdir}/python${pymajor}-config" || die
419 + ln -s "python${pymajor}-config" \
420 + "${scriptdir}/python-config" || die
421 + # 2to3, pydoc
422 + ln -s "../../../bin/2to3-${PYVER}" \
423 + "${scriptdir}/2to3" || die
424 + ln -s "../../../bin/pydoc${PYVER}" \
425 + "${scriptdir}/pydoc" || die
426 + # idle
427 + if use tk; then
428 + ln -s "../../../bin/idle${PYVER}" \
429 + "${scriptdir}/idle" || die
430 + fi
431 +}