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