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, 01 Apr 2018 17:18:50
Message-Id: 1522603092.2f870072cd8bdb7ec3f5daa059f794e905161cac.floppym@gentoo
1 commit: 2f870072cd8bdb7ec3f5daa059f794e905161cac
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 1 17:02:30 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 1 17:18:12 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f870072
7
8 dev-lang/python: bump to 3.5.5
9
10 Package-Manager: Portage-2.3.24, Repoman-2.3.6_p81
11
12 dev-lang/python/Manifest | 1 +
13 dev-lang/python/python-3.5.5.ebuild | 365 ++++++++++++++++++++++++++++++++++++
14 2 files changed, 366 insertions(+)
15
16 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
17 index 96cee8da02d..4928ff20ac6 100644
18 --- a/dev-lang/python/Manifest
19 +++ b/dev-lang/python/Manifest
20 @@ -3,6 +3,7 @@ DIST Python-3.4.5.tar.xz 14516820 BLAKE2B f9ddabd2df2241089d07756d3a8ba1c70096be
21 DIST Python-3.4.6.tar.xz 14473592 BLAKE2B 4af4f8e6f5c6831b50e99dd9eef47617f14903dc709f53f833c64726b003e9f84f75be80ba8059dcada2b2f262d65875f70d8c53a163546e51f9a715c68f4f20 SHA512 f6785cf6a99a8a27823baefe59cc20e34cbec01bb444c8600e7f49b5437159d5137f9d80fce26e219846d71bfe98f68bc6f0c87719a34db0050a4eaca95959ac
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.6.3.tar.xz 16974296 BLAKE2B 8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623 SHA512 32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b
26 DIST Python-3.6.4.tar.xz 16992824 BLAKE2B 2347a70bb25468221178b1542ddd4376f136a515f2873ee1f640c4629eb77a9608af0f6be37128ba3e8ad614ebc17e7be20b73384983533aa77bca4403ea7935 SHA512 09ba2103ac517ac4d262f00380c9aac836a53401ce252540c17fd821a3b92e1ddf32528d00772221eb3126b12cb95b62c3ac3e852f4951e6f2eb406c88c848a2
27 DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
28
29 diff --git a/dev-lang/python/python-3.5.5.ebuild b/dev-lang/python/python-3.5.5.ebuild
30 new file mode 100644
31 index 00000000000..51ef212e0f8
32 --- /dev/null
33 +++ b/dev-lang/python/python-3.5.5.ebuild
34 @@ -0,0 +1,365 @@
35 +# Copyright 1999-2018 Gentoo Foundation
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI="5"
39 +WANT_LIBTOOL="none"
40 +
41 +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
42 +
43 +MY_P="Python-${PV/_/}"
44 +PATCHSET_VERSION="3.5.4-0"
45 +
46 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
47 +HOMEPAGE="https://www.python.org/"
48 +SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
49 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
50 +
51 +LICENSE="PSF-2"
52 +SLOT="3.5/3.5m"
53 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
54 +IUSE="build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test +threads tk wininst +xml"
55 +RESTRICT="!test? ( test )"
56 +
57 +# Do not add a dependency on dev-lang/python to this ebuild.
58 +# If you need to apply a patch which requires python for bootstrapping, please
59 +# run the bootstrap code on your dev box and include the results in the
60 +# patchset. See bug 447752.
61 +
62 +RDEPEND="app-arch/bzip2:0=
63 + app-arch/xz-utils:0=
64 + >=sys-libs/zlib-1.1.3:0=
65 + virtual/libffi
66 + virtual/libintl
67 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
68 + ncurses? (
69 + >=sys-libs/ncurses-5.2:0=
70 + readline? ( >=sys-libs/readline-4.1:0= )
71 + )
72 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
73 + ssl? (
74 + !libressl? ( dev-libs/openssl:0= )
75 + libressl? ( dev-libs/libressl:= )
76 + )
77 + tk? (
78 + >=dev-lang/tcl-8.0:0=
79 + >=dev-lang/tk-8.0:0=
80 + dev-tcltk/blt:0=
81 + dev-tcltk/tix
82 + )
83 + xml? ( >=dev-libs/expat-2.1:0= )
84 + !!<sys-apps/sandbox-2.6-r1"
85 +DEPEND="${RDEPEND}
86 + test? ( app-arch/xz-utils[extra-filters(+)] )
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 +
112 + epatch_user
113 +
114 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
115 + configure.ac \
116 + Lib/distutils/command/install.py \
117 + Lib/distutils/sysconfig.py \
118 + Lib/site.py \
119 + Lib/sysconfig.py \
120 + Lib/test/test_site.py \
121 + Makefile.pre.in \
122 + Modules/getpath.c \
123 + Modules/Setup.dist \
124 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
125 +
126 + eautoreconf
127 +}
128 +
129 +src_configure() {
130 + local disable
131 + use gdbm || disable+=" gdbm"
132 + use ncurses || disable+=" _curses _curses_panel"
133 + use readline || disable+=" readline"
134 + use sqlite || disable+=" _sqlite3"
135 + use ssl || export PYTHON_DISABLE_SSL="1"
136 + use tk || disable+=" _tkinter"
137 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
138 + export PYTHON_DISABLE_MODULES="${disable}"
139 +
140 + if ! use xml; then
141 + ewarn "You have configured Python without XML support."
142 + ewarn "This is NOT a recommended configuration as you"
143 + ewarn "may face problems parsing any XML documents."
144 + fi
145 +
146 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
147 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
148 + fi
149 +
150 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
151 + append-flags -fwrapv
152 + fi
153 +
154 + filter-flags -malign-double
155 +
156 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
157 + if is-flagq -O3; then
158 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
159 + use hardened && replace-flags -O3 -O2
160 + fi
161 +
162 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
163 + tc-export CXX
164 +
165 + # The configure script fails to use pkg-config correctly.
166 + # http://bugs.python.org/issue15506
167 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
168 +
169 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
170 + # Needed on FreeBSD unless Python 3.2 is already installed.
171 + # Please query BSD team before removing this!
172 + append-ldflags "-L."
173 +
174 + local dbmliborder
175 + if use gdbm; then
176 + dbmliborder+="${dbmliborder:+:}gdbm"
177 + fi
178 +
179 + BUILD_DIR="${WORKDIR}/${CHOST}"
180 + mkdir -p "${BUILD_DIR}" || die
181 + cd "${BUILD_DIR}" || die
182 +
183 + local myeconfargs=(
184 + --with-fpectl
185 + --enable-shared
186 + $(use_enable ipv6)
187 + $(use_with threads)
188 + --infodir='${prefix}/share/info'
189 + --mandir='${prefix}/share/man'
190 + --with-computed-gotos
191 + --with-dbmliborder="${dbmliborder}"
192 + --with-libc=
193 + --enable-loadable-sqlite-extensions
194 + --without-ensurepip
195 + --with-system-expat
196 + --with-system-ffi
197 + )
198 +
199 + ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}"
200 +
201 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
202 + eerror "configure has detected that the sem_open function is broken."
203 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
204 + die "Broken sem_open function (bug 496328)"
205 + fi
206 +}
207 +
208 +src_compile() {
209 + # Ensure sed works as expected
210 + # https://bugs.gentoo.org/594768
211 + local -x LC_ALL=C
212 +
213 + cd "${BUILD_DIR}" || die
214 +
215 + emake CPPFLAGS= CFLAGS= LDFLAGS=
216 +
217 + # Work around bug 329499. See also bug 413751 and 457194.
218 + if has_version dev-libs/libffi[pax_kernel]; then
219 + pax-mark E python
220 + else
221 + pax-mark m python
222 + fi
223 +}
224 +
225 +src_test() {
226 + # Tests will not work when cross compiling.
227 + if tc-is-cross-compiler; then
228 + elog "Disabling tests due to crosscompiling."
229 + return
230 + fi
231 +
232 + cd "${BUILD_DIR}" || die
233 +
234 + # Skip failing tests.
235 + local skipped_tests="gdb"
236 +
237 + for test in ${skipped_tests}; do
238 + mv "${S}"/Lib/test/test_${test}.py "${T}"
239 + done
240 +
241 + local -x PYTHONDONTWRITEBYTECODE=
242 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
243 + local result=$?
244 +
245 + for test in ${skipped_tests}; do
246 + mv "${T}/test_${test}.py" "${S}"/Lib/test
247 + done
248 +
249 + elog "The following tests have been skipped:"
250 + for test in ${skipped_tests}; do
251 + elog "test_${test}.py"
252 + done
253 +
254 + elog "If you would like to run them, you may:"
255 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
256 + elog "and run the tests separately."
257 +
258 + if [[ ${result} -ne 0 ]]; then
259 + die "emake test failed"
260 + fi
261 +}
262 +
263 +src_install() {
264 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
265 +
266 + cd "${BUILD_DIR}" || die
267 +
268 + emake DESTDIR="${D}" altinstall
269 +
270 + sed \
271 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
272 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
273 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
274 +
275 + # Fix collisions between different slots of Python.
276 + rm -f "${ED}usr/$(get_libdir)/libpython3.so"
277 +
278 + # Cheap hack to get version with ABIFLAGS
279 + local abiver=$(cd "${ED}usr/include"; echo python*)
280 + if [[ ${abiver} != python${PYVER} ]]; then
281 + # Replace python3.X with a symlink to python3.Xm
282 + rm "${ED}usr/bin/python${PYVER}" || die
283 + dosym "${abiver}" "/usr/bin/python${PYVER}"
284 + # Create python3.X-config symlink
285 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
286 + # Create python-3.5m.pc symlink
287 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
288 + fi
289 +
290 + # python seems to get rebuilt in src_install (bug 569908)
291 + # Work around it for now.
292 + if has_version dev-libs/libffi[pax_kernel]; then
293 + pax-mark E "${ED}usr/bin/${abiver}"
294 + else
295 + pax-mark m "${ED}usr/bin/${abiver}"
296 + fi
297 +
298 + use elibc_uclibc && rm -fr "${libdir}/test"
299 + use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
300 + use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
301 +
302 + use threads || rm -fr "${libdir}/multiprocessing"
303 + use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
304 +
305 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
306 +
307 + if use examples; then
308 + insinto /usr/share/doc/${PF}/examples
309 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
310 + doins -r "${S}"/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}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
323 +
324 + # for python-exec
325 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
326 +
327 + # if not using a cross-compiler, use the fresh binary
328 + if ! tc-is-cross-compiler; then
329 + local -x PYTHON=./python
330 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
331 + else
332 + vars=( PYTHON "${vars[@]}" )
333 + fi
334 +
335 + python_export "python${PYVER}" "${vars[@]}"
336 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
337 + python_domodule epython.py
338 +
339 + # python-exec wrapping support
340 + local pymajor=${PYVER%.*}
341 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
342 + # python and pythonX
343 + ln -s "../../../bin/${abiver}" \
344 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
345 + ln -s "python${pymajor}" \
346 + "${D}${PYTHON_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 > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
351 + #!/bin/sh
352 + exec "${abiver}-config" "\${@}"
353 + EOF
354 + chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
355 + ln -s "python${pymajor}-config" \
356 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
357 + # 2to3, pydoc, pyvenv
358 + ln -s "../../../bin/2to3-${PYVER}" \
359 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
360 + ln -s "../../../bin/pydoc${PYVER}" \
361 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
362 + ln -s "../../../bin/pyvenv-${PYVER}" \
363 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
364 + # idle
365 + if use tk; then
366 + ln -s "../../../bin/idle${PYVER}" \
367 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
368 + fi
369 +}
370 +
371 +pkg_preinst() {
372 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
373 + python_updater_warning="1"
374 + fi
375 +}
376 +
377 +eselect_python_update() {
378 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
379 + eselect python update
380 + fi
381 +
382 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
383 + eselect python update --python${PV%%.*}
384 + fi
385 +}
386 +
387 +pkg_postinst() {
388 + eselect_python_update
389 +
390 + if [[ "${python_updater_warning}" == "1" ]]; then
391 + ewarn "You have just upgraded from an older version of Python."
392 + ewarn
393 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
394 + fi
395 +}
396 +
397 +pkg_postrm() {
398 + eselect_python_update
399 +}