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, 04 May 2021 12:41:39
Message-Id: 1620132084.a8913c3875b5d38f943d6dbbd9aed419001faf80.mgorny@gentoo
1 commit: a8913c3875b5d38f943d6dbbd9aed419001faf80
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue May 4 11:53:10 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue May 4 12:41:24 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8913c38
7
8 dev-lang/python: Bump to 3.9.5
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.5.ebuild | 345 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 348 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 0e08a61342e..d691418d09e 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -16,6 +16,8 @@ DIST Python-3.9.2.tar.xz 18889164 BLAKE2B f29f741ced22a58fbd2b4e2b5d133dc4971fc5
21 DIST Python-3.9.2.tar.xz.asc 833 BLAKE2B e8ef4d1993382f089b2efa6e9ad49e74ffd2aad32f6412dc6148c340dae06d01388cf4741981cb4ab82839b6ff2553f2fa704c41353d4758ea8cc7596deed5fc SHA512 47705411c7e7b7e41948ccdc4ff17430af7c953f877442f2fecf4225e6a8e5b8313f0ace54c4e0faaa409e4e5cf75b7502962f40db9e4f12a52f5d622cb6d3ce
22 DIST Python-3.9.4.tar.xz 18900304 BLAKE2B deb69a4e821163b3cb64b6fd5b3dbd7a8ad4bb0c33fb0342b5618db569ae3f763f154e60f2d859578ac531744c3d20a1371a60540136d5360a9e2a348fb5028f SHA512 3d8a5a38de0df6edc074d141e0b4a12b79d80439e4341cd4519218aa4bb7317be2736a17058ceec43fc987fc17ea5167c19eeafbdeef732a2f1656fe2f0f0d39
23 DIST Python-3.9.4.tar.xz.asc 833 BLAKE2B aa261d09200f150522ae9fb15e75f3a927ed48d19561fce9a7c8cf6a34c21e89b0f00ad2d619ec0bdb75ccf5c5881229349bb0248642ddc134711e8336ef0731 SHA512 9cf2909ebd178cea5a6dee9f6a8622ed91c33b943f1e7f7dcf0f7ae67f552e767393f833e9a4e1e62ff059fb265582d83a85dafefbb10df7ae3da0b73669d4cd
24 +DIST Python-3.9.5.tar.xz 19058600 BLAKE2B 0072376ac69728436ee422da58c1680170cd60c76ac7d623d7a29c9001e6acace1a8d75a1805e65c9b11a30c55c9e67ed66712ec22b0b94ee6873995c935141d SHA512 7b581af1b3e73695f124ff6a3a960e22104153a5d920ca930c046f42ea313b1e7ec77e39876db2bf5d5da6d7412cb072ff8ae7814dda12c14f9da6c570fb0995
25 +DIST Python-3.9.5.tar.xz.asc 833 BLAKE2B d044e2019edc4854db22eebda182528e88a0c4d71cc17b78e603b43191a882f176a9fa46549845ee09ff9aa56ddf69efa008cd7ae3040b24fed7956c52bb11e9 SHA512 cfee8c161447544d6f18c3490b96ce12c8df5e9b143fca09734066f3606abe767cd7b4d05315c691f41c0e565d9585456774c10770ffe2ef7983a911bbcfdb83
26 DIST python-gentoo-patches-2.7.18_p8.tar.xz 28304 BLAKE2B 76b653f45a284b7354202f646a645b1c245791a04b09cbae89b404f6bb14b56a54855433a03e96081b72c88841c125131c97f4e2714e3951472db6ec59279328 SHA512 7fed01c44cd5ed36e142a19cb10f3b5f0f8fd50e78ece32e353395e2bcee4fa0fe7f8b13d736f7b1eb5e1f2662ee4749c089fa0dda6f5d19bb08a01c7b3db200
27 DIST python-gentoo-patches-2.7.18_p9.tar.xz 30188 BLAKE2B 4f9f80e0a967a980d247b50ac3c38419e70fd2dafada4e4b5593935915b17f09aec1a88b0baac58cbc0c2fcf73eee6dbd5fa5f378a8e3e1923a0028c2c3a1f5a SHA512 874e88142570fd62437b043a2763b32667dfd9856a7cc8884f5d3c09e7a8520e1cdeb5eb5b6bbb884fbc3bfad03abb83e1c260969f4b9520ce99334cfaeb76fb
28 DIST python-gentoo-patches-3.10.0a7.tar.xz 8164 BLAKE2B 7df2fea05c52279cca7f91acc72d9d9ef5f3774387f218ab70494465e76de91c6780da1d15c1097268c89c6e39e80071ab9a613aac2680cdb260aa69797a4786 SHA512 6686aec44d71813d8c044ea5715be34325753b2b79c6e2ad74badd91fd9e66040f2fec68bd886a43c409c6aafc14a7bb000db1712d7fe8fb6e4d25ae6795ce9e
29 @@ -30,3 +32,4 @@ DIST python-gentoo-patches-3.8.9_p2.tar.xz 16600 BLAKE2B 895eebdfabfe9cc4a30d872
30 DIST python-gentoo-patches-3.9.2_p1.tar.xz 13400 BLAKE2B 7897ec2e23c3b613d1f8b253d16aabe173cedc5ce027b447f8d88fd78d643517e7d7634e33878d0033ce3348053e0c8eb0a3fc347aa9f57df037078df5bbc133 SHA512 da58f225300d447ee2ce118554a3a1c579c5da3828f71144f0664373e22be67924748c288bffe51f2f939d70b42aec4f4d1e9420d7f1a86f88f9769fec8f456b
31 DIST python-gentoo-patches-3.9.4.tar.xz 8816 BLAKE2B 6489a02d90704c6cc9eff2e6f51c54748941a948e2a7fc99a8ce07a9512ee89059ec78c4d1e219b68578cc2d66c7f4bae24794afaf455b1112550c4d39bd1354 SHA512 236b9a4cce18843a6529966bab2b57ef7e67d9299695afede910557b8dc73ae57d5ba65921399f08f178ccb0a196438439e2615856d0fd34c44dfae42bf985c3
32 DIST python-gentoo-patches-3.9.4_p1.tar.xz 14472 BLAKE2B c8bd49c2eb77eb00377e6c6e63a2f6b1108a2c8d4eb45cc943ad2d0a2b4457e00002f90d2597032716af5268f33d24902d4634cf8e98778c1d15bf8dda5d7215 SHA512 9a12c1935be31b1663e4ab6c1f7aca51ba62ef4033600885678ce436ecab688e2df82742125b4885b1cb8da9c68140c5ca4ee1684360ac87d82c6491bce5d0a0
33 +DIST python-gentoo-patches-3.9.5.tar.xz 8820 BLAKE2B 177234776f00c3efa6b76fefc1ef0001225ded1dd8ba916e3dc8498a7e845467bf387ba8a4f82da713a51bff627420a084f6627218863f70e1273cce58ca7252 SHA512 37b7e25a1703184556f12202da9cba1a8e2fb1c059d75195ef2997f55948229f164642a580e33c59f5877fe36d4c62f1735f95df318b36d92c528eb98f42e55f
34
35 diff --git a/dev-lang/python/python-3.9.5.ebuild b/dev-lang/python/python-3.9.5.ebuild
36 new file mode 100644
37 index 00000000000..444f9d6d14b
38 --- /dev/null
39 +++ b/dev-lang/python/python-3.9.5.ebuild
40 @@ -0,0 +1,345 @@
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:= )
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 +PDEPEND="app-eselect/eselect-python"
105 +
106 +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc
107 +
108 +# large file tests involve a 2.5G file being copied (duplicated)
109 +CHECKREQS_DISK_BUILD=5500M
110 +
111 +pkg_pretend() {
112 + use test && check-reqs_pkg_pretend
113 +}
114 +
115 +pkg_setup() {
116 + use test && check-reqs_pkg_setup
117 +}
118 +
119 +src_unpack() {
120 + if use verify-sig; then
121 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
122 + fi
123 + default
124 +}
125 +
126 +src_prepare() {
127 + # Ensure that internal copies of expat, libffi and zlib are not used.
128 + rm -fr Modules/expat || die
129 + rm -fr Modules/_ctypes/libffi* || die
130 + rm -fr Modules/zlib || die
131 +
132 + local PATCHES=(
133 + "${WORKDIR}/${PATCHSET}"
134 + )
135 +
136 + default
137 +
138 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
139 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
140 +
141 + # force correct number of jobs
142 + # https://bugs.gentoo.org/737660
143 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
144 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
145 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
146 +
147 + eautoreconf
148 +}
149 +
150 +src_configure() {
151 + local disable
152 + # disable automagic bluetooth headers detection
153 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
154 + use gdbm || disable+=" gdbm"
155 + use ncurses || disable+=" _curses _curses_panel"
156 + use readline || disable+=" readline"
157 + use sqlite || disable+=" _sqlite3"
158 + use ssl || export PYTHON_DISABLE_SSL="1"
159 + use tk || disable+=" _tkinter"
160 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
161 + export PYTHON_DISABLE_MODULES="${disable}"
162 +
163 + if ! use xml; then
164 + ewarn "You have configured Python without XML support."
165 + ewarn "This is NOT a recommended configuration as you"
166 + ewarn "may face problems parsing any XML documents."
167 + fi
168 +
169 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
170 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
171 + fi
172 +
173 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
174 + append-flags -fwrapv
175 + fi
176 +
177 + filter-flags -malign-double
178 +
179 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
180 + if is-flagq -O3; then
181 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
182 + use hardened && replace-flags -O3 -O2
183 + fi
184 +
185 + # https://bugs.gentoo.org/700012
186 + if is-flagq -flto || is-flagq '-flto=*'; then
187 + append-cflags $(test-flags-CC -ffat-lto-objects)
188 + fi
189 +
190 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
191 + tc-export CXX
192 +
193 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
194 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
195 +
196 + local dbmliborder
197 + if use gdbm; then
198 + dbmliborder+="${dbmliborder:+:}gdbm"
199 + fi
200 +
201 + local myeconfargs=(
202 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
203 + # Python on glibc upgrade, remove it proactively to give
204 + # a chance for users rebuilding python before glibc
205 + ac_cv_header_stropts_h=no
206 +
207 + --enable-shared
208 + $(use_enable ipv6)
209 + --infodir='${prefix}/share/info'
210 + --mandir='${prefix}/share/man'
211 + --with-computed-gotos
212 + --with-dbmliborder="${dbmliborder}"
213 + --with-libc=
214 + --enable-loadable-sqlite-extensions
215 + --without-ensurepip
216 + --with-system-expat
217 + --with-system-ffi
218 + )
219 +
220 + OPT="" 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 +
234 + emake CPPFLAGS= CFLAGS= LDFLAGS=
235 +
236 + # Work around bug 329499. See also bug 413751 and 457194.
237 + if has_version dev-libs/libffi[pax_kernel]; then
238 + pax-mark E python
239 + else
240 + pax-mark m python
241 + fi
242 +}
243 +
244 +src_test() {
245 + # Tests will not work when cross compiling.
246 + if tc-is-cross-compiler; then
247 + elog "Disabling tests due to crosscompiling."
248 + return
249 + fi
250 +
251 + # Skip failing tests.
252 + local skipped_tests="gdb"
253 +
254 + for test in ${skipped_tests}; do
255 + mv "${S}"/Lib/test/test_${test}.py "${T}"
256 + done
257 +
258 + # bug 660358
259 + local -x COLUMNS=80
260 + local -x PYTHONDONTWRITEBYTECODE=
261 +
262 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
263 +
264 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
265 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
266 + local result=$?
267 +
268 + for test in ${skipped_tests}; do
269 + mv "${T}/test_${test}.py" "${S}"/Lib/test
270 + done
271 +
272 + elog "The following tests have been skipped:"
273 + for test in ${skipped_tests}; do
274 + elog "test_${test}.py"
275 + done
276 +
277 + elog "If you would like to run them, you may:"
278 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
279 + elog "and run the tests separately."
280 +
281 + if [[ ${result} -ne 0 ]]; then
282 + die "emake test failed"
283 + fi
284 +}
285 +
286 +src_install() {
287 + local libdir=${ED}/usr/lib/python${PYVER}
288 +
289 + emake DESTDIR="${D}" altinstall
290 +
291 + # Remove static library
292 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
293 +
294 + sed \
295 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
296 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
297 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
298 +
299 + # Fix collisions between different slots of Python.
300 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
301 +
302 + # Cheap hack to get version with ABIFLAGS
303 + local abiver=$(cd "${ED}/usr/include"; echo python*)
304 + if [[ ${abiver} != python${PYVER} ]]; then
305 + # Replace python3.X with a symlink to python3.Xm
306 + rm "${ED}/usr/bin/python${PYVER}" || die
307 + dosym "${abiver}" "/usr/bin/python${PYVER}"
308 + # Create python3.X-config symlink
309 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
310 + # Create python-3.5m.pc symlink
311 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
312 + fi
313 +
314 + # python seems to get rebuilt in src_install (bug 569908)
315 + # Work around it for now.
316 + if has_version dev-libs/libffi[pax_kernel]; then
317 + pax-mark E "${ED}/usr/bin/${abiver}"
318 + else
319 + pax-mark m "${ED}/usr/bin/${abiver}"
320 + fi
321 +
322 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
323 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
324 +
325 + dodoc Misc/{ACKS,HISTORY,NEWS}
326 +
327 + if use examples; then
328 + docinto examples
329 + find Tools -name __pycache__ -exec rm -fr {} + || die
330 + dodoc -r Tools
331 + fi
332 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
333 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
334 + emake --no-print-directory -s -f - 2>/dev/null)
335 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
336 +
337 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
338 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
339 + sed \
340 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
341 + -e "s:@PYDOC@:pydoc${PYVER}:" \
342 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
343 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
344 +
345 + local -x EPYTHON=python${PYVER}
346 + # if not using a cross-compiler, use the fresh binary
347 + if ! tc-is-cross-compiler; then
348 + local -x PYTHON=./python
349 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
350 + else
351 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
352 + fi
353 +
354 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
355 + python_domodule epython.py
356 +
357 + # python-exec wrapping support
358 + local pymajor=${PYVER%.*}
359 + local scriptdir=${D}$(python_get_scriptdir)
360 + mkdir -p "${scriptdir}" || die
361 + # python and pythonX
362 + ln -s "../../../bin/${abiver}" \
363 + "${scriptdir}/python${pymajor}" || die
364 + ln -s "python${pymajor}" "${scriptdir}/python" || die
365 + # python-config and pythonX-config
366 + # note: we need to create a wrapper rather than symlinking it due
367 + # to some random dirname(argv[0]) magic performed by python-config
368 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
369 + #!/bin/sh
370 + exec "${abiver}-config" "\${@}"
371 + EOF
372 + chmod +x "${scriptdir}/python${pymajor}-config" || die
373 + ln -s "python${pymajor}-config" \
374 + "${scriptdir}/python-config" || die
375 + # 2to3, pydoc
376 + ln -s "../../../bin/2to3-${PYVER}" \
377 + "${scriptdir}/2to3" || die
378 + ln -s "../../../bin/pydoc${PYVER}" \
379 + "${scriptdir}/pydoc" || die
380 + # idle
381 + if use tk; then
382 + ln -s "../../../bin/idle${PYVER}" \
383 + "${scriptdir}/idle" || die
384 + fi
385 +}