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/, dev-lang/python/files/
Date: Sun, 01 Apr 2018 17:18:41
Message-Id: 1522603092.c380580255f99b84574ea57470ac217af9aaa35f.floppym@gentoo
1 commit: c380580255f99b84574ea57470ac217af9aaa35f
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 1 17:18:02 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=c3805802
7
8 dev-lang/python: bump to 3.6.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/files/3.6.5-disable-nis.patch | 11 +
14 dev-lang/python/python-3.6.5.ebuild | 346 ++++++++++++++++++++++++++
15 3 files changed, 358 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 4928ff20ac6..484ccefe0f4 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -6,6 +6,7 @@ DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cb
22 DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22
23 DIST Python-3.6.3.tar.xz 16974296 BLAKE2B 8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623 SHA512 32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b
24 DIST Python-3.6.4.tar.xz 16992824 BLAKE2B 2347a70bb25468221178b1542ddd4376f136a515f2873ee1f640c4629eb77a9608af0f6be37128ba3e8ad614ebc17e7be20b73384983533aa77bca4403ea7935 SHA512 09ba2103ac517ac4d262f00380c9aac836a53401ce252540c17fd821a3b92e1ddf32528d00772221eb3126b12cb95b62c3ac3e852f4951e6f2eb406c88c848a2
25 +DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
26 DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
27 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
28 DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06 SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
29
30 diff --git a/dev-lang/python/files/3.6.5-disable-nis.patch b/dev-lang/python/files/3.6.5-disable-nis.patch
31 new file mode 100644
32 index 00000000000..3937c6fe795
33 --- /dev/null
34 +++ b/dev-lang/python/files/3.6.5-disable-nis.patch
35 @@ -0,0 +1,11 @@
36 +--- a/setup.py
37 ++++ b/setup.py
38 +@@ -1364,7 +1364,7 @@ class PyBuildExt(build_ext):
39 + else:
40 + missing.extend(['resource', 'termios'])
41 +
42 +- nis = self._detect_nis(inc_dirs, lib_dirs)
43 ++ nis = None
44 + if nis is not None:
45 + exts.append(nis)
46 + else:
47
48 diff --git a/dev-lang/python/python-3.6.5.ebuild b/dev-lang/python/python-3.6.5.ebuild
49 new file mode 100644
50 index 00000000000..b3c248f7363
51 --- /dev/null
52 +++ b/dev-lang/python/python-3.6.5.ebuild
53 @@ -0,0 +1,346 @@
54 +# Copyright 1999-2018 Gentoo Foundation
55 +# Distributed under the terms of the GNU General Public License v2
56 +
57 +EAPI="6"
58 +WANT_LIBTOOL="none"
59 +
60 +inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs
61 +
62 +MY_P="Python-${PV}"
63 +PATCHSET_VERSION="3.6.4"
64 +
65 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
66 +HOMEPAGE="https://www.python.org/"
67 +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
68 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
69 +
70 +LICENSE="PSF-2"
71 +SLOT="3.6/3.6m"
72 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd"
73 +IUSE="build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test +threads tk wininst +xml"
74 +RESTRICT="!test? ( test )"
75 +
76 +# Do not add a dependency on dev-lang/python to this ebuild.
77 +# If you need to apply a patch which requires python for bootstrapping, please
78 +# run the bootstrap code on your dev box and include the results in the
79 +# patchset. See bug 447752.
80 +
81 +RDEPEND="app-arch/bzip2:0=
82 + app-arch/xz-utils:0=
83 + >=sys-libs/zlib-1.1.3:0=
84 + virtual/libffi
85 + virtual/libintl
86 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
87 + ncurses? (
88 + >=sys-libs/ncurses-5.2:0=
89 + readline? ( >=sys-libs/readline-4.1:0= )
90 + )
91 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
92 + ssl? (
93 + !libressl? ( dev-libs/openssl:0= )
94 + libressl? ( dev-libs/libressl:= )
95 + )
96 + tk? (
97 + >=dev-lang/tcl-8.0:0=
98 + >=dev-lang/tk-8.0:0=
99 + dev-tcltk/blt:0=
100 + dev-tcltk/tix
101 + )
102 + xml? ( >=dev-libs/expat-2.1:0= )
103 + !!<sys-apps/sandbox-2.6-r1"
104 +DEPEND="${RDEPEND}
105 + test? ( app-arch/xz-utils[extra-filters(+)] )
106 + virtual/pkgconfig
107 + !sys-devel/gcc[libffi(-)]"
108 +RDEPEND+=" !build? ( app-misc/mime-types )"
109 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
110 +
111 +S="${WORKDIR}/${MY_P}"
112 +PYVER=${SLOT%/*}
113 +
114 +src_prepare() {
115 + # Ensure that internal copies of expat, libffi and zlib are not used.
116 + rm -fr Modules/expat
117 + rm -fr Modules/_ctypes/libffi*
118 + rm -fr Modules/zlib
119 +
120 + local PATCHES=(
121 + "${WORKDIR}/patches"
122 + "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch"
123 + "${FILESDIR}/3.6.5-disable-nis.patch"
124 + )
125 +
126 + default
127 +
128 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
129 + Lib/distutils/command/install.py \
130 + Lib/distutils/sysconfig.py \
131 + Lib/site.py \
132 + Lib/sysconfig.py \
133 + Lib/test/test_site.py \
134 + Makefile.pre.in \
135 + Modules/Setup.dist \
136 + Modules/getpath.c \
137 + configure.ac \
138 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
139 +
140 + eautoreconf
141 +}
142 +
143 +src_configure() {
144 + local disable
145 + use gdbm || disable+=" gdbm"
146 + use ncurses || disable+=" _curses _curses_panel"
147 + use readline || disable+=" readline"
148 + use sqlite || disable+=" _sqlite3"
149 + use ssl || export PYTHON_DISABLE_SSL="1"
150 + use tk || disable+=" _tkinter"
151 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
152 + export PYTHON_DISABLE_MODULES="${disable}"
153 +
154 + if ! use xml; then
155 + ewarn "You have configured Python without XML support."
156 + ewarn "This is NOT a recommended configuration as you"
157 + ewarn "may face problems parsing any XML documents."
158 + fi
159 +
160 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
161 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
162 + fi
163 +
164 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
165 + append-flags -fwrapv
166 + fi
167 +
168 + filter-flags -malign-double
169 +
170 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
171 + if is-flagq -O3; then
172 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
173 + use hardened && replace-flags -O3 -O2
174 + fi
175 +
176 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
177 + tc-export CXX
178 +
179 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
180 + # Needed on FreeBSD unless Python 3.2 is already installed.
181 + # Please query BSD team before removing this!
182 + append-ldflags "-L."
183 +
184 + local dbmliborder
185 + if use gdbm; then
186 + dbmliborder+="${dbmliborder:+:}gdbm"
187 + fi
188 +
189 + local myeconfargs=(
190 + --with-fpectl
191 + --enable-shared
192 + $(use_enable ipv6)
193 + $(use_with threads)
194 + --infodir='${prefix}/share/info'
195 + --mandir='${prefix}/share/man'
196 + --with-computed-gotos
197 + --with-dbmliborder="${dbmliborder}"
198 + --with-libc=
199 + --enable-loadable-sqlite-extensions
200 + --without-ensurepip
201 + --with-system-expat
202 + --with-system-ffi
203 + )
204 +
205 + OPT="" econf "${myeconfargs[@]}"
206 +
207 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
208 + eerror "configure has detected that the sem_open function is broken."
209 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
210 + die "Broken sem_open function (bug 496328)"
211 + fi
212 +}
213 +
214 +src_compile() {
215 + # Ensure sed works as expected
216 + # https://bugs.gentoo.org/594768
217 + local -x LC_ALL=C
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 + # Skip failing tests.
237 + local skipped_tests="gdb"
238 +
239 + for test in ${skipped_tests}; do
240 + mv "${S}"/Lib/test/test_${test}.py "${T}"
241 + done
242 +
243 + local -x PYTHONDONTWRITEBYTECODE=
244 +
245 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
246 + local result=$?
247 +
248 + for test in ${skipped_tests}; do
249 + mv "${T}/test_${test}.py" "${S}"/Lib/test
250 + done
251 +
252 + elog "The following tests have been skipped:"
253 + for test in ${skipped_tests}; do
254 + elog "test_${test}.py"
255 + done
256 +
257 + elog "If you would like to run them, you may:"
258 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
259 + elog "and run the tests separately."
260 +
261 + if [[ ${result} -ne 0 ]]; then
262 + die "emake test failed"
263 + fi
264 +}
265 +
266 +src_install() {
267 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
268 +
269 + emake DESTDIR="${D}" altinstall
270 +
271 + sed \
272 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
273 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
274 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
275 +
276 + # Fix collisions between different slots of Python.
277 + rm -f "${ED}usr/$(get_libdir)/libpython3.so"
278 +
279 + # Cheap hack to get version with ABIFLAGS
280 + local abiver=$(cd "${ED}usr/include"; echo python*)
281 + if [[ ${abiver} != python${PYVER} ]]; then
282 + # Replace python3.X with a symlink to python3.Xm
283 + rm "${ED}usr/bin/python${PYVER}" || die
284 + dosym "${abiver}" "/usr/bin/python${PYVER}"
285 + # Create python3.X-config symlink
286 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
287 + # Create python-3.5m.pc symlink
288 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
289 + fi
290 +
291 + # python seems to get rebuilt in src_install (bug 569908)
292 + # Work around it for now.
293 + if has_version dev-libs/libffi[pax_kernel]; then
294 + pax-mark E "${ED}usr/bin/${abiver}"
295 + else
296 + pax-mark m "${ED}usr/bin/${abiver}"
297 + fi
298 +
299 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
300 + use tk || rm -r "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
301 +
302 + use threads || rm -r "${libdir}/multiprocessing" || die
303 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
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 +}