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, 22 Dec 2020 08:07:11
Message-Id: 1608624420.f812be9498d0d6f46532d7a7d47ab631cf3570e1.mgorny@gentoo
1 commit: f812be9498d0d6f46532d7a7d47ab631cf3570e1
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 22 07:17:45 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 22 08:07:00 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f812be94
7
8 dev-lang/python: Bump to 3.8.7
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.7.ebuild | 355 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 356 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 1d47d37b9e0..917be956873 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -8,6 +8,7 @@ DIST Python-3.7.9.tar.xz 17389636 BLAKE2B 484833aa2aa4e29051a02969294f72099ff6f1
21 DIST Python-3.8.4.tar.xz 18020412 BLAKE2B cfcfb293c413b25fc3ca48116cf8ffaba7bee18e9af9accf26be9b4373a0c62dd8e9da70e5a8a38ba6da4d1afbdbd589ae5ea4b618b65130ae061698b445908c SHA512 37a36d014a8372742be9d0bd9dd3a275e100dc21b1515c145bc62425d4d157327b6e63ad99bc888c0b36c1da4c05676c40eb086e75072d1906e3210ec3043dcb
22 DIST Python-3.8.5.tar.xz 18019640 BLAKE2B bb3e0566afe28759e4ab129ad0986a0fc5103514f2e2b22ff4aa3973c3173ebdd24d4267fbaf903841814a611fd9ea122673e5a1918934366e5c0efaef9d7517 SHA512 460cee65d7df7150694590575502d7f22e548ebfc99c8f8b363eef8bf30ee72e58d8ffacb1d607824f877f880eb9fd6775a508388029583e1e1df3380f3f9587
23 DIST Python-3.8.6.tar.xz 18233864 BLAKE2B c8a8ef6055e344dda30eb808804cfa62016b4f840257cffd5a495e5932f5696e50579d49b8181a487c9cd4a89bdb95656e80981039783a21d20f7980aa2c9883 SHA512 22faec84f6e172e1ac7c6bd6fd37e9b6ae4afc91cf5136aa8cac8ebbed8d18793f9196e8749b8ccc43447cb6c41cb450f65ea72dd363c06dfaeb14e0455f5560
24 +DIST Python-3.8.7.tar.xz 18261096 BLAKE2B 6ac20efef41e828cb796aabcb7808400d494b9b48759950c8c15ee90762394f6763163d8e37ab407c1c79ebb9cda09189eaa969a75f96c86a96ccee962443924 SHA512 6a27d8eab3076930df46b0cf127f9b664f8d4147349b2b98132f464deb7f69d87e0167e8ee8e6c64249125ad73760d965ecbc81c252b63a1e7aac95594c62b74
25 DIST Python-3.8.7rc1.tar.xz 18258688 BLAKE2B cd18abf3a2f97856581735fc6ab98882c3839edd84f736b2f681a227694319f410154201e5e09938ec45ba00b69a593737da22263560080da72625f8611f14c6 SHA512 0c42622433b968dc0943894bff6e90603bdfc4e49ab4373e2686a158e1d4b3450e60aa16d8203ce3d0e0e8bb0ebcaad281ccd7eb03b355eeeb7c811a4cd799ec
26 DIST Python-3.9.0.tar.xz 18866140 BLAKE2B 8e12b64e187a65461473ac3b281dc489f0abac586e0755f6dbeceb236b34bdc008085eeac9ee1a19d76f5ec6a2fbda623985454c9d0164c4888a97b8cd940034 SHA512 b141039c9701a8cb0d15cd11a279153077524af4d0599e7d2c7279d4c18d05fda06b33ef82342d875de996c7117b7dc6eb154dc3669d38a1efa99801aeec6c5e
27 DIST Python-3.9.1.tar.xz 18897104 BLAKE2B bcbce176510e8e7c6ba6070588bedc52121c21c5271f59b3d629dfb542c51ee62622b2ca53a6e2041f1a51b2d089368cc4de9bb749e8ebad9a2c4eb4de83538e SHA512 b90029d6825751685983e9dcf0e0ec9e46f18e6c7d37b0dd7a245a94316f8c0090308ad7c2b2b49ed2514b0b909177231dd5bcad03031bf4624e37136fcf8019
28
29 diff --git a/dev-lang/python/python-3.8.7.ebuild b/dev-lang/python/python-3.8.7.ebuild
30 new file mode 100644
31 index 00000000000..eaee9eaef9c
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.8.7.ebuild
34 @@ -0,0 +1,355 @@
35 +# Copyright 1999-2020 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
43 +
44 +MY_P="Python-${PV}"
45 +PYVER=$(ver_cut 1-2)
46 +PATCHSET="python-gentoo-patches-3.8.6"
47 +
48 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
49 +HOMEPAGE="https://www.python.org/"
50 +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
51 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz"
52 +S="${WORKDIR}/${MY_P}"
53 +
54 +LICENSE="PSF-2"
55 +SLOT="${PYVER}"
56 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
57 +IUSE="bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml"
58 +RESTRICT="!test? ( test )"
59 +
60 +# Do not add a dependency on dev-lang/python to this ebuild.
61 +# If you need to apply a patch which requires python for bootstrapping, please
62 +# run the bootstrap code on your dev box and include the results in the
63 +# patchset. See bug 447752.
64 +
65 +RDEPEND="app-arch/bzip2:=
66 + app-arch/xz-utils:=
67 + dev-libs/libffi:=
68 + sys-apps/util-linux:=
69 + >=sys-libs/zlib-1.1.3:=
70 + virtual/libcrypt:=
71 + virtual/libintl
72 + gdbm? ( sys-libs/gdbm:=[berkdb] )
73 + ncurses? ( >=sys-libs/ncurses-5.2:= )
74 + readline? ( >=sys-libs/readline-4.1:= )
75 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
76 + ssl? (
77 + !libressl? ( dev-libs/openssl:= )
78 + libressl? ( dev-libs/libressl:= )
79 + )
80 + tk? (
81 + >=dev-lang/tcl-8.0:=
82 + >=dev-lang/tk-8.0:=
83 + dev-tcltk/blt:=
84 + dev-tcltk/tix
85 + )
86 + xml? ( >=dev-libs/expat-2.1:= )"
87 +# bluetooth requires headers from bluez
88 +DEPEND="${RDEPEND}
89 + bluetooth? ( net-wireless/bluez )
90 + test? ( app-arch/xz-utils[extra-filters(+)] )
91 + virtual/pkgconfig
92 + !sys-devel/gcc[libffi(-)]"
93 +RDEPEND+=" !build? ( app-misc/mime-types )"
94 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
95 +
96 +src_prepare() {
97 + # Ensure that internal copies of expat, libffi and zlib are not used.
98 + rm -fr Modules/expat || die
99 + rm -fr Modules/_ctypes/libffi* || die
100 + rm -fr Modules/zlib || die
101 +
102 + local PATCHES=(
103 + "${WORKDIR}/${PATCHSET}"
104 + )
105 +
106 + default
107 +
108 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
109 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
110 +
111 + # force correct number of jobs
112 + # https://bugs.gentoo.org/737660
113 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
114 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
115 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
116 +
117 + eautoreconf
118 +}
119 +
120 +src_configure() {
121 + local disable
122 + # disable automagic bluetooth headers detection
123 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
124 + use gdbm || disable+=" gdbm"
125 + use ncurses || disable+=" _curses _curses_panel"
126 + use readline || disable+=" readline"
127 + use sqlite || disable+=" _sqlite3"
128 + use ssl || export PYTHON_DISABLE_SSL="1"
129 + use tk || disable+=" _tkinter"
130 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
131 + export PYTHON_DISABLE_MODULES="${disable}"
132 +
133 + if ! use xml; then
134 + ewarn "You have configured Python without XML support."
135 + ewarn "This is NOT a recommended configuration as you"
136 + ewarn "may face problems parsing any XML documents."
137 + fi
138 +
139 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
140 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
141 + fi
142 +
143 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
144 + append-flags -fwrapv
145 + fi
146 +
147 + filter-flags -malign-double
148 +
149 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
150 + if is-flagq -O3; then
151 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
152 + use hardened && replace-flags -O3 -O2
153 + fi
154 +
155 + # https://bugs.gentoo.org/700012
156 + if is-flagq -flto || is-flagq '-flto=*'; then
157 + append-cflags $(test-flags-CC -ffat-lto-objects)
158 + fi
159 +
160 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
161 + tc-export CXX
162 +
163 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
164 + # Needed on FreeBSD unless Python 3.2 is already installed.
165 + # Please query BSD team before removing this!
166 + append-ldflags "-L."
167 +
168 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
169 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
170 +
171 + local dbmliborder
172 + if use gdbm; then
173 + dbmliborder+="${dbmliborder:+:}gdbm"
174 + fi
175 +
176 + local myeconfargs=(
177 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
178 + # Python on glibc upgrade, remove it proactively to give
179 + # a chance for users rebuilding python before glibc
180 + ac_cv_header_stropts_h=no
181 +
182 + --enable-shared
183 + $(use_enable ipv6)
184 + --infodir='${prefix}/share/info'
185 + --mandir='${prefix}/share/man'
186 + --with-computed-gotos
187 + --with-dbmliborder="${dbmliborder}"
188 + --with-libc=
189 + --enable-loadable-sqlite-extensions
190 + --without-ensurepip
191 + --with-system-expat
192 + --with-system-ffi
193 + )
194 +
195 + OPT="" econf "${myeconfargs[@]}"
196 +}
197 +
198 +src_compile() {
199 + # Ensure sed works as expected
200 + # https://bugs.gentoo.org/594768
201 + local -x LC_ALL=C
202 +
203 + emake CPPFLAGS= CFLAGS= LDFLAGS=
204 +
205 + # Work around bug 329499. See also bug 413751 and 457194.
206 + if has_version dev-libs/libffi[pax_kernel]; then
207 + pax-mark E python
208 + else
209 + pax-mark m python
210 + fi
211 +}
212 +
213 +src_test() {
214 + # Tests will not work when cross compiling.
215 + if tc-is-cross-compiler; then
216 + elog "Disabling tests due to crosscompiling."
217 + return
218 + fi
219 +
220 + # Skip failing tests.
221 + local skipped_tests="gdb"
222 +
223 + for test in ${skipped_tests}; do
224 + mv "${S}"/Lib/test/test_${test}.py "${T}"
225 + done
226 +
227 + # bug 660358
228 + local -x COLUMNS=80
229 + local -x PYTHONDONTWRITEBYTECODE=
230 +
231 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
232 +
233 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
234 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
235 + local result=$?
236 +
237 + for test in ${skipped_tests}; do
238 + mv "${T}/test_${test}.py" "${S}"/Lib/test
239 + done
240 +
241 + elog "The following tests have been skipped:"
242 + for test in ${skipped_tests}; do
243 + elog "test_${test}.py"
244 + done
245 +
246 + elog "If you would like to run them, you may:"
247 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
248 + elog "and run the tests separately."
249 +
250 + if [[ ${result} -ne 0 ]]; then
251 + die "emake test failed"
252 + fi
253 +}
254 +
255 +src_install() {
256 + local libdir=${ED}/usr/lib/python${PYVER}
257 +
258 + emake DESTDIR="${D}" altinstall
259 +
260 + # Remove static library
261 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
262 +
263 + sed \
264 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
265 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
266 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
267 +
268 + # Fix collisions between different slots of Python.
269 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
270 +
271 + # Cheap hack to get version with ABIFLAGS
272 + local abiver=$(cd "${ED}/usr/include"; echo python*)
273 + if [[ ${abiver} != python${PYVER} ]]; then
274 + # Replace python3.X with a symlink to python3.Xm
275 + rm "${ED}/usr/bin/python${PYVER}" || die
276 + dosym "${abiver}" "/usr/bin/python${PYVER}"
277 + # Create python3.X-config symlink
278 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
279 + # Create python-3.5m.pc symlink
280 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
281 + fi
282 +
283 + # python seems to get rebuilt in src_install (bug 569908)
284 + # Work around it for now.
285 + if has_version dev-libs/libffi[pax_kernel]; then
286 + pax-mark E "${ED}/usr/bin/${abiver}"
287 + else
288 + pax-mark m "${ED}/usr/bin/${abiver}"
289 + fi
290 +
291 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
292 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
293 +
294 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
295 +
296 + dodoc Misc/{ACKS,HISTORY,NEWS}
297 +
298 + if use examples; then
299 + docinto examples
300 + find Tools -name __pycache__ -exec rm -fr {} + || die
301 + dodoc -r Tools
302 + fi
303 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
304 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
305 + emake --no-print-directory -s -f - 2>/dev/null)
306 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
307 +
308 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
309 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
310 + sed \
311 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
312 + -e "s:@PYDOC@:pydoc${PYVER}:" \
313 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
314 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
315 +
316 + local -x EPYTHON=python${PYVER}
317 + # if not using a cross-compiler, use the fresh binary
318 + if ! tc-is-cross-compiler; then
319 + local -x PYTHON=./python
320 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
321 + else
322 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
323 + fi
324 +
325 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
326 + python_domodule epython.py
327 +
328 + # python-exec wrapping support
329 + local pymajor=${PYVER%.*}
330 + local scriptdir=${D}$(python_get_scriptdir)
331 + mkdir -p "${scriptdir}" || die
332 + # python and pythonX
333 + ln -s "../../../bin/${abiver}" \
334 + "${scriptdir}/python${pymajor}" || die
335 + ln -s "python${pymajor}" "${scriptdir}/python" || die
336 + # python-config and pythonX-config
337 + # note: we need to create a wrapper rather than symlinking it due
338 + # to some random dirname(argv[0]) magic performed by python-config
339 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
340 + #!/bin/sh
341 + exec "${abiver}-config" "\${@}"
342 + EOF
343 + chmod +x "${scriptdir}/python${pymajor}-config" || die
344 + ln -s "python${pymajor}-config" \
345 + "${scriptdir}/python-config" || die
346 + # 2to3, pydoc
347 + ln -s "../../../bin/2to3-${PYVER}" \
348 + "${scriptdir}/2to3" || die
349 + ln -s "../../../bin/pydoc${PYVER}" \
350 + "${scriptdir}/pydoc" || die
351 + # idle
352 + if use tk; then
353 + ln -s "../../../bin/idle${PYVER}" \
354 + "${scriptdir}/idle" || die
355 + fi
356 +}
357 +
358 +pkg_preinst() {
359 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
360 + python_updater_warning="1"
361 + fi
362 +}
363 +
364 +eselect_python_update() {
365 + if [[ -z "$(eselect python show)" || \
366 + ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
367 + eselect python update
368 + fi
369 +
370 + if [[ -z "$(eselect python show --python${PV%%.*})" || \
371 + ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]]
372 + then
373 + eselect python update --python${PV%%.*}
374 + fi
375 +}
376 +
377 +pkg_postinst() {
378 + eselect_python_update
379 +
380 + if [[ "${python_updater_warning}" == "1" ]]; then
381 + ewarn "You have just upgraded from an older version of Python."
382 + ewarn
383 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
384 + fi
385 +}
386 +
387 +pkg_postrm() {
388 + eselect_python_update
389 +}