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