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