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