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