commit:     75ef481b8914d32e491659fd40eeb7d5605024fa
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May  3 10:39:17 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May  3 10:39:17 2018 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=75ef481b

dev-lang/python: sync/bump 3.4

Package-Manager: Portage-2.3.18-prefix, Repoman-2.3.6

 dev-lang/python/Manifest                           |   3 +
 dev-lang/python/files/3.4-getentropy-linux.patch   |  40 ++
 dev-lang/python/files/3.6-disable-nis.patch        |  21 +
 .../python/files/python-3.5.5-hash-unaligned.patch |  43 ++
 dev-lang/python/python-3.4.8-r1.ebuild             | 455 +++++++++++++++++++++
 5 files changed, 562 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index 274b181cfb..b4faac8990 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -2,13 +2,16 @@ DIST 7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 
BLAKE2B 85803bc1677bd1665
 DIST 8ee84829be03c2a1aa74f0f095c994c1f43f4688.zip 14239 BLAKE2B 
3dd91f83e5886cb9ba5c1fd9f3da38ab521db70645fa187752cd784919d523d9bf59b61223ea1a455b6d9002ba88dac5bd834c8e943b121db84e30bbb0f65204
 SHA512 
2f3ada7ff2bd97f90e3b972b681624ddf45c6d1db8d5e89f1313b4693db240a3c4e27c84bd2cf8ff71d5fb276b381ca6a3b8a6945f8db53ff3496cc4cc0b1d62
 DIST Python-2.7.14.tar.xz 12576112 BLAKE2B 
e03c4134cfdd88678acc26f383130a598ce4de908ab6bb9ee00e9235de3e0fcb9e653fec86f39db64fb895ef797d33736524655c5b94fab2cde2544b966b2cfb
 SHA512 
78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9
 DIST Python-3.4.5.tar.xz 14516820 BLAKE2B 
f9ddabd2df2241089d07756d3a8ba1c70096bee60d7cdef84041edbb20c488c3a573762441a4b7f543dbc0ce403ce84ff7d02e7d25699917bd014ab96deead85
 SHA512 
b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c
+DIST Python-3.4.8.tar.xz 14576444 BLAKE2B 
262b82fbc0e4852216d2edf05f9e9194bc93be7b14a2d6ef56789b808cff274e58b2fa7134955464fd05ab36181b5861aeca31e2e05b27f0f58ac66d145bd56b
 SHA512 
478552c72efe606cb1993024b81839c51d01f1c949564c007ab2b76016f110e1f7bd418e5de3f4f93b466ce7dbe6583d3c150830d1f28f75e0809625b568a7ec
 DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 
1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61
 SHA512 
dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
 DIST Python-3.6.3.tar.xz 16974296 BLAKE2B 
8220fc0c2eaa315d3972085b0f531f169adb6cfad57023ad2c115603b5a484573ea3540eb3216edd0f4514256c8edb07469cf38d17727d69cdc15cdf1f601623
 SHA512 
32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b
 DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 
0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad
 SHA512 
6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 BLAKE2B 
7fb3cc7dcd987debd5aa263d8e26b21aad439d8e3177c06c3683406a53bbda9652175673b09b6300f6a5b62148190cd8a75c9b65a5de04d770866733fcc0ebcb
 SHA512 
108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
+DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 
2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06
 SHA512 
41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
 DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 BLAKE2B 
4a7d71feff18c7c8c109bed10748348484d314183c3de3ec950d5ca5ce7048bb322c470f3f5bff2d63eb7f2ed99c0fe75c621df050273d9d118681b28926061d
 SHA512 
d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec
 DIST python-gentoo-patches-3.6.2-0.tar.xz 10744 BLAKE2B 
3075754627617ac2ceee879eaf1a0e6564505655cdbdff380233a09df701a6188d64fe1f6a8c642b1fb05ef3c460a07042b6a362d655cd02717d6d9ba47983a1
 SHA512 
2aac1700c541202aa4f43bff4cb521b996d52ab350133318abaddb43f4b6e20548f37de472ace8024ef325ebf63fdfff0d43f8aa1f717d3c56f974b7aa1764e3
 DIST python-prefix-2.7.14-gentoo-patches-r0.tar.xz 14736 BLAKE2B 
