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, 02 Aug 2022 18:59:12
Message-Id: 1659466744.e2716ad752498c505078a20e3d17fce0803163ef.mgorny@gentoo
1 commit: e2716ad752498c505078a20e3d17fce0803163ef
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Aug 2 15:41:37 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Aug 2 18:59:04 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2716ad7
7
8 dev-lang/python: Sync 3.10.6
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-lang/python/python-3.10.6.ebuild | 171 +++++++++++++++++------------------
13 1 file changed, 81 insertions(+), 90 deletions(-)
14
15 diff --git a/dev-lang/python/python-3.10.6.ebuild b/dev-lang/python/python-3.10.6.ebuild
16 index 92ac47a6d7ec..5d9861331971 100644
17 --- a/dev-lang/python/python-3.10.6.ebuild
18 +++ b/dev-lang/python/python-3.10.6.ebuild
19 @@ -4,8 +4,8 @@
20 EAPI="7"
21 WANT_LIBTOOL="none"
22
23 -inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \
24 - python-utils-r1 toolchain-funcs verify-sig
25 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
26 +inherit python-utils-r1 toolchain-funcs verify-sig
27
28 MY_PV=${PV/_rc/rc}
29 MY_P="Python-${MY_PV%_p*}"
30 @@ -13,7 +13,10 @@ PYVER=$(ver_cut 1-2)
31 PATCHSET="python-gentoo-patches-${MY_PV}"
32
33 DESCRIPTION="An interpreted, interactive, object-oriented programming language"
34 -HOMEPAGE="https://www.python.org/"
35 +HOMEPAGE="
36 + https://www.python.org/
37 + https://github.com/python/cpython/
38 +"
39 SRC_URI="
40 https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
41 https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
42 @@ -28,7 +31,7 @@ SLOT="${PYVER}"
43 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
44 IUSE="
45 bluetooth build +ensurepip examples gdbm hardened libedit lto
46 - +ncurses pgo +readline +sqlite +ssl test tk wininst +xml
47 + +ncurses pgo +readline +sqlite +ssl test tk +xml
48 "
49 RESTRICT="!test? ( test )"
50
51 @@ -79,7 +82,7 @@ BDEPEND="
52 !sys-devel/gcc[libffi(-)]
53 "
54 RDEPEND+="
55 - build? ( app-misc/mime-types )
56 + !build? ( app-misc/mime-types )
57 "
58
59 VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
60 @@ -105,10 +108,9 @@ src_unpack() {
61 }
62
63 src_prepare() {
64 - # Ensure that internal copies of expat, libffi and zlib are not used.
65 - rm -fr Modules/expat || die
66 - rm -fr Modules/_ctypes/libffi* || die
67 - rm -fr Modules/zlib || die
68 + # Ensure that internal copies of expat and libffi are not used.
69 + rm -r Modules/expat || die
70 + rm -r Modules/_ctypes/libffi* || die
71
72 local PATCHES=(
73 "${WORKDIR}/${PATCHSET}"
74 @@ -116,12 +118,12 @@ src_prepare() {
75
76 default
77
78 - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
79 - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
80 + # https://bugs.gentoo.org/850151
81 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
82
83 - # force correct number of jobs
84 + # force the correct number of jobs
85 # https://bugs.gentoo.org/737660
86 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
87 + local jobs=$(makeopts_jobs)
88 sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
89 sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
90
91 @@ -129,9 +131,11 @@ src_prepare() {
92 }
93
94 src_configure() {
95 - local disable
96 # disable automagic bluetooth headers detection
97 - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
98 + if ! use bluetooth; then
99 + local -x ac_cv_header_bluetooth_bluetooth_h=no
100 + fi
101 + local disable
102 use gdbm || disable+=" gdbm"
103 use ncurses || disable+=" _curses _curses_panel"
104 use readline || disable+=" readline"
105 @@ -152,7 +156,6 @@ src_configure() {
106 fi
107
108 append-flags -fwrapv
109 -
110 filter-flags -malign-double
111
112 # https://bugs.gentoo.org/700012
113 @@ -161,29 +164,45 @@ src_configure() {
114 fi
115
116 # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
117 - tc-export CXX
118 + # PKG_CONFIG needed for cross.
119 + tc-export CXX PKG_CONFIG
120
121 # Fix implicit declarations on cross and prefix builds. Bug #674070.
122 - use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
123 + if use ncurses; then
124 + append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
125 + fi
126
127 - local dbmliborder
128 + local dbmliborder=
129 if use gdbm; then
130 dbmliborder+="${dbmliborder:+:}gdbm"
131 fi
132
133 if use pgo; then
134 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
135 - export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network"
136 -
137 - # All of these seem to occasionally hang for PGO inconsistently
138 - # They'll even hang here but be fine in src_test sometimes.
139 - # bug #828535 (and related: bug #788022)
140 - PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc"
141 + local profile_task_flags=(
142 + -m test
143 + "-j$(makeopts_jobs)"
144 + --pgo-extended
145 + -x test_gdb
146 + -u-network
147 +
148 + # All of these seem to occasionally hang for PGO inconsistently
149 + # They'll even hang here but be fine in src_test sometimes.
150 + # bug #828535 (and related: bug #788022)
151 + -x test_asyncio
152 + -x test_httpservers
153 + -x test_logging
154 + -x test_multiprocessing_fork
155 + -x test_socket
156 + -x test_xmlrpc
157 + )
158
159 if has_version "app-arch/rpm" ; then
160 # Avoid sandbox failure (attempts to write to /var/lib/rpm)
161 - PROFILE_TASK+=" -x test_distutils"
162 + profile_task_flags+=(
163 + -x test_distutils
164 + )
165 fi
166 + local -x PROFILE_TASK="${profile_task_flags[*]}"
167 fi
168
169 local myeconfargs=(
170 @@ -193,7 +212,6 @@ src_configure() {
171 ac_cv_header_stropts_h=no
172
173 --enable-shared
174 - --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
175 --without-static-libpython
176 --enable-ipv6
177 --infodir='${prefix}/share/info'
178 @@ -205,6 +223,7 @@ src_configure() {
179 --without-ensurepip
180 --with-system-expat
181 --with-system-ffi
182 + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
183
184 $(use_with lto)
185 $(use_enable pgo optimizations)
186 @@ -226,6 +245,9 @@ src_configure() {
187 eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
188 die "Broken sem_open function (bug 496328)"
189 fi
190 +
191 + # install epython.py as part of stdlib
192 + echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
193 }
194
195 src_compile() {
196 @@ -271,47 +293,30 @@ src_test() {
197 return
198 fi
199
200 - # Skip failing tests.
201 - local skipped_tests="gdb"
202 + local test_opts=(
203 + -u-network
204 + -j "$(makeopts_jobs)"
205 +
206 + # fails
207 + -x test_gdb
208 + )
209
210 if use sparc ; then
211 # bug #788022
212 - skipped_tests+=" multiprocessing_fork"
213 - skipped_tests+=" multiprocessing_forkserver"
214 + test_opts+=(
215 + -x test_multiprocessing_fork
216 + -x test_multiprocessing_forkserver
217 + )
218 fi
219
220 - for test in ${skipped_tests}; do
221 - mv "${S}"/Lib/test/test_${test}.py "${T}"
222 - done
223 -
224 # bug 660358
225 local -x COLUMNS=80
226 local -x PYTHONDONTWRITEBYTECODE=
227 # workaround https://bugs.gentoo.org/775416
228 addwrite /usr/lib/python3.10/site-packages
229
230 - local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
231 -
232 - emake test EXTRATESTOPTS="-u-network -j${jobs}" \
233 - CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
234 - local result=$?
235 -
236 - for test in ${skipped_tests}; do
237 - mv "${T}/test_${test}.py" "${S}"/Lib/test
238 - done
239 -
240 - elog "The following tests have been skipped:"
241 - for test in ${skipped_tests}; do
242 - elog "test_${test}.py"
243 - done
244 -
245 - elog "If you would like to run them, you may:"
246 - elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
247 - elog "and run the tests separately."
248 -
249 - if [[ ${result} -ne 0 ]]; then
250 - die "emake test failed"
251 - fi
252 + emake test EXTRATESTOPTS="${test_opts[*]}" \
253 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed"
254 }
255
256 src_install() {
257 @@ -346,8 +351,13 @@ src_install() {
258 if ! use ensurepip; then
259 rm -r "${libdir}"/ensurepip || die
260 fi
261 - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
262 - use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
263 + if ! use sqlite; then
264 + rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
265 + fi
266 + if ! use tk; then
267 + rm -r "${ED}/usr/bin/idle${PYVER}" || die
268 + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
269 + fi
270
271 dodoc Misc/{ACKS,HISTORY,NEWS}
272
273 @@ -357,9 +367,11 @@ src_install() {
274 dodoc -r Tools
275 fi
276 insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
277 - local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
278 - emake --no-print-directory -s -f - 2>/dev/null)
279 - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
280 + local libname=$(
281 + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
282 + emake --no-print-directory -s -f - 2>/dev/null
283 + )
284 + newins Tools/gdb/libpython.py "${libname}"-gdb.py
285
286 newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
287 newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
288 @@ -369,30 +381,13 @@ src_install() {
289 -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
290 "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
291
292 - local -x EPYTHON=python${PYVER}
293 - # if not using a cross-compiler, use the fresh binary
294 - if ! tc-is-cross-compiler; then
295 - cat > python.wrap <<-EOF || die
296 - #!/bin/sh
297 - export LD_LIBRARY_PATH=\${PWD}\${LD_LIBRARY_PATH+:\${LD_LIBRARY_PATH}}
298 - exec ./python "\${@}"
299 - EOF
300 - chmod +x python.wrap || die
301 - local -x PYTHON=./python.wrap
302 - else
303 - local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
304 - fi
305 -
306 - echo "EPYTHON='${EPYTHON}'" > epython.py || die
307 - python_domodule epython.py
308 -
309 # python-exec wrapping support
310 local pymajor=${PYVER%.*}
311 + local EPYTHON=python${PYVER}
312 local scriptdir=${D}$(python_get_scriptdir)
313 mkdir -p "${scriptdir}" || die
314 # python and pythonX
315 - ln -s "../../../bin/${abiver}" \
316 - "${scriptdir}/python${pymajor}" || die
317 + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
318 ln -s "python${pymajor}" "${scriptdir}/python" || die
319 # python-config and pythonX-config
320 # note: we need to create a wrapper rather than symlinking it due
321 @@ -402,16 +397,12 @@ src_install() {
322 exec "${abiver}-config" "\${@}"
323 EOF
324 chmod +x "${scriptdir}/python${pymajor}-config" || die
325 - ln -s "python${pymajor}-config" \
326 - "${scriptdir}/python-config" || die
327 + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
328 # 2to3, pydoc
329 - ln -s "../../../bin/2to3-${PYVER}" \
330 - "${scriptdir}/2to3" || die
331 - ln -s "../../../bin/pydoc${PYVER}" \
332 - "${scriptdir}/pydoc" || die
333 + ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
334 + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
335 # idle
336 if use tk; then
337 - ln -s "../../../bin/idle${PYVER}" \
338 - "${scriptdir}/idle" || die
339 + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
340 fi
341 }