1 |
commit: fc8ce9230e9a9590e92337682b14f9a864077567 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Apr 2 23:26:10 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 2 23:42:41 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fc8ce923 |
7 |
|
8 |
dev-lang/python: Backport secfixes to 3.7.10 |
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.10_p1.ebuild | 333 ++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 334 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
17 |
index 0e96000db63..ff28d12d106 100644 |
18 |
--- a/dev-lang/python/Manifest |
19 |
+++ b/dev-lang/python/Manifest |
20 |
@@ -14,6 +14,7 @@ DIST python-gentoo-patches-2.7.18_p7.tar.xz 26392 BLAKE2B 94a6312698789810af835a |
21 |
DIST python-gentoo-patches-3.10.0a6.tar.xz 8148 BLAKE2B 0fb7fc2eb2d17ff34f9b973aee7761d78b279425044f80a8f3f6a97ae479492f509bf4a18bce16e9b5efd44e6a755a9af3cac1a63e8fa7169e4880ad08bc0f7a SHA512 39d449ef090ac01463e507784500fde408487350d5a5cf86b9bda852f451841874557d674c69eb31e94121d2d243f862ea97cd0d8ba69f4ddfdefa461336594b |
22 |
DIST python-gentoo-patches-3.6.13.tar.xz 11428 BLAKE2B 3f6ea5a5a79ba6b0d12d9d36c62232cbf0accbc3a8d792a12e2ed8ad5ce5079ac5a5d12493fbc36dff66b275a18a538c439fff02efdd77a68d5c974aa0e62a96 SHA512 118a8ca9d19b515d03ec834a950410bd8c8086dd9b3ea2e1dff5c7d3d42a4d873bccea62aa9d1b64f92892aecd090eb1337dec7d200668d55fece68eeacfa2dc |
23 |
DIST python-gentoo-patches-3.7.10.tar.xz 10572 BLAKE2B 440d004985407beb256863d37e798dbf6626b0c26fd443a5651d76cd584323abe31a13f5370d9808cd385cd999693b59097ad6ef6142c255a7b306a632fc68cf SHA512 ffe567d05b9de5f58c6a6786a5ff28f5a09aec76a69e57ab025b1c7bab57f4087704d465c049017ffd2680cc7e7363a54c5313774c0214258fa99b56bb1d46fe |
24 |
+DIST python-gentoo-patches-3.7.10_p1.tar.xz 14140 BLAKE2B 2d9a80f27e7ba5be2d5cdb5c1cd95eb6e32de7a0bc86c58a4ff9e8727d2ad588ceec064d2222dffe783d1710bef91d35ba02128508944a5f9266f4d4332217d7 SHA512 6705311d03212d61c7e6e97d83e4110ca1ec621a24a7d0ad16812fabcb87dfce9ef8c1184b16f7f0f5998576bfa87840e105b754edebd6e21c0ad33786255a0c |
25 |
DIST python-gentoo-patches-3.8.8.tar.xz 10948 BLAKE2B 745f4a8d3a41c61a8bc96b550c230d0a33ea0e1ecff2aec46dd91c9573cbd3a880891bea446cb867412687ad5875e14da36df065a5bcf340c984b8e2a165f183 SHA512 31c9acec582a13703e95e4ea9fbedc764638c470b02d798e46de0dfddbdf65e0a07ce14ae95af78cf46c29bdfcec0f65bbde06518a742061e1805ae4699610eb |
26 |
DIST python-gentoo-patches-3.8.8_p1.tar.xz 15456 BLAKE2B 7d9f55f951f97ef7e08d0245dddd21f5b8d126735c1c392ba6326ad1c18023b477f62e9b6663d8e5b6f0362e442137d0b6ed3ea13b279cca6734d36dbe6e654f SHA512 7fff74d03a0c4cd4b5c977761179c2b9a0ed472847ee9544f54331cef7549557ac4d6b78e676058bd2b01c96ca59d84f04c55beca8ddc45f16b11ce349210eea |
27 |
DIST python-gentoo-patches-3.9.2.tar.xz 8824 BLAKE2B a1cd122837b50e6cf0459f86a1d88ecc4b266f5a0658975c9913f1f4e9cf6a79a0309c89c37421e92ab59f3854309cdea8ea233b771cdf517c7aea432e44bc53 SHA512 2e619ad2a7b2af2fef9070c85619e3104d99977f2c839eb1e20ed9cc3dd6c5092f7d9587c94e76d530f89272741fe6ce345e36448f6aa2800f2dc9b6b425b1e7 |
28 |
|
29 |
diff --git a/dev-lang/python/python-3.7.10_p1.ebuild b/dev-lang/python/python-3.7.10_p1.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..526e795806e |
32 |
--- /dev/null |
33 |
+++ b/dev-lang/python/python-3.7.10_p1.ebuild |
34 |
@@ -0,0 +1,333 @@ |
35 |
+# Copyright 1999-2021 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 multiprocessing pax-utils \ |
42 |
+ python-utils-r1 toolchain-funcs verify-sig |
43 |
+ |
44 |
+MY_P="Python-${PV%_p*}" |
45 |
+PYVER=$(ver_cut 1-2) |
46 |
+PATCHSET="python-gentoo-patches-${PV}" |
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 |
+ verify-sig? ( |
53 |
+ https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc |
54 |
+ )" |
55 |
+S="${WORKDIR}/${MY_P}" |
56 |
+ |
57 |
+LICENSE="PSF-2" |
58 |
+SLOT="${PYVER}/${PYVER}m" |
59 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
60 |
+IUSE="bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline +sqlite +ssl test tk wininst +xml" |
61 |
+RESTRICT="!test? ( test )" |
62 |
+ |
63 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
64 |
+# If you need to apply a patch which requires python for bootstrapping, please |
65 |
+# run the bootstrap code on your dev box and include the results in the |
66 |
+# patchset. See bug 447752. |
67 |
+ |
68 |
+RDEPEND="app-arch/bzip2:= |
69 |
+ app-arch/xz-utils:= |
70 |
+ dev-libs/libffi:= |
71 |
+ sys-apps/util-linux:= |
72 |
+ >=sys-libs/zlib-1.1.3:= |
73 |
+ virtual/libcrypt:= |
74 |
+ virtual/libintl |
75 |
+ gdbm? ( sys-libs/gdbm:=[berkdb] ) |
76 |
+ ncurses? ( >=sys-libs/ncurses-5.2:= ) |
77 |
+ readline? ( >=sys-libs/readline-4.1:= ) |
78 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
79 |
+ ssl? ( |
80 |
+ !libressl? ( dev-libs/openssl:= ) |
81 |
+ libressl? ( dev-libs/libressl:= ) |
82 |
+ ) |
83 |
+ tk? ( |
84 |
+ >=dev-lang/tcl-8.0:= |
85 |
+ >=dev-lang/tk-8.0:= |
86 |
+ dev-tcltk/blt:= |
87 |
+ dev-tcltk/tix |
88 |
+ ) |
89 |
+ xml? ( >=dev-libs/expat-2.1:= )" |
90 |
+# bluetooth requires headers from bluez |
91 |
+DEPEND="${RDEPEND} |
92 |
+ bluetooth? ( net-wireless/bluez ) |
93 |
+ test? ( app-arch/xz-utils[extra-filters(+)] )" |
94 |
+BDEPEND=" |
95 |
+ virtual/pkgconfig |
96 |
+ verify-sig? ( app-crypt/openpgp-keys-python ) |
97 |
+ !sys-devel/gcc[libffi(-)]" |
98 |
+PDEPEND="app-eselect/eselect-python" |
99 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
100 |
+ |
101 |
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/python.org.asc |
102 |
+ |
103 |
+src_unpack() { |
104 |
+ if use verify-sig; then |
105 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
106 |
+ fi |
107 |
+ default |
108 |
+} |
109 |
+ |
110 |
+src_prepare() { |
111 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
112 |
+ rm -fr Modules/expat || die |
113 |
+ rm -fr Modules/_ctypes/libffi* || die |
114 |
+ rm -fr Modules/zlib || die |
115 |
+ |
116 |
+ local PATCHES=( |
117 |
+ "${WORKDIR}/${PATCHSET}" |
118 |
+ ) |
119 |
+ |
120 |
+ default |
121 |
+ |
122 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
123 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
124 |
+ |
125 |
+ # force correct number of jobs |
126 |
+ # https://bugs.gentoo.org/737660 |
127 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
128 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
129 |
+ |
130 |
+ eautoreconf |
131 |
+} |
132 |
+ |
133 |
+src_configure() { |
134 |
+ local disable |
135 |
+ # disable automagic bluetooth headers detection |
136 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
137 |
+ use gdbm || disable+=" gdbm" |
138 |
+ use ncurses || disable+=" _curses _curses_panel" |
139 |
+ use readline || disable+=" readline" |
140 |
+ use sqlite || disable+=" _sqlite3" |
141 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
142 |
+ use tk || disable+=" _tkinter" |
143 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
144 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
145 |
+ |
146 |
+ if ! use xml; then |
147 |
+ ewarn "You have configured Python without XML support." |
148 |
+ ewarn "This is NOT a recommended configuration as you" |
149 |
+ ewarn "may face problems parsing any XML documents." |
150 |
+ fi |
151 |
+ |
152 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
153 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
154 |
+ fi |
155 |
+ |
156 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
157 |
+ append-flags -fwrapv |
158 |
+ fi |
159 |
+ |
160 |
+ filter-flags -malign-double |
161 |
+ |
162 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
163 |
+ if is-flagq -O3; then |
164 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
165 |
+ use hardened && replace-flags -O3 -O2 |
166 |
+ fi |
167 |
+ |
168 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
169 |
+ tc-export CXX |
170 |
+ |
171 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
172 |
+ use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
173 |
+ |
174 |
+ local dbmliborder |
175 |
+ if use gdbm; then |
176 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
177 |
+ fi |
178 |
+ |
179 |
+ local myeconfargs=( |
180 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
181 |
+ # Python on glibc upgrade, remove it proactively to give |
182 |
+ # a chance for users rebuilding python before glibc |
183 |
+ ac_cv_header_stropts_h=no |
184 |
+ |
185 |
+ --enable-shared |
186 |
+ $(use_enable ipv6) |
187 |
+ --infodir='${prefix}/share/info' |
188 |
+ --mandir='${prefix}/share/man' |
189 |
+ --with-computed-gotos |
190 |
+ --with-dbmliborder="${dbmliborder}" |
191 |
+ --with-libc= |
192 |
+ --enable-loadable-sqlite-extensions |
193 |
+ --without-ensurepip |
194 |
+ --with-system-expat |
195 |
+ --with-system-ffi |
196 |
+ ) |
197 |
+ |
198 |
+ OPT="" econf "${myeconfargs[@]}" |
199 |
+ |
200 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
201 |
+ eerror "configure has detected that the sem_open function is broken." |
202 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
203 |
+ die "Broken sem_open function (bug 496328)" |
204 |
+ fi |
205 |
+} |
206 |
+ |
207 |
+src_compile() { |
208 |
+ # Ensure sed works as expected |
209 |
+ # https://bugs.gentoo.org/594768 |
210 |
+ local -x LC_ALL=C |
211 |
+ |
212 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
213 |
+ |
214 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
215 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
216 |
+ pax-mark E python |
217 |
+ else |
218 |
+ pax-mark m python |
219 |
+ fi |
220 |
+} |
221 |
+ |
222 |
+src_test() { |
223 |
+ # Tests will not work when cross compiling. |
224 |
+ if tc-is-cross-compiler; then |
225 |
+ elog "Disabling tests due to crosscompiling." |
226 |
+ return |
227 |
+ fi |
228 |
+ |
229 |
+ # Skip failing tests. |
230 |
+ local skipped_tests="gdb" |
231 |
+ |
232 |
+ for test in ${skipped_tests}; do |
233 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
234 |
+ done |
235 |
+ |
236 |
+ # bug 660358 |
237 |
+ local -x COLUMNS=80 |
238 |
+ local -x PYTHONDONTWRITEBYTECODE= |
239 |
+ |
240 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
241 |
+ |
242 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
243 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
244 |
+ local result=$? |
245 |
+ |
246 |
+ for test in ${skipped_tests}; do |
247 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
248 |
+ done |
249 |
+ |
250 |
+ elog "The following tests have been skipped:" |
251 |
+ for test in ${skipped_tests}; do |
252 |
+ elog "test_${test}.py" |
253 |
+ done |
254 |
+ |
255 |
+ elog "If you would like to run them, you may:" |
256 |
+ elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" |
257 |
+ elog "and run the tests separately." |
258 |
+ |
259 |
+ if [[ ${result} -ne 0 ]]; then |
260 |
+ die "emake test failed" |
261 |
+ fi |
262 |
+} |
263 |
+ |
264 |
+src_install() { |
265 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
266 |
+ |
267 |
+ emake DESTDIR="${D}" altinstall |
268 |
+ |
269 |
+ # Remove static library |
270 |
+ rm "${ED}"/usr/$(get_libdir)/libpython*.a || die |
271 |
+ |
272 |
+ sed \ |
273 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
274 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
275 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
276 |
+ |
277 |
+ # Fix collisions between different slots of Python. |
278 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
279 |
+ |
280 |
+ # Cheap hack to get version with ABIFLAGS |
281 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
282 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
283 |
+ # Replace python3.X with a symlink to python3.Xm |
284 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
285 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
286 |
+ # Create python3.X-config symlink |
287 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
288 |
+ # Create python-3.5m.pc symlink |
289 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
290 |
+ fi |
291 |
+ |
292 |
+ # python seems to get rebuilt in src_install (bug 569908) |
293 |
+ # Work around it for now. |
294 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
295 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
296 |
+ else |
297 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
298 |
+ fi |
299 |
+ |
300 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
301 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
302 |
+ |
303 |
+ use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || 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, pyvenv |
356 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
357 |
+ "${scriptdir}/2to3" || die |
358 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
359 |
+ "${scriptdir}/pydoc" || die |
360 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
361 |
+ "${scriptdir}/pyvenv" || die |
362 |
+ # idle |
363 |
+ if use tk; then |
364 |
+ ln -s "../../../bin/idle${PYVER}" \ |
365 |
+ "${scriptdir}/idle" || die |
366 |
+ fi |
367 |
+} |