75422fc7390f559d9864f6e22a0b85982ccbdb07d5f2507db8e528285e56d1f11d4bc0b21a0b78d5340eafd562220d2f1b9d0a78b1f7c811c5689a426a81f9f3
 SHA512 
bf8e5039fff834d03a5a671269905f1ea10961995f2327ea023f6ad4d9b49bf210ec746ac6f45a01ff7501f1eb616013951d164410f6c64bce04df0e8b9715c8
 DIST python-prefix-3.4.5-gentoo-patches-r0.tar.xz 12932 BLAKE2B 
228cea390cd16f68579896ccec06025446d6378ee164090a7f8ab8174d28e73e35b0e311b95ab78be7a54b21eefce7c01238e3cb31fae1f49a1706476c5abda5
 SHA512 
e32556c63e48d8dacd86218945147d1bbbc5777a6bb3441373827da47771a8eb387f26885acd35343cc598c719c9feec63007144fc1fdd1aca253a2ec1a19825
+DIST python-prefix-3.4.8-gentoo-patches-r0.tar.xz 12928 BLAKE2B 
d270f27485a70b4186c0d509836f66e6ae8218270cbb0a473b4579de7a8d9fa16eb2387d0441979aa62fc88e54a52f863c58d91b3df64dd6a40ad4bc4236cbb2
 SHA512 
84554d2b320922d7ac6e20012f847a81d6501693a4d9f2146faa8764fca4fbc5e3bf1c0f352853f1ab34ed905ab13097f2e82285ada54c9b4e219e72b39804c2
 DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 BLAKE2B 
ab0cbc5430e9588f71cfd7b001a07f9a77097262f17e1f980e3945e39855e1c9437117bf4eb2d424dadf701d37d025e09627d7efdbb9f8867714039f62f261a7
 SHA512 
334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5
 DIST python-prefix-3.6.3-gentoo-patches-r0.tar.xz 12676 BLAKE2B 
5221ae00d16db401d5674947923451d850978d930d9449d9b4f6ae6d117c26971e2f384c5a698b7acc8d62e6a6b673f4ec870da3788f87372593a5ac4897a227
 SHA512 
9d1673bc7b327be6b7e95491940eeeaa40db9e94f2183f4605a9a5a7fd2e187017164e9b2ef31f3bc8d694e467de6843706d3341b4ce24d4d8717513c246b62f

