Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/python/
Date: Sat, 06 Nov 2021 02:27:48
Message-Id: 1636165652.97dc69b3260a5b9cea14d535b3d6c5b5c1725a69.sam@gentoo
1 commit: 97dc69b3260a5b9cea14d535b3d6c5b5c1725a69
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 6 02:27:24 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 6 02:27:32 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=97dc69b3
7
8 dev-lang/python: add 3.9.8
9
10 Signed-off-by: Sam James <sam <AT> gentoo.org>
11
12 dev-lang/python/Manifest | 3 +
13 dev-lang/python/python-3.9.8.ebuild | 346 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 349 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 8a649ef211d..11aec1547f7 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -14,6 +14,8 @@ DIST Python-3.8.12.tar.xz 18443568 BLAKE2B 73413aee7a31347ac4342718a54d23d403622
21 DIST Python-3.8.12.tar.xz.asc 833 BLAKE2B 33f59aa667555832ee510d2a7295079f34a3983dfa84beab20b33ec691ea3eecfcc4a62591fe233fc30622d0236ee69a3d41b8922ee2f4c632df3523d565c3ec SHA512 ef552b716a721f410abb14387594c8b0ddc65ce4b8a6ae6bf920c1db2ea9ddf6bbf547e93d3716495ae31848eb1049aae4257016e888393681bbfb6f6529bc12
22 DIST Python-3.9.7.tar.xz 19123232 BLAKE2B 69dfba6974c8c74de1b71977d28cad4d7c26615695f48a99444d2eb83d657b4bd8d22e7f6e94b1b2dcbcc5605c0aee08c609b9564e306f48588e2a7f471209b2 SHA512 55139776ab58a40f9e1e70613d7071d559ef9e51e32a77791422aac134322c21a49f0348c42813214b69789c589367eae43e16d4ae838a73daf37617e966b735
23 DIST Python-3.9.7.tar.xz.asc 833 BLAKE2B 2d9c47e47d9a625e393a8b456dd5b10dd485fc13ca7c236b5fd304c373879bea8ab3c67ff99c3a81350443f6ccba20718466a221a05faada6b82cfe92943fdbf SHA512 7ff9f845f520efab3b4a0e95da3ffe055ee5777a4173a5b2cc1fd2419dc2b4faf30d1e711e372df36e34bc971ecfcde88a7cd815cfe2d8080ccb575a1ae8e101
24 +DIST Python-3.9.8.tar.xz 19149464 BLAKE2B 739eb22bae8b44cf5be9a24ca6ecacb80eaca65684abf1fef18b7adcac9adede2eff60e8a9ac5db2672511d180d6079c39e2ff2901ab454c0876ae8e1bfe96cc SHA512 5d5b46a242525b2e6a7f9c69c63c6d7cd985e1443a7d9b716107e75f14fef7b5c9c2e5e8a90adbbbf5f7a8b90a483d01e18c1732470e6e54b611b5aba9f99fe1
25 +DIST Python-3.9.8.tar.xz.asc 833 BLAKE2B ec94293d0d28398b425a0a6cd502f6540b23f6788874160216d0575fe23a4ad8e5636c5d4deae7bc193d00bd18aff12f935a6ea807786a87f041046d6693fd20 SHA512 1329a8e114feb010bb3618472cddd9fdea59fc38e9583002eb457e1c0cf1716bd7c0d51887e91b9eef09c3977879aa4be9909e5997be7dfdcca08ca04794bfaf
26 DIST python-gentoo-patches-2.7.18_p13.tar.xz 33296 BLAKE2B 91b711458aff4f6337ee1b34aff58d7edda6725644a64c9320076a1e04c816729ed163d82333cfe4dfef379a9ad5ef50ba00abdbbfed4503b0f92c8f0b7ca683 SHA512 97f3657a4a95e8492aa710801b974a56e6dd4636e475aea45cbbe76e7ae32d00f07b05769887f05e49cb0df8584ac9499a7ce842bad77f837a7c869f9b769b07
27 DIST python-gentoo-patches-3.10.0_p1.tar.xz 10068 BLAKE2B 1c9817b449831559f0a0b722c02a5f55d94b3dfde98e5882c1403fe24a4addf7074ab39c09b91cff6fd7ace2e4b6e8ed899d9a0b9ffd6612ce315c4c192bd309 SHA512 39aa41dbf17b6dc5255491c75031a3dae6962b44125e426dbfdce365a6533c5dae9856b1fff8016a189124b7cff72d2665ce99da344c2f9dff005ba685e8c2c4
28 DIST python-gentoo-patches-3.11.0a1.tar.xz 9468 BLAKE2B 9bbc0c41d366752d2481c19070d71c27f88fd605e35e62f6b86498cb537051e92972f3c3f7b234485fd07e2a6ac4e4d6701e03e7893897531da58fbaaa609e76 SHA512 a06274c8c1d772121ac9570125eea12a4e53bcac030b8f4f3c5c76d68fc475df3f073a4dffe55614ced9cf031c7581e428b1cee67078c63d4f41e0a51e372e41
29 @@ -22,3 +24,4 @@ DIST python-gentoo-patches-3.6.15.tar.xz 15300 BLAKE2B f49fd96f6ad1a1c94fea6b83a
30 DIST python-gentoo-patches-3.7.12_p1.tar.xz 19112 BLAKE2B e9964244af3db544dd6e96d85ca4bc24d7131b48eda85df5bafa3fb36474a024cecbbf4b27324e1f35f76ae6a1aed31dd7896e831b79b574b45a4371afcc7e5b SHA512 9ec996c2904f99bd6651ed1b700eabd91f2b82b1e9e0f3d9572243886a9c7139bf8ac2af04169485d3ca6339e1a87044cba203f6f0aee9609d2a1d53c812548d
31 DIST python-gentoo-patches-3.8.12_p1.tar.xz 16632 BLAKE2B cce7a41d020af1ffc55a01ef67b20bcb16c68adbccc1e44ef166d1707e817ed6c3bae70f84c56553f27bca449015e273014c0be73bc2f9b4e25844ddce385486 SHA512 4621727c2e9cc1c5519e021210e16a97e7167ea831445dfdd07f5b0ed642b5919834244111708a971ce098b10b439797e1c76827eccab803f801052c671f1ae6
32 DIST python-gentoo-patches-3.9.7_p1.tar.xz 14444 BLAKE2B c976beb1205b0b777ff3375f538758bf28443bcf4c953fe161545791763da043e32582c398ec8151478afc40e53f963e080d29420066305c12963c953887e4b8 SHA512 283c8975885f9306e46a0047219f3a70e1000f3401affb0b55cde976be6fb6df2f1c13f4e05a479e72e0731d683fef9b22413f7cd320298295a31b19c8915b3d
33 +DIST python-gentoo-patches-3.9.8.tar.xz 13192 BLAKE2B 995bead7e87b1d2eb9984012065c0f752d51e5a78dd9019270e071f83660cdab71c39e5be0104919f5af9089dede71d9c918a521f76e67c6ef1aeab5ffb58991 SHA512 80dfa3766bb5546924a5fccf4f469ce409cb8a4b0873c3d2fb737b3eb27b7c2b29337e0179624bbe077273b8e475f7921d6479ca7eb8e31ba423d0cea2f3d1cf
34
35 diff --git a/dev-lang/python/python-3.9.8.ebuild b/dev-lang/python/python-3.9.8.ebuild
36 new file mode 100644
37 index 00000000000..796265447e8
38 --- /dev/null
39 +++ b/dev-lang/python/python-3.9.8.ebuild
40 @@ -0,0 +1,346 @@
41 +# Copyright 1999-2021 Gentoo Authors
42 +# Distributed under the terms of the GNU General Public License v2
43 +
44 +EAPI="7"
45 +WANT_LIBTOOL="none"
46 +
47 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \
48 + python-utils-r1 toolchain-funcs verify-sig
49 +
50 +MY_PV=${PV/_rc/rc}
51 +MY_P="Python-${MY_PV%_p*}"
52 +PYVER=$(ver_cut 1-2)
53 +PATCHSET="python-gentoo-patches-${MY_PV}"
54 +
55 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
56 +HOMEPAGE="https://www.python.org/"
57 +SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz
58 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
59 + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${PATCHSET}.tar.xz
60 + verify-sig? (
61 + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc
62 + )"
63 +S="${WORKDIR}/${MY_P}"
64 +
65 +LICENSE="PSF-2"
66 +SLOT="${PYVER}"
67 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
68 +IUSE="bluetooth build examples gdbm hardened +ncurses +readline +sqlite +ssl test tk wininst +xml"
69 +RESTRICT="!test? ( test )"
70 +
71 +# Do not add a dependency on dev-lang/python to this ebuild.
72 +# If you need to apply a patch which requires python for bootstrapping, please
73 +# run the bootstrap code on your dev box and include the results in the
74 +# patchset. See bug 447752.
75 +
76 +RDEPEND="app-arch/bzip2:=
77 + app-arch/xz-utils:=
78 + dev-libs/libffi:=
79 + sys-apps/util-linux:=
80 + >=sys-libs/zlib-1.1.3:=
81 + virtual/libcrypt:=
82 + virtual/libintl
83 + gdbm? ( sys-libs/gdbm:=[berkdb] )
84 + ncurses? ( >=sys-libs/ncurses-5.2:= )
85 + readline? ( >=sys-libs/readline-4.1:= )
86 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
87 + ssl? ( >=dev-libs/openssl-1.1.1:= )
88 + tk? (
89 + >=dev-lang/tcl-8.0:=
90 + >=dev-lang/tk-8.0:=
91 + dev-tcltk/blt:=
92 + dev-tcltk/tix
93 + )
94 + xml? ( >=dev-libs/expat-2.1:= )"
95 +# bluetooth requires headers from bluez
96 +DEPEND="${RDEPEND}
97 + bluetooth? ( net-wireless/bluez )
98 + test? ( app-arch/xz-utils[extra-filters(+)] )"
99 +BDEPEND="
100 + virtual/awk
101 + virtual/pkgconfig
102 + sys-devel/autoconf-archive
103 + verify-sig? ( app-crypt/openpgp-keys-python )
104 + !sys-devel/gcc[libffi(-)]"
105 +RDEPEND+=" !build? ( app-misc/mime-types )"
106 +
107 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
108 +
109 +# large file tests involve a 2.5G file being copied (duplicated)
110 +CHECKREQS_DISK_BUILD=5500M
111 +
112 +pkg_pretend() {
113 + use test && check-reqs_pkg_pretend
114 +}
115 +
116 +pkg_setup() {
117 + use test && check-reqs_pkg_setup
118 +}
119 +
120 +src_unpack() {
121 + if use verify-sig; then
122 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
123 + fi
124 + default
125 +}
126 +
127 +src_prepare() {
128 + # Ensure that internal copies of expat, libffi and zlib are not used.
129 + rm -fr Modules/expat || die
130 + rm -fr Modules/_ctypes/libffi* || die
131 + rm -fr Modules/zlib || die
132 +
133 + local PATCHES=(
134 + "${WORKDIR}/${PATCHSET}"
135 + )
136 +
137 + default
138 +
139 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
140 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
141 +
142 + # force correct number of jobs
143 + # https://bugs.gentoo.org/737660
144 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
145 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
146 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
147 +
148 + eautoreconf
149 +}
150 +
151 +src_configure() {
152 + local disable
153 + # disable automagic bluetooth headers detection
154 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
155 + use gdbm || disable+=" gdbm"
156 + use ncurses || disable+=" _curses _curses_panel"
157 + use readline || disable+=" readline"
158 + use sqlite || disable+=" _sqlite3"
159 + use ssl || export PYTHON_DISABLE_SSL="1"
160 + use tk || disable+=" _tkinter"
161 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
162 + export PYTHON_DISABLE_MODULES="${disable}"
163 +
164 + if ! use xml; then
165 + ewarn "You have configured Python without XML support."
166 + ewarn "This is NOT a recommended configuration as you"
167 + ewarn "may face problems parsing any XML documents."
168 + fi
169 +
170 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
171 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
172 + fi
173 +
174 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
175 + append-flags -fwrapv
176 + fi
177 +
178 + filter-flags -malign-double
179 +
180 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
181 + if is-flagq -O3; then
182 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
183 + use hardened && replace-flags -O3 -O2
184 + fi
185 +
186 + # https://bugs.gentoo.org/700012
187 + if is-flagq -flto || is-flagq '-flto=*'; then
188 + append-cflags $(test-flags-CC -ffat-lto-objects)
189 + fi
190 +
191 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
192 + tc-export CXX
193 +
194 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
195 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
196 +
197 + local dbmliborder
198 + if use gdbm; then
199 + dbmliborder+="${dbmliborder:+:}gdbm"
200 + fi
201 +
202 + local myeconfargs=(
203 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
204 + # Python on glibc upgrade, remove it proactively to give
205 + # a chance for users rebuilding python before glibc
206 + ac_cv_header_stropts_h=no
207 +
208 + --enable-shared
209 + --enable-ipv6
210 + --infodir='${prefix}/share/info'
211 + --mandir='${prefix}/share/man'
212 + --with-computed-gotos
213 + --with-dbmliborder="${dbmliborder}"
214 + --with-libc=
215 + --enable-loadable-sqlite-extensions
216 + --without-ensurepip
217 + --with-system-expat
218 + --with-system-ffi
219 + )
220 +
221 + OPT="" econf "${myeconfargs[@]}"
222 +
223 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
224 + eerror "configure has detected that the sem_open function is broken."
225 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
226 + die "Broken sem_open function (bug 496328)"
227 + fi
228 +}
229 +
230 +src_compile() {
231 + # Ensure sed works as expected
232 + # https://bugs.gentoo.org/594768
233 + local -x LC_ALL=C
234 +
235 + emake CPPFLAGS= CFLAGS= LDFLAGS=
236 +
237 + # Work around bug 329499. See also bug 413751 and 457194.
238 + if has_version dev-libs/libffi[pax-kernel]; then
239 + pax-mark E python
240 + else
241 + pax-mark m python
242 + fi
243 +}
244 +
245 +src_test() {
246 + # Tests will not work when cross compiling.
247 + if tc-is-cross-compiler; then
248 + elog "Disabling tests due to crosscompiling."
249 + return
250 + fi
251 +
252 + # Skip failing tests.
253 + local skipped_tests="gdb"
254 +
255 + for test in ${skipped_tests}; do
256 + mv "${S}"/Lib/test/test_${test}.py "${T}"
257 + done
258 +
259 + # bug 660358
260 + local -x COLUMNS=80
261 + local -x PYTHONDONTWRITEBYTECODE=
262 +
263 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
264 +
265 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
266 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
267 + local result=$?
268 +
269 + for test in ${skipped_tests}; do
270 + mv "${T}/test_${test}.py" "${S}"/Lib/test
271 + done
272 +
273 + elog "The following tests have been skipped:"
274 + for test in ${skipped_tests}; do
275 + elog "test_${test}.py"
276 + done
277 +
278 + elog "If you would like to run them, you may:"
279 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
280 + elog "and run the tests separately."
281 +
282 + if [[ ${result} -ne 0 ]]; then
283 + die "emake test failed"
284 + fi
285 +}
286 +
287 +src_install() {
288 + local libdir=${ED}/usr/lib/python${PYVER}
289 +
290 + emake DESTDIR="${D}" altinstall
291 +
292 + # Remove static library
293 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
294 +
295 + sed \
296 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
297 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
298 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
299 +
300 + # Fix collisions between different slots of Python.
301 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
302 +
303 + # Cheap hack to get version with ABIFLAGS
304 + local abiver=$(cd "${ED}/usr/include"; echo python*)
305 + if [[ ${abiver} != python${PYVER} ]]; then
306 + # Replace python3.X with a symlink to python3.Xm
307 + rm "${ED}/usr/bin/python${PYVER}" || die
308 + dosym "${abiver}" "/usr/bin/python${PYVER}"
309 + # Create python3.X-config symlink
310 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
311 + # Create python-3.5m.pc symlink
312 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
313 + fi
314 +
315 + # python seems to get rebuilt in src_install (bug 569908)
316 + # Work around it for now.
317 + if has_version dev-libs/libffi[pax-kernel]; then
318 + pax-mark E "${ED}/usr/bin/${abiver}"
319 + else
320 + pax-mark m "${ED}/usr/bin/${abiver}"
321 + fi
322 +
323 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
324 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
325 +
326 + dodoc Misc/{ACKS,HISTORY,NEWS}
327 +
328 + if use examples; then
329 + docinto examples
330 + find Tools -name __pycache__ -exec rm -fr {} + || die
331 + dodoc -r Tools
332 + fi
333 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
334 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
335 + emake --no-print-directory -s -f - 2>/dev/null)
336 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
337 +
338 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
339 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
340 + sed \
341 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
342 + -e "s:@PYDOC@:pydoc${PYVER}:" \
343 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
344 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
345 +
346 + local -x EPYTHON=python${PYVER}
347 + # if not using a cross-compiler, use the fresh binary
348 + if ! tc-is-cross-compiler; then
349 + local -x PYTHON=./python
350 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
351 + else
352 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
353 + fi
354 +
355 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
356 + python_domodule epython.py
357 +
358 + # python-exec wrapping support
359 + local pymajor=${PYVER%.*}
360 + local scriptdir=${D}$(python_get_scriptdir)
361 + mkdir -p "${scriptdir}" || die
362 + # python and pythonX
363 + ln -s "../../../bin/${abiver}" \
364 + "${scriptdir}/python${pymajor}" || die
365 + ln -s "python${pymajor}" "${scriptdir}/python" || die
366 + # python-config and pythonX-config
367 + # note: we need to create a wrapper rather than symlinking it due
368 + # to some random dirname(argv[0]) magic performed by python-config
369 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
370 + #!/bin/sh
371 + exec "${abiver}-config" "\${@}"
372 + EOF
373 + chmod +x "${scriptdir}/python${pymajor}-config" || die
374 + ln -s "python${pymajor}-config" \
375 + "${scriptdir}/python-config" || die
376 + # 2to3, pydoc
377 + ln -s "../../../bin/2to3-${PYVER}" \
378 + "${scriptdir}/2to3" || die
379 + ln -s "../../../bin/pydoc${PYVER}" \
380 + "${scriptdir}/pydoc" || die
381 + # idle
382 + if use tk; then
383 + ln -s "../../../bin/idle${PYVER}" \
384 + "${scriptdir}/idle" || die
385 + fi
386 +}