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, 10 Mar 2020 15:29:06
Message-Id: 1583854135.d8fbfbade8e1dd94de554f707351ce52be586eee.mgorny@gentoo
1 commit: d8fbfbade8e1dd94de554f707351ce52be586eee
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 10 12:55:10 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 10 15:28:55 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8fbfbad
7
8 dev-lang/python: Bump to 3.7.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.7.7.ebuild | 340 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 341 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 84e356a15b4..1bfb99210c8 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -1,6 +1,7 @@
21 DIST Python-2.7.17.tar.xz 12855568 BLAKE2B 6d09214a51d6595fe5253a279ee556d7510dcb9a0e8ad71e9cf73b4fb00c3abd3680e2429f4f87d9387d1fc16d4887f5f33fc600b24b0ca2c70f36bf34df2157 SHA512 2dc19a0b0d818c71429dae94783e58b2aac0fa31f5faa1e840cac06245a59932ecc4658d913515736601bcf70a78c9ec60367aed75f4567d1e41ff3bb104da9a
22 DIST Python-3.6.10.tar.xz 17212220 BLAKE2B 822e231cf2755e6477e49e9128a983185a4f1e30e9d6c221f1b5720891c0de345e8c5402af458d3627eba124e75fea4b5daa94e01b0eaddc116dc3281263ecbe SHA512 26147099e1f1a0ffc85febad26e18e991f019599a150887ea0b925e34663fad8e03b3c2a941e2770c1a63960695e173ef32709572c9361e7f2cb862ccf75b28a
23 DIST Python-3.7.6.tar.xz 17246360 BLAKE2B b83a440a1ad5b1a2210e03be0522d39f53778774ea725fa41aaaab28cccfcdf007996f1a1d3cb95f8040b71b692189e28db67ba6ec136af82158363a1aadbba6 SHA512 5be022c384728b0c6709d165486f66226d126c521b466ed24d0c4c3c5910ec786a734f4c2c916ac409213c54a492b9fb230fb721c41e3de281676a7e9d8f3171
24 +DIST Python-3.7.7.tar.xz 17268888 BLAKE2B 5f16c9559249470a9e6c0aa686965e7d78ce0f7364b5d03fc9590613c7a5456f92835340e49bf9becbec18b18d1e5a6fc318b6e30f2349da3246a918cf8b05ff SHA512 ddc838a7b0c442c2e465616f20231f2b703ed6b69ed2dc17858aac8760814fdf7cff43d350d359300e47b6bb1f0bd38c31126b855e423a3a65ed06a8fa16d136
25 DIST Python-3.8.2.tar.xz 17869888 BLAKE2B f42b35bea5e65f1f0a3fa6f1fd3d749fba3fa46d958608a314c1a98d0e3ca890e856da4d40ee489fe546fc02ce0fc9fa2daaaba96a8928d92ae7eb3d2dda3fe4 SHA512 ca37ad0e7c5845f5f228566aa8ff654a8f428c7d4a5aaabff29baebb0ca3219b31ba8bb2607f89e37cf3fc564f023b8407e53a4f2c47bd99122c1cc222613e37
26 DIST Python-3.9.0a4.tar.xz 18032300 BLAKE2B 1c9ad55c7c055c3a704c4062e092d44b8d778e334e05589e7166777da328df54ef257aeb2e203416710bb9f9f1571d7700c2c12aed5b8e63adf7a1b3aedb08b5 SHA512 8f7ca0a891fb7e7868dfe5f040e9ceb7ce14d036bc5d9eae1493570c5a9631832e796a1972590c444d2347c585b0c8216345375dd1476b4da7bd47e187591afc
27 DIST python-gentoo-patches-2.7.17-r1.tar.xz 14708 BLAKE2B f6e25236a471649de122d0f29506f7a4f34044a568ead47a68980411d9722b761fe1f9d653d5edccb6978b65c8c1eecbef55f403b94f32b37c0ad68e061505a8 SHA512 ecdde5e38c6fe5e69691fb3a68c8f4f43da7857d4abaff763d3cf6ad864ba43c769c03b186b60f2736a1ffb1e3e4c9982715d1b8a99ff3f5740096153bb8a90f
28
29 diff --git a/dev-lang/python/python-3.7.7.ebuild b/dev-lang/python/python-3.7.7.ebuild
30 new file mode 100644
31 index 00000000000..98a67f6b142
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.7.7.ebuild
34 @@ -0,0 +1,340 @@
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.7.6"
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}/${PYVER}m"
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 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
149 + tc-export CXX
150 +
151 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
152 + # Needed on FreeBSD unless Python 3.2 is already installed.
153 + # Please query BSD team before removing this!
154 + append-ldflags "-L."
155 +
156 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
157 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
158 +
159 + local dbmliborder
160 + if use gdbm; then
161 + dbmliborder+="${dbmliborder:+:}gdbm"
162 + fi
163 +
164 + local myeconfargs=(
165 + --enable-shared
166 + $(use_enable ipv6)
167 + --infodir='${prefix}/share/info'
168 + --mandir='${prefix}/share/man'
169 + --with-computed-gotos
170 + --with-dbmliborder="${dbmliborder}"
171 + --with-libc=
172 + --enable-loadable-sqlite-extensions
173 + --without-ensurepip
174 + --with-system-expat
175 + --with-system-ffi
176 + )
177 +
178 + OPT="" econf "${myeconfargs[@]}"
179 +}
180 +
181 +src_compile() {
182 + # Ensure sed works as expected
183 + # https://bugs.gentoo.org/594768
184 + local -x LC_ALL=C
185 +
186 + emake CPPFLAGS= CFLAGS= LDFLAGS=
187 +
188 + # Work around bug 329499. See also bug 413751 and 457194.
189 + if has_version dev-libs/libffi[pax_kernel]; then
190 + pax-mark E python
191 + else
192 + pax-mark m python
193 + fi
194 +}
195 +
196 +src_test() {
197 + # Tests will not work when cross compiling.
198 + if tc-is-cross-compiler; then
199 + elog "Disabling tests due to crosscompiling."
200 + return
201 + fi
202 +
203 + # Skip failing tests.
204 + local skipped_tests="gdb"
205 +
206 + for test in ${skipped_tests}; do
207 + mv "${S}"/Lib/test/test_${test}.py "${T}"
208 + done
209 +
210 + # bug 660358
211 + local -x COLUMNS=80
212 +
213 + local -x PYTHONDONTWRITEBYTECODE=
214 +
215 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
216 + local result=$?
217 +
218 + for test in ${skipped_tests}; do
219 + mv "${T}/test_${test}.py" "${S}"/Lib/test
220 + done
221 +
222 + elog "The following tests have been skipped:"
223 + for test in ${skipped_tests}; do
224 + elog "test_${test}.py"
225 + done
226 +
227 + elog "If you would like to run them, you may:"
228 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
229 + elog "and run the tests separately."
230 +
231 + if [[ ${result} -ne 0 ]]; then
232 + die "emake test failed"
233 + fi
234 +}
235 +
236 +src_install() {
237 + local libdir=${ED}/usr/lib/python${PYVER}
238 +
239 + emake DESTDIR="${D}" altinstall
240 +
241 + # Remove static library
242 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
243 +
244 + sed \
245 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
246 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
247 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
248 +
249 + # Fix collisions between different slots of Python.
250 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
251 +
252 + # Cheap hack to get version with ABIFLAGS
253 + local abiver=$(cd "${ED}/usr/include"; echo python*)
254 + if [[ ${abiver} != python${PYVER} ]]; then
255 + # Replace python3.X with a symlink to python3.Xm
256 + rm "${ED}/usr/bin/python${PYVER}" || die
257 + dosym "${abiver}" "/usr/bin/python${PYVER}"
258 + # Create python3.X-config symlink
259 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
260 + # Create python-3.5m.pc symlink
261 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
262 + fi
263 +
264 + # python seems to get rebuilt in src_install (bug 569908)
265 + # Work around it for now.
266 + if has_version dev-libs/libffi[pax_kernel]; then
267 + pax-mark E "${ED}/usr/bin/${abiver}"
268 + else
269 + pax-mark m "${ED}/usr/bin/${abiver}"
270 + fi
271 +
272 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
273 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
274 +
275 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
276 +
277 + dodoc Misc/{ACKS,HISTORY,NEWS}
278 +
279 + if use examples; then
280 + docinto examples
281 + find Tools -name __pycache__ -exec rm -fr {} + || die
282 + dodoc -r Tools
283 + fi
284 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
285 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
286 + emake --no-print-directory -s -f - 2>/dev/null)
287 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
288 +
289 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
290 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
291 + sed \
292 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
293 + -e "s:@PYDOC@:pydoc${PYVER}:" \
294 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
295 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
296 +
297 + # for python-exec
298 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
299 +
300 + # if not using a cross-compiler, use the fresh binary
301 + if ! tc-is-cross-compiler; then
302 + local -x PYTHON=./python
303 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
304 + else
305 + vars=( PYTHON "${vars[@]}" )
306 + fi
307 +
308 + python_export "python${PYVER}" "${vars[@]}"
309 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
310 + python_domodule epython.py
311 +
312 + # python-exec wrapping support
313 + local pymajor=${PYVER%.*}
314 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
315 + # python and pythonX
316 + ln -s "../../../bin/${abiver}" \
317 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
318 + ln -s "python${pymajor}" "${D}${PYTHON_SCRIPTDIR}/python" || die
319 + # python-config and pythonX-config
320 + # note: we need to create a wrapper rather than symlinking it due
321 + # to some random dirname(argv[0]) magic performed by python-config
322 + cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
323 + #!/bin/sh
324 + exec "${abiver}-config" "\${@}"
325 + EOF
326 + chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
327 + ln -s "python${pymajor}-config" \
328 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
329 + # 2to3, pydoc, pyvenv
330 + ln -s "../../../bin/2to3-${PYVER}" \
331 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
332 + ln -s "../../../bin/pydoc${PYVER}" \
333 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
334 + ln -s "../../../bin/pyvenv-${PYVER}" \
335 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
336 + # idle
337 + if use tk; then
338 + ln -s "../../../bin/idle${PYVER}" \
339 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
340 + fi
341 +}
342 +
343 +pkg_preinst() {
344 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
345 + python_updater_warning="1"
346 + fi
347 +}
348 +
349 +eselect_python_update() {
350 + if [[ -z "$(eselect python show)" || \
351 + ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
352 + eselect python update
353 + fi
354 +
355 + if [[ -z "$(eselect python show --python${PV%%.*})" || \
356 + ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]]
357 + then
358 + eselect python update --python${PV%%.*}
359 + fi
360 +}
361 +
362 +pkg_postinst() {
363 + eselect_python_update
364 +
365 + if [[ "${python_updater_warning}" == "1" ]]; then
366 + ewarn "You have just upgraded from an older version of Python."
367 + ewarn
368 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
369 + fi
370 +}
371 +
372 +pkg_postrm() {
373 + eselect_python_update
374 +}