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