Gentoo Archives: gentoo-commits

From: Quentin Retornaz <gentoo@××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/libressl:master commit in: dev-lang/python/
Date: Fri, 20 Aug 2021 23:56:41
Message-Id: 1629503784.645a017c7e0be0ffbb0ede49165b60685dc8cede.quentin@gentoo
1 commit: 645a017c7e0be0ffbb0ede49165b60685dc8cede
2 Author: orbea <orbea <AT> riseup <DOT> net>
3 AuthorDate: Fri Aug 20 22:29:27 2021 +0000
4 Commit: Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
5 CommitDate: Fri Aug 20 23:56:24 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=645a017c
7
8 dev-lang/python: Bump for version 3.9.6_p1
9
10 Signed-off-by: orbea <orbea <AT> riseup.net>
11 Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>
12
13 dev-lang/python/python-3.9.6_p1.ebuild | 346 +++++++++++++++++++++++++++++++++
14 1 file changed, 346 insertions(+)
15
16 diff --git a/dev-lang/python/python-3.9.6_p1.ebuild b/dev-lang/python/python-3.9.6_p1.ebuild
17 new file mode 100644
18 index 0000000..fcb53ec
19 --- /dev/null
20 +++ b/dev-lang/python/python-3.9.6_p1.ebuild
21 @@ -0,0 +1,346 @@
22 +# Copyright 1999-2021 Gentoo Authors
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI="7"
26 +WANT_LIBTOOL="none"
27 +
28 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \
29 + python-utils-r1 toolchain-funcs verify-sig
30 +
31 +MY_PV=${PV/_rc/rc}
32 +MY_P="Python-${MY_PV%_p*}"
33 +PYVER=$(ver_cut 1-2)
34 +PATCHSET="python-gentoo-patches-${MY_PV}"
35 +
36 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
37 +HOMEPAGE="https://www.python.org/"
38 +SRC_URI="https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz
39 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
40 + verify-sig? (
41 + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc
42 + )"
43 +S="${WORKDIR}/${MY_P}"
44 +
45 +LICENSE="PSF-2"
46 +SLOT="${PYVER}"
47 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
48 +IUSE="bluetooth build examples gdbm hardened ipv6 +ncurses +readline +sqlite +ssl test tk wininst +xml"
49 +RESTRICT="!test? ( test )"
50 +
51 +# Do not add a dependency on dev-lang/python to this ebuild.
52 +# If you need to apply a patch which requires python for bootstrapping, please
53 +# run the bootstrap code on your dev box and include the results in the
54 +# patchset. See bug 447752.
55 +
56 +RDEPEND="app-arch/bzip2:=
57 + app-arch/xz-utils:=
58 + dev-libs/libffi:=
59 + sys-apps/util-linux:=
60 + >=sys-libs/zlib-1.1.3:=
61 + virtual/libcrypt:=
62 + virtual/libintl
63 + gdbm? ( sys-libs/gdbm:=[berkdb] )
64 + ncurses? ( >=sys-libs/ncurses-5.2:= )
65 + readline? ( >=sys-libs/readline-4.1:= )
66 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
67 + ssl? ( >=dev-libs/openssl-1.1.1:= )
68 + tk? (
69 + >=dev-lang/tcl-8.0:=
70 + >=dev-lang/tk-8.0:=
71 + dev-tcltk/blt:=
72 + dev-tcltk/tix
73 + )
74 + xml? ( >=dev-libs/expat-2.1:= )"
75 +# bluetooth requires headers from bluez
76 +DEPEND="${RDEPEND}
77 + bluetooth? ( net-wireless/bluez )
78 + test? ( app-arch/xz-utils[extra-filters(+)] )"
79 +BDEPEND="
80 + virtual/pkgconfig
81 + sys-devel/autoconf-archive
82 + verify-sig? ( app-crypt/openpgp-keys-python )
83 + !sys-devel/gcc[libffi(-)]"
84 +RDEPEND+=" !build? ( app-misc/mime-types )"
85 +
86 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
87 +
88 +# large file tests involve a 2.5G file being copied (duplicated)
89 +CHECKREQS_DISK_BUILD=5500M
90 +
91 +pkg_pretend() {
92 + use test && check-reqs_pkg_pretend
93 +}
94 +
95 +pkg_setup() {
96 + use test && check-reqs_pkg_setup
97 +}
98 +
99 +src_unpack() {
100 + if use verify-sig; then
101 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
102 + fi
103 + default
104 +}
105 +
106 +src_prepare() {
107 + # Ensure that internal copies of expat, libffi and zlib are not used.
108 + rm -fr Modules/expat || die
109 + rm -fr Modules/_ctypes/libffi* || die
110 + rm -fr Modules/zlib || die
111 +
112 + rm -f "${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch || die
113 +
114 + local PATCHES=(
115 + "${WORKDIR}/${PATCHSET}"
116 + )
117 +
118 + default
119 +
120 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
121 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
122 +
123 + # force correct number of jobs
124 + # https://bugs.gentoo.org/737660
125 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
126 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
127 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
128 +
129 + eautoreconf
130 +}
131 +
132 +src_configure() {
133 + local disable
134 + # disable automagic bluetooth headers detection
135 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
136 + use gdbm || disable+=" gdbm"
137 + use ncurses || disable+=" _curses _curses_panel"
138 + use readline || disable+=" readline"
139 + use sqlite || disable+=" _sqlite3"
140 + use ssl || export PYTHON_DISABLE_SSL="1"
141 + use tk || disable+=" _tkinter"
142 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
143 + export PYTHON_DISABLE_MODULES="${disable}"
144 +
145 + if ! use xml; then
146 + ewarn "You have configured Python without XML support."
147 + ewarn "This is NOT a recommended configuration as you"
148 + ewarn "may face problems parsing any XML documents."
149 + fi
150 +
151 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
152 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
153 + fi
154 +
155 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
156 + append-flags -fwrapv
157 + fi
158 +
159 + filter-flags -malign-double
160 +
161 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
162 + if is-flagq -O3; then
163 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
164 + use hardened && replace-flags -O3 -O2
165 + fi
166 +
167 + # https://bugs.gentoo.org/700012
168 + if is-flagq -flto || is-flagq '-flto=*'; then
169 + append-cflags $(test-flags-CC -ffat-lto-objects)
170 + fi
171 +
172 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
173 + tc-export CXX
174 +
175 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
176 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
177 +
178 + local dbmliborder
179 + if use gdbm; then
180 + dbmliborder+="${dbmliborder:+:}gdbm"
181 + fi
182 +
183 + local myeconfargs=(
184 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
185 + # Python on glibc upgrade, remove it proactively to give
186 + # a chance for users rebuilding python before glibc
187 + ac_cv_header_stropts_h=no
188 +
189 + --enable-shared
190 + $(use_enable ipv6)
191 + --infodir='${prefix}/share/info'
192 + --mandir='${prefix}/share/man'
193 + --with-computed-gotos
194 + --with-dbmliborder="${dbmliborder}"
195 + --with-libc=
196 + --enable-loadable-sqlite-extensions
197 + --without-ensurepip
198 + --with-system-expat
199 + --with-system-ffi
200 + )
201 +
202 + OPT="" econf "${myeconfargs[@]}"
203 +
204 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
205 + eerror "configure has detected that the sem_open function is broken."
206 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
207 + die "Broken sem_open function (bug 496328)"
208 + fi
209 +}
210 +
211 +src_compile() {
212 + # Ensure sed works as expected
213 + # https://bugs.gentoo.org/594768
214 + local -x LC_ALL=C
215 +
216 + emake CPPFLAGS= CFLAGS= LDFLAGS=
217 +
218 + # Work around bug 329499. See also bug 413751 and 457194.
219 + if has_version dev-libs/libffi[pax-kernel]; then
220 + pax-mark E python
221 + else
222 + pax-mark m python
223 + fi
224 +}
225 +
226 +src_test() {
227 + # Tests will not work when cross compiling.
228 + if tc-is-cross-compiler; then
229 + elog "Disabling tests due to crosscompiling."
230 + return
231 + fi
232 +
233 + # Skip failing tests.
234 + local skipped_tests="gdb"
235 +
236 + for test in ${skipped_tests}; do
237 + mv "${S}"/Lib/test/test_${test}.py "${T}"
238 + done
239 +
240 + # bug 660358
241 + local -x COLUMNS=80
242 + local -x PYTHONDONTWRITEBYTECODE=
243 +
244 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
245 +
246 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
247 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
248 + local result=$?
249 +
250 + for test in ${skipped_tests}; do
251 + mv "${T}/test_${test}.py" "${S}"/Lib/test
252 + done
253 +
254 + elog "The following tests have been skipped:"
255 + for test in ${skipped_tests}; do
256 + elog "test_${test}.py"
257 + done
258 +
259 + elog "If you would like to run them, you may:"
260 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
261 + elog "and run the tests separately."
262 +
263 + if [[ ${result} -ne 0 ]]; then
264 + die "emake test failed"
265 + fi
266 +}
267 +
268 +src_install() {
269 + local libdir=${ED}/usr/lib/python${PYVER}
270 +
271 + emake DESTDIR="${D}" altinstall
272 +
273 + # Remove static library
274 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
275 +
276 + sed \
277 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
278 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
279 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
280 +
281 + # Fix collisions between different slots of Python.
282 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
283 +
284 + # Cheap hack to get version with ABIFLAGS
285 + local abiver=$(cd "${ED}/usr/include"; echo python*)
286 + if [[ ${abiver} != python${PYVER} ]]; then
287 + # Replace python3.X with a symlink to python3.Xm
288 + rm "${ED}/usr/bin/python${PYVER}" || die
289 + dosym "${abiver}" "/usr/bin/python${PYVER}"
290 + # Create python3.X-config symlink
291 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
292 + # Create python-3.5m.pc symlink
293 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
294 + fi
295 +
296 + # python seems to get rebuilt in src_install (bug 569908)
297 + # Work around it for now.
298 + if has_version dev-libs/libffi[pax-kernel]; then
299 + pax-mark E "${ED}/usr/bin/${abiver}"
300 + else
301 + pax-mark m "${ED}/usr/bin/${abiver}"
302 + fi
303 +
304 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
305 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
306 +
307 + dodoc Misc/{ACKS,HISTORY,NEWS}
308 +
309 + if use examples; then
310 + docinto examples
311 + find Tools -name __pycache__ -exec rm -fr {} + || die
312 + dodoc -r Tools
313 + fi
314 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
315 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
316 + emake --no-print-directory -s -f - 2>/dev/null)
317 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
318 +
319 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
320 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
321 + sed \
322 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
323 + -e "s:@PYDOC@:pydoc${PYVER}:" \
324 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
325 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
326 +
327 + local -x EPYTHON=python${PYVER}
328 + # if not using a cross-compiler, use the fresh binary
329 + if ! tc-is-cross-compiler; then
330 + local -x PYTHON=./python
331 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
332 + else
333 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
334 + fi
335 +
336 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
337 + python_domodule epython.py
338 +
339 + # python-exec wrapping support
340 + local pymajor=${PYVER%.*}
341 + local scriptdir=${D}$(python_get_scriptdir)
342 + mkdir -p "${scriptdir}" || die
343 + # python and pythonX
344 + ln -s "../../../bin/${abiver}" \
345 + "${scriptdir}/python${pymajor}" || die
346 + ln -s "python${pymajor}" "${scriptdir}/python" || die
347 + # python-config and pythonX-config
348 + # note: we need to create a wrapper rather than symlinking it due
349 + # to some random dirname(argv[0]) magic performed by python-config
350 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
351 + #!/bin/sh
352 + exec "${abiver}-config" "\${@}"
353 + EOF
354 + chmod +x "${scriptdir}/python${pymajor}-config" || die
355 + ln -s "python${pymajor}-config" \
356 + "${scriptdir}/python-config" || die
357 + # 2to3, pydoc
358 + ln -s "../../../bin/2to3-${PYVER}" \
359 + "${scriptdir}/2to3" || die
360 + ln -s "../../../bin/pydoc${PYVER}" \
361 + "${scriptdir}/pydoc" || die
362 + # idle
363 + if use tk; then
364 + ln -s "../../../bin/idle${PYVER}" \
365 + "${scriptdir}/idle" || die
366 + fi
367 +}