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: Sat, 04 Jul 2020 08:48:13
Message-Id: 1593852484.3bf681399a9ff8ef6906ab1892ec2e36bec4d8ec.mgorny@gentoo
1 commit: 3bf681399a9ff8ef6906ab1892ec2e36bec4d8ec
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 4 07:29:15 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 4 08:48:04 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3bf68139
7
8 dev-lang/python: Bump to 3.9.0b4
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.9.0_beta4.ebuild | 323 ++++++++++++++++++++++++++++++
14 2 files changed, 324 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 4ed63eca885..5d1ad15fbaf 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -9,6 +9,7 @@ DIST Python-3.9.0a6.tar.xz 18202376 BLAKE2B 32f04613a3b11341759eb98fd4b16edcb890
21 DIST Python-3.9.0b1.tar.xz 18443584 BLAKE2B 156f128fccb045f7d367f3f7c4c8ba3dc5b0e232c551bc24ed3a8be8b2199a66cde3671d6b1c4b75286618ed7af81ae60bf7db4a05c6de7c799a5f5c48b2f2ac SHA512 ed82ed2ef58940129d940b613c6495517741ebf3d6834b1e2498b294f1c4485d1cb180455d345937fe5a1da529a9df6278a17e7fe6aa5a4c6151745119b866bb
22 DIST Python-3.9.0b2.tar.xz 18489152 BLAKE2B e72afe6bd3a338d313a226f9c4055973cb7fb5de5581df48cb48e62bd0762edc712c94eee01465eaf522b5926a0546383bba797f7a7d2dbe09ea01ada843b7f4 SHA512 adf444c2884eab3df3682a0af4f852c375868b6a9718c9fb87fe7419ec46371b1cbd499abae3f04f72d42b864b7ad86f7ae9890658b8ee75987f4cc675d97ab9
23 DIST Python-3.9.0b3.tar.xz 18518204 BLAKE2B fa1707f0d55a83e739e9ad51979f8aff9720588a8a77b7ce8beb9ecf599955677758dec1551a0549b010f86c1f8fbc5915cef34d63097534d1c512c92fad5bd1 SHA512 c06a6b874fbce93ec37402034158a7bab44cab775d6da467eaddc1eb402663415f9d788e657a204f17dffe5fa6f379379f9215b5198ec5071565486b6f0e4a2a
24 +DIST Python-3.9.0b4.tar.xz 18602256 BLAKE2B 9f260f2b3c6380745c343d2883db430dda1b76b120050df16e53c1021e5a746c7e4a6aa8e83c746c3705c6872e83369a649c48ffdaef972a7049c44f7bc3030b SHA512 1c9bac850159352effb163b41590b3e9c05100b449798b5615f7a51a59a3877fe9558d593bb47c24915226637e3394e7864a1b1555cd6c5b5e5e308972208ecf
25 DIST python-gentoo-patches-2.7.17-r1.tar.xz 14708 BLAKE2B f6e25236a471649de122d0f29506f7a4f34044a568ead47a68980411d9722b761fe1f9d653d5edccb6978b65c8c1eecbef55f403b94f32b37c0ad68e061505a8 SHA512 ecdde5e38c6fe5e69691fb3a68c8f4f43da7857d4abaff763d3cf6ad864ba43c769c03b186b60f2736a1ffb1e3e4c9982715d1b8a99ff3f5740096153bb8a90f
26 DIST python-gentoo-patches-2.7.18.tar.xz 15012 BLAKE2B f691e231c793bb8f11fb64c89b90e022af8e0fe0e28839822c2ae6214fdab6c6fd9c07466c4b5797d3964b7db09fd979597774fb7872dc674e8df59321b6bf95 SHA512 a2952b27bfc0a52f322b2f3e177cbe09fa288c9ca5967c13fb9c2d45d3e81033407e30e86bdaaaa258f0b3cfa2cef6eda5502bddb6390f9512a493d145d34e03
27 DIST python-gentoo-patches-3.6.10-r1.tar.xz 15556 BLAKE2B 3d4755a083172fc878d3454797a4a7fa809c7767b7f2ba0919b95076b8ecba62ac604a7db349d8dd71f83aa44d4580d0c433ae6cd2027078e7779cec79185ba2 SHA512 b361ff3fe9545bb59a7e85f179a094d58219be35d20cef83db02672d0a9a58fccfda62fbe8c2bf64250c4043b8517cbc2091380611c5f1e63bfac9ca7c4e47b0
28
29 diff --git a/dev-lang/python/python-3.9.0_beta4.ebuild b/dev-lang/python/python-3.9.0_beta4.ebuild
30 new file mode 100644
31 index 00000000000..8a98fd0b0c7
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.9.0_beta4.ebuild
34 @@ -0,0 +1,323 @@
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 check-reqs flag-o-matic pax-utils python-utils-r1 \
42 + toolchain-funcs
43 +
44 +MY_P="Python-${PV/_beta/b}"
45 +PYVER=$(ver_cut 1-2)
46 +PATCHSET="python-gentoo-patches-3.9.0b3"
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 +# large file tests involve a 2.5G file being copied (duplicated)
97 +CHECKREQS_DISK_BUILD=5500M
98 +
99 +pkg_pretend() {
100 + use test && check-reqs_pkg_pretend
101 +}
102 +
103 +pkg_setup() {
104 + use test && check-reqs_pkg_setup
105 +}
106 +
107 +src_prepare() {
108 + # Ensure that internal copies of expat, libffi and zlib are not used.
109 + rm -fr Modules/expat || die
110 + rm -fr Modules/_ctypes/libffi* || die
111 + rm -fr Modules/zlib || die
112 +
113 + local PATCHES=(
114 + "${WORKDIR}/${PATCHSET}"
115 + )
116 +
117 + default
118 +
119 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
120 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
121 +
122 + eautoreconf
123 +}
124 +
125 +src_configure() {
126 + local disable
127 + # disable automagic bluetooth headers detection
128 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
129 + use gdbm || disable+=" gdbm"
130 + use ncurses || disable+=" _curses _curses_panel"
131 + use readline || disable+=" readline"
132 + use sqlite || disable+=" _sqlite3"
133 + use ssl || export PYTHON_DISABLE_SSL="1"
134 + use tk || disable+=" _tkinter"
135 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
136 + export PYTHON_DISABLE_MODULES="${disable}"
137 +
138 + if ! use xml; then
139 + ewarn "You have configured Python without XML support."
140 + ewarn "This is NOT a recommended configuration as you"
141 + ewarn "may face problems parsing any XML documents."
142 + fi
143 +
144 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
145 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
146 + fi
147 +
148 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
149 + append-flags -fwrapv
150 + fi
151 +
152 + filter-flags -malign-double
153 +
154 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
155 + if is-flagq -O3; then
156 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
157 + use hardened && replace-flags -O3 -O2
158 + fi
159 +
160 + # https://bugs.gentoo.org/700012
161 + if is-flagq -flto || is-flagq '-flto=*'; then
162 + append-cflags $(test-flags-CC -ffat-lto-objects)
163 + fi
164 +
165 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
166 + tc-export CXX
167 +
168 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
169 + # Needed on FreeBSD unless Python 3.2 is already installed.
170 + # Please query BSD team before removing this!
171 + append-ldflags "-L."
172 +
173 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
174 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
175 +
176 + local dbmliborder
177 + if use gdbm; then
178 + dbmliborder+="${dbmliborder:+:}gdbm"
179 + fi
180 +
181 + local myeconfargs=(
182 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
183 + # Python on glibc upgrade, remove it proactively to give
184 + # a chance for users rebuilding python before glibc
185 + ac_cv_header_stropts_h=no
186 +
187 + --enable-shared
188 + $(use_enable ipv6)
189 + --infodir='${prefix}/share/info'
190 + --mandir='${prefix}/share/man'
191 + --with-computed-gotos
192 + --with-dbmliborder="${dbmliborder}"
193 + --with-libc=
194 + --enable-loadable-sqlite-extensions
195 + --without-ensurepip
196 + --with-system-expat
197 + --with-system-ffi
198 + )
199 +
200 + OPT="" econf "${myeconfargs[@]}"
201 +}
202 +
203 +src_compile() {
204 + # Ensure sed works as expected
205 + # https://bugs.gentoo.org/594768
206 + local -x LC_ALL=C
207 +
208 + emake CPPFLAGS= CFLAGS= LDFLAGS=
209 +
210 + # Work around bug 329499. See also bug 413751 and 457194.
211 + if has_version dev-libs/libffi[pax_kernel]; then
212 + pax-mark E python
213 + else
214 + pax-mark m python
215 + fi
216 +}
217 +
218 +src_test() {
219 + # Tests will not work when cross compiling.
220 + if tc-is-cross-compiler; then
221 + elog "Disabling tests due to crosscompiling."
222 + return
223 + fi
224 +
225 + # Skip failing tests.
226 + local skipped_tests="gdb"
227 +
228 + for test in ${skipped_tests}; do
229 + mv "${S}"/Lib/test/test_${test}.py "${T}"
230 + done
231 +
232 + # bug 660358
233 + local -x COLUMNS=80
234 +
235 + local -x PYTHONDONTWRITEBYTECODE=
236 +
237 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
238 + local result=$?
239 +
240 + for test in ${skipped_tests}; do
241 + mv "${T}/test_${test}.py" "${S}"/Lib/test
242 + done
243 +
244 + elog "The following tests have been skipped:"
245 + for test in ${skipped_tests}; do
246 + elog "test_${test}.py"
247 + done
248 +
249 + elog "If you would like to run them, you may:"
250 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
251 + elog "and run the tests separately."
252 +
253 + if [[ ${result} -ne 0 ]]; then
254 + die "emake test failed"
255 + fi
256 +}
257 +
258 +src_install() {
259 + local libdir=${ED}/usr/lib/python${PYVER}
260 +
261 + emake DESTDIR="${D}" altinstall
262 +
263 + # Remove static library
264 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
265 +
266 + sed \
267 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
268 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
269 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
270 +
271 + # Fix collisions between different slots of Python.
272 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
273 +
274 + # Cheap hack to get version with ABIFLAGS
275 + local abiver=$(cd "${ED}/usr/include"; echo python*)
276 + if [[ ${abiver} != python${PYVER} ]]; then
277 + # Replace python3.X with a symlink to python3.Xm
278 + rm "${ED}/usr/bin/python${PYVER}" || die
279 + dosym "${abiver}" "/usr/bin/python${PYVER}"
280 + # Create python3.X-config symlink
281 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
282 + # Create python-3.5m.pc symlink
283 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
284 + fi
285 +
286 + # python seems to get rebuilt in src_install (bug 569908)
287 + # Work around it for now.
288 + if has_version dev-libs/libffi[pax_kernel]; then
289 + pax-mark E "${ED}/usr/bin/${abiver}"
290 + else
291 + pax-mark m "${ED}/usr/bin/${abiver}"
292 + fi
293 +
294 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
295 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
296 +
297 + dodoc Misc/{ACKS,HISTORY,NEWS}
298 +
299 + if use examples; then
300 + docinto examples
301 + find Tools -name __pycache__ -exec rm -fr {} + || die
302 + dodoc -r Tools
303 + fi
304 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
305 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
306 + emake --no-print-directory -s -f - 2>/dev/null)
307 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
308 +
309 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
310 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
311 + sed \
312 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
313 + -e "s:@PYDOC@:pydoc${PYVER}:" \
314 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
315 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
316 +
317 + local -x EPYTHON=python${PYVER}
318 + # if not using a cross-compiler, use the fresh binary
319 + if ! tc-is-cross-compiler; then
320 + local -x PYTHON=./python
321 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
322 + else
323 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
324 + fi
325 +
326 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
327 + python_domodule epython.py
328 +
329 + # python-exec wrapping support
330 + local pymajor=${PYVER%.*}
331 + local scriptdir=${D}$(python_get_scriptdir)
332 + mkdir -p "${scriptdir}" || die
333 + # python and pythonX
334 + ln -s "../../../bin/${abiver}" \
335 + "${scriptdir}/python${pymajor}" || die
336 + ln -s "python${pymajor}" "${scriptdir}/python" || die
337 + # python-config and pythonX-config
338 + # note: we need to create a wrapper rather than symlinking it due
339 + # to some random dirname(argv[0]) magic performed by python-config
340 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
341 + #!/bin/sh
342 + exec "${abiver}-config" "\${@}"
343 + EOF
344 + chmod +x "${scriptdir}/python${pymajor}-config" || die
345 + ln -s "python${pymajor}-config" \
346 + "${scriptdir}/python-config" || die
347 + # 2to3, pydoc
348 + ln -s "../../../bin/2to3-${PYVER}" \
349 + "${scriptdir}/2to3" || die
350 + ln -s "../../../bin/pydoc${PYVER}" \
351 + "${scriptdir}/pydoc" || die
352 + # idle
353 + if use tk; then
354 + ln -s "../../../bin/idle${PYVER}" \
355 + "${scriptdir}/idle" || die
356 + fi
357 +}