Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/python/
Date: Sun, 03 Mar 2019 17:20:29
Message-Id: 1551633617.c82771f1121f041488e5b8b26a7aa97458db513f.floppym@gentoo
1 commit: c82771f1121f041488e5b8b26a7aa97458db513f
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Mar 3 17:15:40 2019 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 3 17:20:17 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c82771f1
7
8 dev-lang/python: bump to 3.5.6
9
10 Package-Manager: Portage-2.3.59_p2, Repoman-2.3.12_p67
11 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
12
13 dev-lang/python/Manifest | 1 +
14 dev-lang/python/python-3.5.6.ebuild | 368 ++++++++++++++++++++++++++++++++++++
15 2 files changed, 369 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 58654f6f75b..48045472ea3 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -5,6 +5,7 @@ DIST Python-3.4.6.tar.xz 14473592 BLAKE2B 4af4f8e6f5c6831b50e99dd9eef47617f14903
22 DIST Python-3.4.8.tar.xz 14576444 BLAKE2B 262b82fbc0e4852216d2edf05f9e9194bc93be7b14a2d6ef56789b808cff274e58b2fa7134955464fd05ab36181b5861aeca31e2e05b27f0f58ac66d145bd56b SHA512 478552c72efe606cb1993024b81839c51d01f1c949564c007ab2b76016f110e1f7bd418e5de3f4f93b466ce7dbe6583d3c150830d1f28f75e0809625b568a7ec
23 DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61 SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
24 DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22
25 +DIST Python-3.5.6.tar.xz 15412832 BLAKE2B af129d76719c15cfb63745fd2811a9cf7e0c9146ac277622454b67524b9849eec031c8a14d4eafb5c4f81bb4379ca6bd8850819d0c8ae54c655731c2c1d94898 SHA512 1ccf287dbe8594eb577c1197c19d882fbe235c72f4c01cda23258f2add8a93e639b41ebaf556508b867cbe1b4c1fc4e1cf457d70b98cf7a1502013660a7e0ac1
26 DIST Python-3.6.3.tar.xz 16974296 BLAKE2B 8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623 SHA512 32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b
27 DIST Python-3.6.4.tar.xz 16992824 BLAKE2B 2347a70bb25468221178b1542ddd4376f136a515f2873ee1f640c4629eb77a9608af0f6be37128ba3e8ad614ebc17e7be20b73384983533aa77bca4403ea7935 SHA512 09ba2103ac517ac4d262f00380c9aac836a53401ce252540c17fd821a3b92e1ddf32528d00772221eb3126b12cb95b62c3ac3e852f4951e6f2eb406c88c848a2
28 DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
29
30 diff --git a/dev-lang/python/python-3.5.6.ebuild b/dev-lang/python/python-3.5.6.ebuild
31 new file mode 100644
32 index 00000000000..4687d3484b7
33 --- /dev/null
34 +++ b/dev-lang/python/python-3.5.6.ebuild
35 @@ -0,0 +1,368 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI="5"
40 +WANT_LIBTOOL="none"
41 +
42 +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
43 +
44 +MY_P="Python-${PV/_/}"
45 +PATCHSET_VERSION="3.5.4-0"
46 +
47 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
48 +HOMEPAGE="https://www.python.org/"
49 +SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
50 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
51 +
52 +LICENSE="PSF-2"
53 +SLOT="3.5/3.5m"
54 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
55 +IUSE="bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test +threads tk wininst +xml"
56 +RESTRICT="!test? ( test )"
57 +
58 +# Do not add a dependency on dev-lang/python to this ebuild.
59 +# If you need to apply a patch which requires python for bootstrapping, please
60 +# run the bootstrap code on your dev box and include the results in the
61 +# patchset. See bug 447752.
62 +
63 +RDEPEND="app-arch/bzip2:0=
64 + app-arch/xz-utils:0=
65 + >=sys-libs/zlib-1.1.3:0=
66 + virtual/libffi:=
67 + virtual/libintl
68 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
69 + ncurses? ( >=sys-libs/ncurses-5.2:0= )
70 + readline? ( >=sys-libs/readline-4.1:0= )
71 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
72 + ssl? (
73 + !libressl? ( dev-libs/openssl:0= )
74 + libressl? ( dev-libs/libressl:0= )
75 + )
76 + tk? (
77 + >=dev-lang/tcl-8.0:0=
78 + >=dev-lang/tk-8.0:0=
79 + dev-tcltk/blt:0=
80 + dev-tcltk/tix
81 + )
82 + xml? ( >=dev-libs/expat-2.1:0= )
83 + !!<sys-apps/sandbox-2.6-r1"
84 +# bluetooth requires headers from bluez
85 +DEPEND="${RDEPEND}
86 + bluetooth? ( net-wireless/bluez )
87 + virtual/pkgconfig
88 + !sys-devel/gcc[libffi(-)]"
89 +RDEPEND+=" !build? ( app-misc/mime-types )"
90 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
91 +
92 +S="${WORKDIR}/${MY_P}"
93 +
94 +PYVER=${SLOT%/*}
95 +
96 +src_prepare() {
97 + # Ensure that internal copies of expat, libffi and zlib are not used.
98 + rm -fr Modules/expat
99 + rm -fr Modules/_ctypes/libffi*
100 + rm -fr Modules/zlib
101 +
102 + if tc-is-cross-compiler; then
103 + # Invokes BUILDPYTHON, which is built for the host arch
104 + local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
105 + fi
106 +
107 + EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
108 + epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch"
109 + epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch"
110 + epatch "${FILESDIR}/3.6-disable-nis.patch"
111 + epatch "${FILESDIR}/python-3.5.5-libressl-compatibility.patch"
112 + epatch "${FILESDIR}/python-3.5.5-hash-unaligned.patch"
113 +
114 + epatch_user
115 +
116 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
117 + configure.ac \
118 + Lib/distutils/command/install.py \
119 + Lib/distutils/sysconfig.py \
120 + Lib/site.py \
121 + Lib/sysconfig.py \
122 + Lib/test/test_site.py \
123 + Makefile.pre.in \
124 + Modules/getpath.c \
125 + Modules/Setup.dist \
126 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
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 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
167 + tc-export CXX
168 +
169 + # The configure script fails to use pkg-config correctly.
170 + # http://bugs.python.org/issue15506
171 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
172 +
173 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
174 + # Needed on FreeBSD unless Python 3.2 is already installed.
175 + # Please query BSD team before removing this!
176 + append-ldflags "-L."
177 +
178 + local dbmliborder
179 + if use gdbm; then
180 + dbmliborder+="${dbmliborder:+:}gdbm"
181 + fi
182 +
183 + BUILD_DIR="${WORKDIR}/${CHOST}"
184 + mkdir -p "${BUILD_DIR}" || die
185 + cd "${BUILD_DIR}" || die
186 +
187 + local myeconfargs=(
188 + --with-fpectl
189 + --enable-shared
190 + $(use_enable ipv6)
191 + $(use_with threads)
192 + --infodir='${prefix}/share/info'
193 + --mandir='${prefix}/share/man'
194 + --with-computed-gotos
195 + --with-dbmliborder="${dbmliborder}"
196 + --with-libc=
197 + --enable-loadable-sqlite-extensions
198 + --without-ensurepip
199 + --with-system-expat
200 + --with-system-ffi
201 + )
202 +
203 + ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}"
204 +
205 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
206 + eerror "configure has detected that the sem_open function is broken."
207 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
208 + die "Broken sem_open function (bug 496328)"
209 + fi
210 +}
211 +
212 +src_compile() {
213 + # Ensure sed works as expected
214 + # https://bugs.gentoo.org/594768
215 + local -x LC_ALL=C
216 +
217 + cd "${BUILD_DIR}" || die
218 +
219 + emake CPPFLAGS= CFLAGS= LDFLAGS=
220 +
221 + # Work around bug 329499. See also bug 413751 and 457194.
222 + if has_version dev-libs/libffi[pax_kernel]; then
223 + pax-mark E python
224 + else
225 + pax-mark m python
226 + fi
227 +}
228 +
229 +src_test() {
230 + # Tests will not work when cross compiling.
231 + if tc-is-cross-compiler; then
232 + elog "Disabling tests due to crosscompiling."
233 + return
234 + fi
235 +
236 + cd "${BUILD_DIR}" || die
237 +
238 + # Skip failing tests.
239 + local skipped_tests="gdb"
240 +
241 + for test in ${skipped_tests}; do
242 + mv "${S}"/Lib/test/test_${test}.py "${T}"
243 + done
244 +
245 + local -x PYTHONDONTWRITEBYTECODE=
246 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
247 + local result=$?
248 +
249 + for test in ${skipped_tests}; do
250 + mv "${T}/test_${test}.py" "${S}"/Lib/test
251 + done
252 +
253 + elog "The following tests have been skipped:"
254 + for test in ${skipped_tests}; do
255 + elog "test_${test}.py"
256 + done
257 +
258 + elog "If you would like to run them, you may:"
259 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
260 + elog "and run the tests separately."
261 +
262 + if [[ ${result} -ne 0 ]]; then
263 + die "emake test failed"
264 + fi
265 +}
266 +
267 +src_install() {
268 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
269 +
270 + cd "${BUILD_DIR}" || die
271 +
272 + emake DESTDIR="${D}" altinstall
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 -f "${ED}usr/$(get_libdir)/libpython3.so"
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 elibc_uclibc && rm -fr "${libdir}/test"
303 + use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
304 + use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
305 +
306 + use threads || rm -fr "${libdir}/multiprocessing"
307 + use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
308 +
309 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
310 +
311 + if use examples; then
312 + insinto /usr/share/doc/${PF}/examples
313 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
314 + doins -r "${S}"/Tools
315 + fi
316 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
317 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
318 + emake --no-print-directory -s -f - 2>/dev/null)
319 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
320 +
321 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
322 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
323 + sed \
324 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
325 + -e "s:@PYDOC@:pydoc${PYVER}:" \
326 + -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
327 +
328 + # for python-exec
329 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
330 +
331 + # if not using a cross-compiler, use the fresh binary
332 + if ! tc-is-cross-compiler; then
333 + local -x PYTHON=./python
334 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
335 + else
336 + vars=( PYTHON "${vars[@]}" )
337 + fi
338 +
339 + python_export "python${PYVER}" "${vars[@]}"
340 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
341 + python_domodule epython.py
342 +
343 + # python-exec wrapping support
344 + local pymajor=${PYVER%.*}
345 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
346 + # python and pythonX
347 + ln -s "../../../bin/${abiver}" \
348 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
349 + ln -s "python${pymajor}" \
350 + "${D}${PYTHON_SCRIPTDIR}/python" || die
351 + # python-config and pythonX-config
352 + # note: we need to create a wrapper rather than symlinking it due
353 + # to some random dirname(argv[0]) magic performed by python-config
354 + cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
355 + #!/bin/sh
356 + exec "${abiver}-config" "\${@}"
357 + EOF
358 + chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
359 + ln -s "python${pymajor}-config" \
360 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
361 + # 2to3, pydoc, pyvenv
362 + ln -s "../../../bin/2to3-${PYVER}" \
363 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
364 + ln -s "../../../bin/pydoc${PYVER}" \
365 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
366 + ln -s "../../../bin/pyvenv-${PYVER}" \
367 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
368 + # idle
369 + if use tk; then
370 + ln -s "../../../bin/idle${PYVER}" \
371 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
372 + fi
373 +}
374 +
375 +pkg_preinst() {
376 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
377 + python_updater_warning="1"
378 + fi
379 +}
380 +
381 +eselect_python_update() {
382 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
383 + eselect python update
384 + fi
385 +
386 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
387 + eselect python update --python${PV%%.*}
388 + fi
389 +}
390 +
391 +pkg_postinst() {
392 + eselect_python_update
393 +
394 + if [[ "${python_updater_warning}" == "1" ]]; then
395 + ewarn "You have just upgraded from an older version of Python."
396 + ewarn
397 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
398 + fi
399 +}
400 +
401 +pkg_postrm() {
402 + eselect_python_update
403 +}