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