diff --git a/dev-lang/python/files/3.4-getentropy-linux.patch 
b/dev-lang/python/files/3.4-getentropy-linux.patch
new file mode 100644
index 0000000000..9f12389bb2
--- /dev/null
+++ b/dev-lang/python/files/3.4-getentropy-linux.patch
@@ -0,0 +1,40 @@
+From 5635d44079e1bbd9c495951ede8d078e7b8d67d5 Mon Sep 17 00:00:00 2001
+From: Victor Stinner <[email protected]>
+Date: Mon, 9 Jan 2017 11:10:41 +0100
+Subject: [PATCH] Don't use getentropy() on Linux
+
+Issue #29188: Support glibc 2.24 on Linux: don't use getentropy() function but
+read from /dev/urandom to get random bytes, for example in os.urandom().  On
+Linux, getentropy() is implemented which getrandom() is blocking mode, whereas
+os.urandom() should not block.
+---
+ Python/random.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/Python/random.c b/Python/random.c
+index af3d0bd0d5..dc6400d3b8 100644
+--- a/Python/random.c
++++ b/Python/random.c
+@@ -67,9 +67,16 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int 
raise)
+     return 0;
+ }
+ 
+-/* Issue #25003: Don' use getentropy() on Solaris (available since
+- * Solaris 11.3), it is blocking whereas os.urandom() should not block. */
+-#elif defined(HAVE_GETENTROPY) && !defined(sun)
++/* Issue #25003: Don't use getentropy() on Solaris (available since
++   Solaris 11.3), it is blocking whereas os.urandom() should not block.
++
++   Issue #29188: Don't use getentropy() on Linux since the glibc 2.24
++   implements it with the getrandom() syscall which can fail with ENOSYS,
++   and this error is not supported in py_getentropy() and getrandom() is 
called
++   with flags=0 which blocks until system urandom is initialized, which is not
++   the desired behaviour to seed the Python hash secret nor for os.urandom():
++   see the PEP 524 which was only implemented in Python 3.6. */
++#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux)
+ #define PY_GETENTROPY 1
+ 
+ /* Fill buffer with size pseudo-random bytes generated by getentropy().
+-- 
+2.15.0.rc2
+

diff --git a/dev-lang/python/files/3.6-disable-nis.patch 
b/dev-lang/python/files/3.6-disable-nis.patch
new file mode 100644
index 0000000000..4e81847b50
--- /dev/null
+++ b/dev-lang/python/files/3.6-disable-nis.patch
@@ -0,0 +1,21 @@
+--- a/setup.py
++++ b/setup.py
+@@ -1332,17 +1332,7 @@ class PyBuildExt(build_ext):
+             # Jeremy Hylton's rlimit interface
+             exts.append( Extension('resource', ['resource.c']) )
+ 
+-            # Sun yellow pages. Some systems have the functions in libc.
+-            if (host_platform not in ['cygwin', 'qnx6'] and
+-                find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
+-                if (self.compiler.find_library_file(lib_dirs, 'nsl')):
+-                    libs = ['nsl']
+-                else:
+-                    libs = []
+-                exts.append( Extension('nis', ['nismodule.c'],
+-                                       libraries = libs) )
+-            else:
+-                missing.append('nis')
++            missing.append('nis')
+         else:
+             missing.extend(['nis', 'resource', 'termios'])
+ 

diff --git a/dev-lang/python/files/python-3.5.5-hash-unaligned.patch 
b/dev-lang/python/files/python-3.5.5-hash-unaligned.patch
new file mode 100644
index 0000000000..c418f40b7d
--- /dev/null
+++ b/dev-lang/python/files/python-3.5.5-hash-unaligned.patch
@@ -0,0 +1,43 @@
+The hash implementation casts the input pointer to uint64_t* and directly reads
+from this, which may cause unaligned accesses. Use memcpy() instead so this 
code
+will not crash with SIGBUS on sparc.
+
+--- a/Python/pyhash.c  2017-11-29 10:21:20.283094068 +0100
++++ b/Python/pyhash.c  2017-11-29 10:24:26.733087813 +0100
+@@ -372,7 +372,7 @@ siphash24(const void *src, Py_ssize_t sr
+     PY_UINT64_T k0 = _le64toh(_Py_HashSecret.siphash.k0);
+     PY_UINT64_T k1 = _le64toh(_Py_HashSecret.siphash.k1);
+     PY_UINT64_T b = (PY_UINT64_T)src_sz << 56;
+-    const PY_UINT64_T *in = (PY_UINT64_T*)src;
++    const PY_UINT8_T *in = (PY_UINT8_T*)src;
+ 
+     PY_UINT64_T v0 = k0 ^ 0x736f6d6570736575ULL;
+     PY_UINT64_T v1 = k1 ^ 0x646f72616e646f6dULL;
+@@ -381,12 +381,14 @@ siphash24(const void *src, Py_ssize_t sr
+ 
+     PY_UINT64_T t;
+     PY_UINT8_T *pt;
+-    PY_UINT8_T *m;
++    const PY_UINT8_T *m;
+ 
+     while (src_sz >= 8) {
+-        PY_UINT64_T mi = _le64toh(*in);
+-        in += 1;
+-        src_sz -= 8;
++        PY_UINT64_T mi;
++        memcpy(&mi, in, sizeof(mi));
++        mi = _le64toh(mi);
++        in += sizeof(mi);
++        src_sz -= sizeof(mi);
+         v3 ^= mi;
+         DOUBLE_ROUND(v0,v1,v2,v3);
+         v0 ^= mi;
+@@ -394,7 +396,7 @@ siphash24(const void *src, Py_ssize_t sr
+ 
+     t = 0;
+     pt = (PY_UINT8_T *)&t;
+-    m = (PY_UINT8_T *)in;
++    m = in;
+     switch (src_sz) {
+         case 7: pt[6] = m[6];
+         case 6: pt[5] = m[5];

diff --git a/dev-lang/python/python-3.4.8-r1.ebuild 
b/dev-lang/python/python-3.4.8-r1.ebuild
new file mode 100644
index 0000000000..1a724e53a4
--- /dev/null
+++ b/dev-lang/python/python-3.4.8-r1.ebuild
@@ -0,0 +1,455 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+WANT_LIBTOOL="none"
+
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 
toolchain-funcs multiprocessing
+
+MY_P="Python-${PV/_/}"
+PATCHSET_VERSION="3.4.6-0"
+PREFIX_PATCHREV="r0"
+CYGWINPORTS_GITREV="8ee84829be03c2a1aa74f0f095c994c1f43f4688"
+
+DESCRIPTION="An interpreted, interactive, object-oriented programming language"
+HOMEPAGE="https://www.python.org/";
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
+       
https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
+       
https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz";
+
+[[ -n ${CYGWINPORTS_GITREV} ]] &&
+SRC_URI+=" elibc_Cygwin? ( 
https://github.com/cygwinports/python3/archive/${CYGWINPORTS_GITREV}.zip )"
+
+LICENSE="PSF-2"
+SLOT="3.4/3.4m"
+KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos 
~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="aqua bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl 
+ncurses +readline sqlite +ssl +threads tk wininst +xml"
+
+# Do not add a dependency on dev-lang/python to this ebuild.
+# If you need to apply a patch which requires python for bootstrapping, please
+# run the bootstrap code on your dev box and include the results in the
+# patchset. See bug 447752.
+
+RDEPEND="app-arch/bzip2:0=
+       app-arch/xz-utils:0=
+       >=sys-libs/zlib-1.1.3:0=
+       virtual/libffi
+       virtual/libintl
+       gdbm? ( sys-libs/gdbm:0=[berkdb] )
+       ncurses? (
+               >=sys-libs/ncurses-5.2:0=
+               readline? ( >=sys-libs/readline-4.1:0= )
+       )
+       sqlite? ( >=dev-db/sqlite-3.3.8:3= )
+       ssl? (
+               !libressl? ( dev-libs/openssl:0= )
+               libressl? ( dev-libs/libressl:= )
+       )
+       tk? (
+               >=dev-lang/tcl-8.0:0=
+               >=dev-lang/tk-8.0:0=[-aqua]
+               dev-tcltk/blt:0=
+               dev-tcltk/tix
+       )
+       xml? ( >=dev-libs/expat-2.1:0= )
+       !!<sys-apps/sandbox-2.6-r1"
+# bluetooth requires headers from bluez
+DEPEND="${RDEPEND}
+       bluetooth? ( net-wireless/bluez )
+       virtual/pkgconfig
+       >=sys-devel/autoconf-2.65
+       !sys-devel/gcc[libffi(-)]"
+RDEPEND+=" !build? ( app-misc/mime-types )"
+PDEPEND=">=app-eselect/eselect-python-20140125-r1"
+
+[[ -n ${CYGWINPORTS_GITREV} ]] &&
+DEPEND+=" elibc_Cygwin? ( app-arch/unzip )"
+
+S="${WORKDIR}/${MY_P}"
+
+PYVER=${SLOT%/*}
+
+src_prepare() {
+       # Ensure that internal copies of expat, libffi and zlib are not used.
+       rm -fr Modules/expat
+       rm -fr Modules/_ctypes/libffi*
+       rm -fr Modules/zlib
+
+       if tc-is-cross-compiler; then
+               # Invokes BUILDPYTHON, which is built for the host arch
+               local 
EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
+       fi
+
+       EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
+       epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch"
+       epatch "${FILESDIR}/${PN}-3.4.5-cross.patch"
+       epatch "${FILESDIR}/3.4-getentropy-linux.patch"
+       epatch "${FILESDIR}/3.6-disable-nis.patch"
+       epatch "${FILESDIR}/python-3.5.5-hash-unaligned.patch"
+
+       # Prefix' round of patches
+       EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
+               epatch 
"${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
+
+       # https://forums.developer.apple.com/thread/9233, bug #572726
+       sed -i -e '/$(RUNSHARED) .\/regen/s/^/export RUNSHARED=$(RUNSHARED); /' 
\
+               Makefile.pre.in || die
+       sed -i -e '/python$EXE/s/^/env ${RUNSHARED} /' \
+               Lib/plat-darwin/regen || die
+
+       # we provide a fully working readline also on Darwin, so don't force
+       # usage of less functional libedit
+       sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || 
die
+
+       # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
+       sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
+
+       # Make sure python doesn't use the host libffi.
+       use prefix && epatch "${FILESDIR}/python-3.2-libffi-pkgconfig.patch"
+
+       if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
+           local p d="${WORKDIR}/python3-${CYGWINPORTS_GITREV}"
+           for p in $(
+                   eval "$(sed -ne '/PATCH_URI="/,/"/p' < 
"${d}"/python3.cygport)"
+                   echo ${PATCH_URI}
+           ); do
+                       # dropped by 01_all_prefix-no-patch-invention.patch
+                       [[ ${p} == *-tkinter-* ]] && continue
+                   epatch "${d}/${p}"
+           done
+       fi
+
+       epatch_user
+
+       sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
+               configure.ac \
+               Lib/distutils/command/install.py \
+               Lib/distutils/sysconfig.py \
+               Lib/site.py \
+               Lib/sysconfig.py \
+               Lib/test/test_site.py \
+               Makefile.pre.in \
+               Modules/Setup.dist \
+               Modules/getpath.c \
+               setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
+
+       # workaround a development build env problem and muck around
+       # framework install to get the best of both worlds (non-standard)
+       sed -i \
+               -e 
"s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
+               -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
+               configure.ac configure || die
+       sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
+
+       # Disable ABI flags.
+       sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed 
failed"
+
+       eautoreconf
+}
+
+src_configure() {
+       local disable
+       # disable automagic bluetooth headers detection
+       use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
+       use gdbm     || disable+=" gdbm"
+       use ncurses  || disable+=" _curses _curses_panel"
+       use readline || disable+=" readline"
+       use sqlite   || disable+=" _sqlite3"
+       use ssl      || export PYTHON_DISABLE_SSL="1"
+       use tk       || disable+=" _tkinter"
+       use xml      || disable+=" _elementtree pyexpat" # _elementtree uses 
pyexpat.
+       export PYTHON_DISABLE_MODULES="${disable}"
+
+       if ! use xml; then
+               ewarn "You have configured Python without XML support."
+               ewarn "This is NOT a recommended configuration as you"
+               ewarn "may face problems parsing any XML documents."
+       fi
+
+       if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
+               einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
+       fi
+
+       if [[ "$(gcc-major-version)" -ge 4 ]]; then
+               append-flags -fwrapv
+       fi
+
+       filter-flags -malign-double
+
+       # https://bugs.gentoo.org/show_bug.cgi?id=50309
+       if is-flagq -O3; then
+               is-flagq -fstack-protector-all && replace-flags -O3 -O2
+               use hardened && replace-flags -O3 -O2
+       fi
+
+       # Export CC so even AIX will use gcc instead of xlc_r.
+       # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
+       tc-export CC CXX
+
+       # The configure script fails to use pkg-config correctly.
+       # http://bugs.python.org/issue15506
+       export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
+
+       # Set LDFLAGS so we link modules with -lpython3.2 correctly.
+       # Needed on FreeBSD unless Python 3.2 is already installed.
+       # Please query BSD team before removing this!
+       append-ldflags "-L."
+
+       # make sure setup.py considers Prefix' paths before system ones
+       use prefix && append-cppflags -I"${EPREFIX}"/usr/include
+       use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib
+
+       local dbmliborder
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+
+       BUILD_DIR="${WORKDIR}/${CHOST}"
+       mkdir -p "${BUILD_DIR}" || die
+       cd "${BUILD_DIR}" || die
+
+       if use aqua ; then
+               ECONF_SOURCE="${S}" OPT="" \
+               econf \
+                       --enable-framework="${EPREFIX}"/usr/lib \
+                       --config-cache
+       fi
+
+       # pymalloc #452720
+       ECONF_SOURCE="${S}" OPT="" \
+       econf \
+               $(use aqua && echo --config-cache) \
+               --with-fpectl \
+               --enable-shared \
+               $(use_enable ipv6) \
+               $(use_with threads) \
+               --infodir='${prefix}/share/info' \
+               --mandir='${prefix}/share/man' \
+               --with-computed-gotos \
+               --with-dbmliborder="${dbmliborder}" \
+               --with-libc="" \
+               --enable-loadable-sqlite-extensions \
+               --with-system-expat \
+               --with-system-ffi \
+               --without-ensurepip \
+               --without-pymalloc
+
+       if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" 
pyconfig.h; then
+               eerror "configure has detected that the sem_open function is 
broken."
+               eerror "Please ensure that /dev/shm is mounted as a tmpfs with 
mode 1777."
+               die "Broken sem_open function (bug 496328)"
+       fi
+}
+
+src_compile() {
+       # Ensure sed works as expected
+       # https://bugs.gentoo.org/594768
+       local -x LC_ALL=C
+
+       # Avoid invoking pgen for cross-compiles.
+       touch Include/graminit.h Python/graminit.c || die
+
+       cd "${BUILD_DIR}" || die
+
+       emake CPPFLAGS= CFLAGS= LDFLAGS=
+
+       # Work around bug 329499. See also bug 413751 and 457194.
+       if has_version dev-libs/libffi[pax_kernel]; then
+               pax-mark E python
+       else
+               pax-mark m python
+       fi
+}
+
+src_test() {
+       # Tests will not work when cross compiling.
+       if tc-is-cross-compiler; then
+               elog "Disabling tests due to crosscompiling."
+               return
+       fi
+
+       cd "${BUILD_DIR}" || die
+
+       # Skip failing tests.
+       local skipped_tests="gdb"
+
+       for test in ${skipped_tests}; do
+               mv "${S}"/Lib/test/test_${test}.py "${T}"
+       done
+
+       local -x PYTHONDONTWRITEBYTECODE=
+       emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < 
/dev/tty
+       local result=$?
+
+       for test in ${skipped_tests}; do
+               mv "${T}/test_${test}.py" "${S}"/Lib/test
+       done
+
+       elog "The following tests have been skipped:"
+       for test in ${skipped_tests}; do
+               elog "test_${test}.py"
+       done
+
+       elog "If you would like to run them, you may:"
+       elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
+       elog "and run the tests separately."
+
+       if [[ ${result} -ne 0 ]]; then
+               die "emake test failed"
+       fi
+}
+
+src_install() {
+       local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
+
+       cd "${BUILD_DIR}" || die
+
+       emake DESTDIR="${D}" altinstall
+
+       if use aqua ; then
+               # avoid config.status to be triggered
+               find Mac -name "Makefile" -exec touch \{\} + || die
+
+               # Python_Launcher is kind of a wrapper, and we should fix it for
+               # Prefix (it uses /usr/bin/pythonw) so useless
+               # IDLE doesn't run, no idea, but definitely not used
+               emake DESTDIR="${D}" -C Mac install_Python || die
+               rmdir "${ED}"/Applications/Python* || die
+               rmdir "${ED}"/Applications || die
+
+               local 
fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER}
+               ln -s "${EPREFIX}"/usr/include/python${PYVER} \
+                       "${ED}${fwdir}"/Headers || die
+               ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \
+                       "${ED}${fwdir}"/Python || die
+       fi
+
+       sed \
+               -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
+               -e "s/\(PY_LDFLAGS=\).*/\1/" \
+               -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
+
+       # Fix collisions between different slots of Python.
+       rm -f "${ED}usr/$(get_libdir)/libpython3.so"
+
+       # Cheap hack to get version with ABIFLAGS
+       local abiver=$(cd "${ED}usr/include"; echo python*)
+       if [[ ${abiver} != python${PYVER} ]]; then
+               # Replace python3.X with a symlink to python3.Xm
+               rm "${ED}usr/bin/python${PYVER}" || die
+               dosym "${abiver}" "/usr/bin/python${PYVER}"
+               # Create python3.X-config symlink
+               dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
+               # Create python-3.5m.pc symlink
+               dosym "python-${PYVER}.pc" 
"/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
+       fi
+
+       use elibc_uclibc && rm -fr "${libdir}/test"
+       use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
+       use tk || rm -fr "${ED}usr/bin/idle${PYVER}" 
"${libdir}/"{idlelib,tkinter,test/test_tk*}
+
+       use threads || rm -fr "${libdir}/multiprocessing"
+       use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
+
+       dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
+
+       if use examples; then
+               insinto /usr/share/doc/${PF}/examples
+               find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
+               doins -r "${S}"/Tools
+       fi
+       insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
+       if use aqua ; then
+               # we do framework, so the emake trick below returns a pathname
+               # since that won't work here, use a (cheap) trick instead
+               local libname=libpython${PYVER}
+       else
+               local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude 
Makefile\n' | \
+                       emake --no-print-directory -s -f - 2>/dev/null)
+       fi
+       newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
+
+       newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
+       newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
+       sed \
+               -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
+               -e "s:@PYDOC@:pydoc${PYVER}:" \
+               -i "${ED}etc/conf.d/pydoc-${PYVER}" 
"${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
+
+       # for python-exec
+       local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
+
+       # if not using a cross-compiler, use the fresh binary
+       if ! tc-is-cross-compiler; then
+               local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' 
Makefile)
+               local -x 
LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
+               local -x 
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD}
+       else
+               vars=( PYTHON "${vars[@]}" )
+       fi
+
+       python_export "python${PYVER}" "${vars[@]}"
+       echo "EPYTHON='${EPYTHON}'" > epython.py || die
+       python_domodule epython.py
+
+       # python-exec wrapping support
+       local pymajor=${PYVER%.*}
+       mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
+       # python and pythonX
+       ln -s "../../../bin/${abiver}" \
+               "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
+       ln -s "python${pymajor}" \
+               "${D}${PYTHON_SCRIPTDIR}/python" || die
+       # python-config and pythonX-config
+       # note: we need to create a wrapper rather than symlinking it due
+       # to some random dirname(argv[0]) magic performed by python-config
+       cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
+               #!/bin/sh
+               exec "${abiver}-config" "\${@}"
+       EOF
+       chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
+       ln -s "python${pymajor}-config" \
+               "${D}${PYTHON_SCRIPTDIR}/python-config" || die
+       # 2to3, pydoc, pyvenv
+       ln -s "../../../bin/2to3-${PYVER}" \
+               "${D}${PYTHON_SCRIPTDIR}/2to3" || die
+       ln -s "../../../bin/pydoc${PYVER}" \
+               "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
+       ln -s "../../../bin/pyvenv-${PYVER}" \
+               "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
+       # idle
+       if use tk; then
+               ln -s "../../../bin/idle${PYVER}" \
+                       "${D}${PYTHON_SCRIPTDIR}/idle" || die
+       fi
+}
+
+pkg_preinst() {
+       if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version 
">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
+               python_updater_warning="1"
+       fi
+}
+
+eselect_python_update() {
+       if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect 
python show)" ]]; then
+               eselect python update
+       fi
+
+       if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f 
"${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
+               eselect python update --python${PV%%.*}
+       fi
+}
+
+pkg_postinst() {
+       eselect_python_update
+
+       if [[ "${python_updater_warning}" == "1" ]]; then
+               ewarn "You have just upgraded from an older version of Python."
+               ewarn
+               ewarn "Please adjust PYTHON_TARGETS (if so desired), and run 
emerge with the --newuse or --changed-use option to rebuild packages installing 
python modules."
+       fi
+}
+
+pkg_postrm() {
+       eselect_python_update
+}

Reply via email to