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: Thu, 10 Sep 2020 13:38:56
Message-Id: 1599745127.a6f8a124c2578cd3c6fffd07fbef8551bb74db7d.mgorny@gentoo
1 commit: a6f8a124c2578cd3c6fffd07fbef8551bb74db7d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 10 13:23:24 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 10 13:38:47 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a6f8a124
7
8 dev-lang/python: Backport two more secfixes from 3.6 to 2.7.18
9
10 Bug: https://bugs.gentoo.org/741502
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 dev-lang/python/Manifest | 1 +
14 dev-lang/python/python-2.7.18-r2.ebuild | 366 ++++++++++++++++++++++++++++++++
15 2 files changed, 367 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 76cb3c76599..cb94a5e0ee4 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -7,6 +7,7 @@ DIST Python-3.8.4.tar.xz 18020412 BLAKE2B cfcfb293c413b25fc3ca48116cf8ffaba7bee1
22 DIST Python-3.8.5.tar.xz 18019640 BLAKE2B bb3e0566afe28759e4ab129ad0986a0fc5103514f2e2b22ff4aa3973c3173ebdd24d4267fbaf903841814a611fd9ea122673e5a1918934366e5c0efaef9d7517 SHA512 460cee65d7df7150694590575502d7f22e548ebfc99c8f8b363eef8bf30ee72e58d8ffacb1d607824f877f880eb9fd6775a508388029583e1e1df3380f3f9587
23 DIST Python-3.9.0rc1.tar.xz 18798364 BLAKE2B 2ebf669720bcc057f7e1056aca6ff42686a8e567a5ea10304f19e53ae80ba6ba60b9157ae401427be4afa1ec296d97bb81a2b55c60a4df3dba39ae545484e0fc SHA512 8fddf940600bdd4096c0144f689fb9e803bdc7a1ee00f46ccfde3566342ed465c7ac6806613e4f61440fb65f8f83057204bd0dc432ac379759cd4d410c151eef
24 DIST python-gentoo-patches-2.7.18-r1.tar.xz 15500 BLAKE2B 7008b29827dbbd80d4ab8f010ccf9efced99c6b4b9109e4430c0ba269ce53529cb6fedd832502c8d2d3aa21938749cc3591c2545b21c0a59a6e60f8598e84ccc SHA512 e656ab07281fd932b92165674619bbf55ecf410d2937ae4ae771d490b4532540498cc731d30d19c1e8aafd1f64df8a406bbfbb46ea985b3dcd8edb89a0b7f20f
25 +DIST python-gentoo-patches-2.7.18-r2.tar.xz 18820 BLAKE2B 0855ca0d76b0027caab7a1655f7e13117eabd24bcb308419624d39265b1cbfb24783571bd64eccac88345bb5b6c98470de74564924a62d66124bca0f0405f211 SHA512 ce478125602b2c9a2142469de6b434e4e4be0fefcea685a9618dd8129a9f1cfea1a4244bec5991aedc0f73b5d5379cfae62241819af9bbd97e8d0439b97bb04a
26 DIST python-gentoo-patches-3.6.11-r3.tar.xz 14064 BLAKE2B 416780c15ee12cfc06bfd1397d510dd42fea61abcaafd9cf54f27d843342debf0caa93c9700686feb14f04239ad4ea8f20ce8736029638abe7d7b9c57b9d659d SHA512 de6a4a5bec89e6149b85b383991c99bd9460a8f59f52a700d54edd0154557727ccc79daaa90336dff434b222657c3f28dda1228d2d474002d0a28f31c9ed0b10
27 DIST python-gentoo-patches-3.6.12.tar.xz 11448 BLAKE2B a7fb7153ca6fd353649f9dc23f2d777e84ff144d67984d8c3d292619a4f671e3a71d8022bcc334b55f9f1f416ceeca113fb116da805e4bc45d8a67cbc098ead8 SHA512 7efb97abd3e058e4532b89205c99794836ba094079de2a6d7846fd2673ea8cc31e68573b83fd9f82453151653fb0ed9bc40b7961b41efdfe703b64cbed2576bf
28 DIST python-gentoo-patches-3.7.8-r3.tar.xz 13232 BLAKE2B 9df47b1f61d08f62a80221bc48d73ec27cd74a9ade8219912c5b02eaea919b70d91b1154837cd03c0129a5839186e9c970167ca3398129c044c25c7853f1f920 SHA512 e1477d425cb6125ca2286d816f4aa4e9e3c789d6a4f4907bd7b78549598356cae5766f642e2cad9e7c3abe2e82c12cf3cb7db3513be68aa213cb64cc0abc678a
29
30 diff --git a/dev-lang/python/python-2.7.18-r2.ebuild b/dev-lang/python/python-2.7.18-r2.ebuild
31 new file mode 100644
32 index 00000000000..918fc189544
33 --- /dev/null
34 +++ b/dev-lang/python/python-2.7.18-r2.ebuild
35 @@ -0,0 +1,366 @@
36 +# Copyright 1999-2020 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI="7"
40 +WANT_LIBTOOL="none"
41 +
42 +inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs
43 +
44 +MY_P="Python-${PV}"
45 +PYVER=$(ver_cut 1-2)
46 +PATCHSET="python-gentoo-patches-2.7.18-r2"
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 ~s390 ~sparc ~x86"
57 +IUSE="-berkdb bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml"
58 +
59 +# Do not add a dependency on dev-lang/python to this ebuild.
60 +# If you need to apply a patch which requires python for bootstrapping, please
61 +# run the bootstrap code on your dev box and include the results in the
62 +# patchset. See bug 447752.
63 +
64 +RDEPEND="app-arch/bzip2:=
65 + dev-libs/libffi:=
66 + >=sys-libs/zlib-1.1.3:=
67 + virtual/libcrypt:=
68 + virtual/libintl
69 + berkdb? ( || (
70 + sys-libs/db:5.3
71 + sys-libs/db:5.1
72 + sys-libs/db:4.8
73 + sys-libs/db:4.7
74 + sys-libs/db:4.6
75 + sys-libs/db:4.5
76 + sys-libs/db:4.4
77 + sys-libs/db:4.3
78 + sys-libs/db:4.2
79 + ) )
80 + gdbm? ( sys-libs/gdbm:=[berkdb] )
81 + ncurses? ( >=sys-libs/ncurses-5.2:= )
82 + readline? ( >=sys-libs/readline-4.1:= )
83 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
84 + ssl? (
85 + !libressl? ( dev-libs/openssl:= )
86 + libressl? ( dev-libs/libressl:= )
87 + )
88 + tk? (
89 + >=dev-lang/tcl-8.0:=
90 + >=dev-lang/tk-8.0:=
91 + dev-tcltk/blt:=
92 + dev-tcltk/tix
93 + )
94 + xml? ( >=dev-libs/expat-2.1:= )"
95 +# bluetooth requires headers from bluez
96 +DEPEND="${RDEPEND}
97 + bluetooth? ( net-wireless/bluez )
98 + virtual/pkgconfig
99 + !sys-devel/gcc[libffi(-)]"
100 +RDEPEND+=" !build? ( app-misc/mime-types )"
101 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
102 +
103 +pkg_setup() {
104 + if use berkdb; then
105 + ewarn "'bsddb' module is out-of-date and no longer maintained inside"
106 + ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally"
107 + ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module"
108 + ewarn "is provided by dev-python/bsddb3."
109 + else
110 + if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then
111 + ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"
112 + ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]."
113 + ewarn "You might need to migrate your databases."
114 + fi
115 + fi
116 +}
117 +
118 +src_prepare() {
119 + # Ensure that internal copies of expat, libffi and zlib are not used.
120 + rm -fr Modules/expat || die
121 + rm -fr Modules/_ctypes/libffi* || die
122 + rm -fr Modules/zlib || die
123 +
124 + local PATCHES=(
125 + "${WORKDIR}/${PATCHSET}"
126 + )
127 +
128 + default
129 +
130 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
131 + Lib/distutils/command/install.py \
132 + Lib/distutils/sysconfig.py \
133 + Lib/site.py \
134 + Lib/sysconfig.py \
135 + Lib/test/test_site.py \
136 + Makefile.pre.in \
137 + Modules/Setup.dist \
138 + Modules/getpath.c \
139 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
140 +
141 + eautoreconf
142 +}
143 +
144 +src_configure() {
145 + # dbm module can be linked against berkdb or gdbm.
146 + # Defaults to gdbm when both are enabled, #204343.
147 + local disable
148 + use berkdb || use gdbm || disable+=" dbm"
149 + use berkdb || disable+=" _bsddb"
150 + # disable automagic bluetooth headers detection
151 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
152 + use gdbm || disable+=" gdbm"
153 + use ncurses || disable+=" _curses _curses_panel"
154 + use readline || disable+=" readline"
155 + use sqlite || disable+=" _sqlite3"
156 + use ssl || export PYTHON_DISABLE_SSL="1"
157 + use tk || disable+=" _tkinter"
158 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
159 + export PYTHON_DISABLE_MODULES="${disable}"
160 +
161 + if ! use xml; then
162 + ewarn "You have configured Python without XML support."
163 + ewarn "This is NOT a recommended configuration as you"
164 + ewarn "may face problems parsing any XML documents."
165 + fi
166 +
167 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
168 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
169 + fi
170 +
171 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
172 + append-flags -fwrapv
173 + fi
174 +
175 + filter-flags -malign-double
176 +
177 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
178 + if is-flagq -O3; then
179 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
180 + use hardened && replace-flags -O3 -O2
181 + fi
182 +
183 + if tc-is-cross-compiler; then
184 + # Force some tests that try to poke fs paths.
185 + export ac_cv_file__dev_ptc=no
186 + export ac_cv_file__dev_ptmx=yes
187 + fi
188 +
189 + # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
190 + tc-export CXX
191 + # The configure script fails to use pkg-config correctly.
192 + # http://bugs.python.org/issue15506
193 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
194 +
195 + # Set LDFLAGS so we link modules with -lpython2.7 correctly.
196 + # Needed on FreeBSD unless Python 2.7 is already installed.
197 + # Please query BSD team before removing this!
198 + append-ldflags "-L."
199 +
200 + local dbmliborder
201 + if use gdbm; then
202 + dbmliborder+="${dbmliborder:+:}gdbm"
203 + fi
204 + if use berkdb; then
205 + dbmliborder+="${dbmliborder:+:}bdb"
206 + fi
207 +
208 + local myeconfargs=(
209 + # The check is broken on clang, and gives false positive:
210 + # https://bugs.gentoo.org/596798
211 + # (upstream dropped this flag in 3.2a4 anyway)
212 + ac_cv_opt_olimit_ok=no
213 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
214 + # Python on glibc upgrade, remove it proactively to give
215 + # a chance for users rebuilding python before glibc
216 + ac_cv_header_stropts_h=no
217 +
218 + --with-fpectl
219 + --enable-shared
220 + $(use_enable ipv6)
221 + $(use_with threads)
222 + $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2")
223 + --infodir='${prefix}/share/info'
224 + --mandir='${prefix}/share/man'
225 + --with-computed-gotos
226 + --with-dbmliborder="${dbmliborder}"
227 + --with-libc=
228 + --enable-loadable-sqlite-extensions
229 + --with-system-expat
230 + --with-system-ffi
231 + --without-ensurepip
232 + )
233 +
234 + OPT="" econf "${myeconfargs[@]}"
235 +
236 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
237 + eerror "configure has detected that the sem_open function is broken."
238 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
239 + die "Broken sem_open function (bug 496328)"
240 + fi
241 +}
242 +
243 +src_compile() {
244 + # Ensure sed works as expected
245 + # https://bugs.gentoo.org/594768
246 + local -x LC_ALL=C
247 +
248 + # Avoid invoking pgen for cross-compiles.
249 + touch Include/graminit.h Python/graminit.c
250 +
251 + emake
252 +
253 + # Work around bug 329499. See also bug 413751 and 457194.
254 + if has_version dev-libs/libffi[pax_kernel]; then
255 + pax-mark E python
256 + else
257 + pax-mark m python
258 + fi
259 +}
260 +
261 +src_test() {
262 + # Tests will not work when cross compiling.
263 + if tc-is-cross-compiler; then
264 + elog "Disabling tests due to crosscompiling."
265 + return
266 + fi
267 +
268 + # Skip failing tests.
269 + local skipped_tests="distutils gdb"
270 +
271 + for test in ${skipped_tests}; do
272 + mv "${S}"/Lib/test/test_${test}.py "${T}"
273 + done
274 +
275 + # bug 660358
276 + local -x COLUMNS=80
277 +
278 + # Daylight saving time problem
279 + # https://bugs.python.org/issue22067
280 + # https://bugs.gentoo.org/610628
281 + local -x TZ=UTC
282 +
283 + # Rerun failed tests in verbose mode (regrtest -w).
284 + emake test EXTRATESTOPTS="-w" < /dev/tty
285 + local result="$?"
286 +
287 + for test in ${skipped_tests}; do
288 + mv "${T}/test_${test}.py" "${S}"/Lib/test
289 + done
290 +
291 + elog "The following tests have been skipped:"
292 + for test in ${skipped_tests}; do
293 + elog "test_${test}.py"
294 + done
295 +
296 + elog "If you would like to run them, you may:"
297 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
298 + elog "and run the tests separately."
299 +
300 + if [[ ${result} -ne 0 ]]; then
301 + die "emake test failed"
302 + fi
303 +}
304 +
305 +src_install() {
306 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
307 +
308 + emake DESTDIR="${D}" altinstall
309 +
310 + sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die
311 +
312 + # Fix collisions between different slots of Python.
313 + mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die
314 + mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die
315 + mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die
316 + rm "${ED}/usr/bin/smtpd.py" || die
317 +
318 + use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die
319 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
320 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,lib-tk} || die
321 + use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
322 +
323 + use threads || rm -r "${libdir}/multiprocessing" || die
324 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
325 +
326 + dodoc Misc/{ACKS,HISTORY,NEWS}
327 +
328 + if use examples; then
329 + docinto examples
330 + dodoc -r Tools
331 + fi
332 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
333 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
334 + emake --no-print-directory -s -f - 2>/dev/null)
335 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
336 +
337 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
338 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
339 + sed \
340 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
341 + -e "s:@PYDOC@:pydoc${PYVER}:" \
342 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
343 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
344 +
345 + local -x EPYTHON=python${PYVER}
346 + # if not using a cross-compiler, use the fresh binary
347 + if ! tc-is-cross-compiler; then
348 + local -x PYTHON=./python
349 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
350 + else
351 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
352 + fi
353 +
354 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
355 + python_domodule epython.py
356 +
357 + # python-exec wrapping support
358 + local pymajor=${PYVER%.*}
359 + local scriptdir=${D}$(python_get_scriptdir)
360 + mkdir -p "${scriptdir}" || die
361 + # python and pythonX
362 + ln -s "../../../bin/python${PYVER}" \
363 + "${scriptdir}/python${pymajor}" || die
364 + ln -s "python${pymajor}" "${scriptdir}/python" || die
365 + # python-config and pythonX-config
366 + ln -s "../../../bin/python${PYVER}-config" \
367 + "${scriptdir}/python${pymajor}-config" || die
368 + ln -s "python${pymajor}-config" \
369 + "${scriptdir}/python-config" || die
370 + # 2to3, pydoc, pyvenv
371 + ln -s "../../../bin/2to3-${PYVER}" \
372 + "${scriptdir}/2to3" || die
373 + ln -s "../../../bin/pydoc${PYVER}" \
374 + "${scriptdir}/pydoc" || die
375 + # idle
376 + if use tk; then
377 + ln -s "../../../bin/idle${PYVER}" \
378 + "${scriptdir}/idle" || die
379 + fi
380 +}
381 +
382 +eselect_python_update() {
383 + if [[ -z "$(eselect python show)" || \
384 + ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
385 + eselect python update
386 + fi
387 +
388 + if [[ -z "$(eselect python show --python${PV%%.*})" || \
389 + ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]]
390 + then
391 + eselect python update --python${PV%%.*}
392 + fi
393 +}
394 +
395 +pkg_postinst() {
396 + eselect_python_update
397 +}
398 +
399 +pkg_postrm() {
400 + eselect_python_update
401 +}