commit:     e158fb2e33d8109c371faa0eecc2c936f2aee16a
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 29 16:59:43 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Oct 29 16:59:43 2017 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e158fb2e

dev-lang/python: version bump to 3.5.4

Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4

 dev-lang/python/Manifest                           |   3 +
 .../files/python-3.5.4-libffi-pkgconfig.patch      |  44 +++
 dev-lang/python/python-3.5.4.ebuild                | 436 +++++++++++++++++++++
 3 files changed, 483 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index 9796e4495c..d8a1cbde99 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -6,15 +6,18 @@ DIST Python-3.4.3.tar.xz 14421964 SHA256 
b5b3963533768d5fc325a4d7a6bd6f666726002
 DIST Python-3.4.5.tar.xz 14516820 SHA256 
ee64b1c8a47461009abf25252332d29a4e587cb4f0c1c96aa793a3732e9d898a SHA512 
b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c
 WHIRLPOOL 
43e0aed0177d46148964447b4fb24475c4c736afb2ba84ec393fbf55db3da3f192308f9c8f236deaa7a608dac56946ee7755970fadaa82bf406c910a05f36883
 DIST Python-3.5.1.tar.xz 14830408 SHA256 
c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9 SHA512 
261c9e42ae351853c718707a8887817e308b3ba7a37e9463a0bc8f50ee9be9ac1a011b2891f8877ecdb40beab99279bcfa8e04f813b8998fcf6cefb7fd52d850
 WHIRLPOOL 
7ff4ddb852c74f75d1f327e418f5af09ae66403cc3fb2431ab31786c046cec2d761ee57e8c6674a92bb08f95cfff7c7c7d5ddd965994096a0380fbd6b55fcc8f
 DIST Python-3.5.2.tar.xz 15222676 SHA256 
0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40 SHA512 
c07c3366f1c81e214241444bb9da6db9d11da32ad66bfa29cdad5a3b2e34e4d870bda6d4ce3c3910b582942e91f1d8c8a1c1a7b9464cc147b83c9e0007012742
 WHIRLPOOL 
cf55d67f362b6a7529d43bb5aa8014c8349be190c6d4dae9d48de1679ab8623087478f41686cdced981cf18bb3d107052732cd437ff31ba5de2cc06b04ec2289
+DIST Python-3.5.4.tar.xz 15332320 SHA256 
94d93bfabb3b109f8a10365a325f920f9ec98c6e2380bf228f9700a14054c84c SHA512 
dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
 WHIRLPOOL 
63bca2b7b6f5da024c30f84d7e4152a37232e3b277fc5ec58ede9a1da57a44e31bb5f2e5ee33874328526f8d7fdd05dc12df5c69fb827394d5b57907671d3dd3
 DIST python-gentoo-patches-2.7.11-0.tar.xz 12916 SHA256 
e14b47bb1fd64d366d7dfb8339cc2cbf4a53fc288b11dd83f575eb36a8a6408d SHA512 
f0447bb699a163afc08df39b111394377539935546ae23732d7239e78d2bff0c04bc94949f86aef0c1be83736127dbd25c2c531e49befed2d638c3cd4940ac52
 WHIRLPOOL 
305992849d9d244da1e308e739c9bf62a3ef5c74eb65c765bdc666fb5767eb16c7a609f7c442c17da17f76c3ab81e4b09fa8c21e43f89366539a6a9d656bea77
 DIST python-gentoo-patches-2.7.12-0.tar.xz 13576 SHA256 
cd842eec7202df57c153adc1fbb81e70b26ef651f8e9346e065d8577b93f343b SHA512 
8bf530fca15c47fa5d9bc958e433b35943a12c98e4172806a45aa60dc85ec92f8ab6ffcd90f752dc5bf8ffc711414894c15820c4b6ef72dbcedc2808119fb1f6
 WHIRLPOOL 
54b8ca6a4371d460dadccfdffcc096c12930d58714eef95117a658d7a1337ea89c45c69553b5b993017211faaa0f8d670e09a8452e53c0fb176be3e908524ee6
 DIST python-gentoo-patches-3.4.3-0.tar.xz 11736 SHA256 
917a9d98d40a91379c81ea57922a8632ba3c6f6db6f304ed6262bc88c5044946 SHA512 
7ad1b30cf8bb7900fe518ed71e4ee55dd92ce7e23ae583a1f2f851b26cfa8c4f4271d28f418e780f3725a48d4ca8eeb8fd083f850810c66c29fb08c430828d72
 WHIRLPOOL 
074e8c0055b49a028eebda21d1acfb8a25ec968eb8b350c2bed37e042f9f354871e413db13e0ef2fe41d7e56d647178a7b3622019f36c4819c2c68f088366eb1
 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 SHA256 
84ee7630670a1dac4bbbc55fabf5f99b5b29007de4f140ad956e93d2e7aba8fa SHA512 
108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8
 WHIRLPOOL 
f0248faa0b4ce5679e37381bba90f8a4d361a49db792787bffc06a54a4bc82fea4d53255120f10e6dbf51b99e12417fc1b469be9624e73508fa3a212a38e7352
 DIST python-gentoo-patches-3.5.1-0.tar.xz 11788 SHA256 
668fabdb9326ba3df81dd299619d5245b7806934e9341ef89a06f90c9a98018b SHA512 
3948af801e3e70b55b15165d6cc56fb33cdb9fcc9d80b913550c8609273bad28db0c10ec64cb14d010b80020716a1e45d720e08864f6ac850291cb1713800a1a
 WHIRLPOOL 
2fd3b25186c26412dc642f76228d8e75f24cdc7452407dd105f027be5841b1b865f6b5b74a0072a0299153e5d5af699542253b366e4eb78dfbf114ad02b14bcc
 DIST python-gentoo-patches-3.5.2-0.tar.xz 12008 SHA256 
eb898fb448bd40f086ae2910e94c608faa932eb377fe40bd34f4390b4c37aac1 SHA512 
e2ef1b8f10f9ea849bf52a0be65d48f7cfecf07bdf151cbbd7e3a1c9428a8d96e901650496c4ae7fd0093af8cc90de8df674dc1a4c66ad21916a4ee45a81efc8
 WHIRLPOOL 
66b99c7c50e3eaca783f773349b3e8a357f706a7da6a66bd2e0a53946bc81d965ac99d8fd4c50ba7e42052aa84508c8aede5eacedbb95f040a48cf1a5de6b6b0
+DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 SHA256 
30c9dbcd5c11ed025b9d8dd201da84c5b9f9756f9b6ba77ccaebc6b79a91e320 SHA512 
d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec
 WHIRLPOOL 
2191dc89805c1bc11d125005a5c5dd0e5fe635eb0a3d6698bef8b55f54741edc3b3e2588bb21f5eda517963489c15296cd5fd265c8a548d78be6093698e6b002
 DIST python-prefix-2.7.11-gentoo-patches-r1.tar.xz 17268 SHA256 
ecebc430e475030fdbfcd940f314f80ebcb8c6e01a6b2498478bb8f37e525484 SHA512 
22218128ff83856dd042ecd6aab3615282ab29c4420e6cce4a0bba8b6508e3f5649c27cdf50cf342fffd3c87ea29f8b7d32d28b9b1f4dc200771b52ee41f27e5
 WHIRLPOOL 
2a942b39e56955df5b24f50d68a39ca78152e10f13ccc856340cd4651eb87847097ec3ff79efde81c2130b12f2885764194fb8d51c05278f4acc550bcd4ba032
 DIST python-prefix-2.7.12-gentoo-patches-r0.tar.xz 17380 SHA256 
c488011046a678eaf2febe3d02726a0efbd2f8378a0c5b896b03bcbed5b5f00a SHA512 
ef17c8e8083da0ed0e6a63c96f59cc1243b0376fc6d4d7fcecb165e557403c54ae87625ed6dfe4d7d73693f8220ec98ef8a3f16124d8022dbac6a3a9d5514d9c
 WHIRLPOOL 
7e427be36a8d558193058d7112f704993474eff7bb554b6f2f0d9cfe085c653a9cf0522a33249a92e813fad667a53439c9f70d74bcde0df9f78824bfbbfaae46
 DIST python-prefix-3.4.3-gentoo-patches-r1.tar.xz 12896 SHA256 
39da669913d8627a74e6d9a7e1ee6eae3e184d7525097090d4b05a71b0a79100 SHA512 
dd1082ef9605fdcb84bcc769318be6934c889a5b6134971fb121b3be8301cb9519fb687841a359c65e0614d05a8c27eab4b3dbfe94ed8dbbf2fc64f82206a6d9
 WHIRLPOOL 
884f0e9e5e177543c74f3c3e87629113db6c53c556f55bf7310de79f101fa825472d886eea216cea471e981dc4fd6743622e1c7472b5ffe04eda4c6790d73c62
 DIST python-prefix-3.4.5-gentoo-patches-r0.tar.xz 12932 SHA256 
ab0b1f138c8bd22b2be862923e219d68513d98e77d32260b9625d19be08b1bf3 SHA512 
e32556c63e48d8dacd86218945147d1bbbc5777a6bb3441373827da47771a8eb387f26885acd35343cc598c719c9feec63007144fc1fdd1aca253a2ec1a19825
 WHIRLPOOL 
fda061e683462252bf777ea43d84958fb07ca0144be3f87cc42e4e2baa4f69cb0ed3075b55445398f88c514d28c8c310c6b5b312883a4949c8745161aaf3d786
 DIST python-prefix-3.5.1-gentoo-patches-r2.tar.xz 12680 SHA256 
73b1166eded9867b473c90171b613d32bbe8f72e523c74b1563a9c25c555e13b SHA512 
82b08b8cf7f3620c4c2a6a6c3ed5ec8c3318c6f43e4bcc4950c7aeb56ec755e0e47d46f068843f5b04159583994c8620dab14827278a199789a3867532cc6e0c
 WHIRLPOOL 
ac4ea106ca744d6e154e14a53ae2e8eeb119207069ead95d0ef19657a58e1d31ed1933de6315ab61ce532c11d1ae4a999c73d34121028a0a246b7dd2b1ac857a
 DIST python-prefix-3.5.2-gentoo-patches-r0.tar.xz 12652 SHA256 
2a1288ef4b50c0dd679e29912cff93cfd168f9d843dc3090751460968cf40d7c SHA512 
e214583393aaf6ec603495531fd2c8d3c668c1fc72c4e3226a4daa537ad34e763302d7110b9ca8a58eb77955aad22371f6cf13247c6d06350f56989301faae8b
 WHIRLPOOL 
4fb513181557fe3be4cf3a3fe12cac5b99bfc7365c37df28a8b30e05a2b58ec74d9b2e8e6c9a7ecfca643c3ab477d2b65b27e4a33f929f28f9749611d913b04a
+DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 SHA256 
cb62db1caaa01aeab6a9e5264d2873eff1c194f9d6fb8e6e1bce0e515a8611ad SHA512 
334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5
 WHIRLPOOL 
295187be131a3f89597e68072687bf1f1140757798230cc76cedb964fe810642b4b4c81d190d92fd40927542d8024c9d7ad877224d2c0ab8702d2435b3fd5b6e

diff --git a/dev-lang/python/files/python-3.5.4-libffi-pkgconfig.patch 
b/dev-lang/python/files/python-3.5.4-libffi-pkgconfig.patch
new file mode 100644
index 0000000000..0edd83b6ae
--- /dev/null
+++ b/dev-lang/python/files/python-3.5.4-libffi-pkgconfig.patch
@@ -0,0 +1,44 @@
+diff -u -r Python-3.3.3-orig//configure.ac Python-3.3.3/configure.ac
+--- Python-3.3.3-orig//configure.ac    2014-03-06 05:25:46.000000000 +0100
++++ Python-3.3.3/configure.ac  2014-03-06 05:26:27.000000000 +0100
+@@ -2247,10 +2247,13 @@
+ 
+ if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
+     LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | 
sed -e 's/^-I//;s/ *$//'`"
++    LIBFFI_LIB="`"$PKG_CONFIG" libffi --libs-only-l 2>/dev/null | sed -e 
's/^-l//;s/ *$//'`"
+ else
+     LIBFFI_INCLUDEDIR=""
++    LIBFFI_LIB=""
+ fi
+ AC_SUBST(LIBFFI_INCLUDEDIR)
++AC_SUBST(LIBFFI_LIB)
+ 
+ AC_MSG_RESULT($with_system_ffi)
+ 
+diff -u -r Python-3.3.3-orig//Makefile.pre.in Python-3.3.3/Makefile.pre.in
+--- Python-3.3.3-orig//Makefile.pre.in 2014-03-06 05:25:46.000000000 +0100
++++ Python-3.3.3/Makefile.pre.in       2014-03-06 05:26:42.000000000 +0100
+@@ -252,6 +252,7 @@
+ 
+ 
+ LIBFFI_INCLUDEDIR=    @LIBFFI_INCLUDEDIR@
++LIBFFI_LIB=   @LIBFFI_LIB@
+ 
+ ##########################################################################
+ # Parser
+diff -u -r Python-3.3.3-orig//setup.py Python-3.3.3/setup.py
+--- Python-3.3.3-orig//setup.py        2014-03-06 05:25:46.000000000 +0100
++++ Python-3.3.3/setup.py      2014-03-06 05:27:05.000000000 +0100
+@@ -1763,8 +1763,10 @@
+                     ffi_inc = None
+                     print('Header file {} does not define LIBFFI_H or '
+                           'ffi_wrapper_h'.format(ffi_h))
+-        ffi_lib = None
+-        if ffi_inc is not None:
++        ffi_lib = sysconfig.get_config_var("LIBFFI_LIB")
++        if not ffi_lib or ffi_lib == '':
++            ffi_lib = None
++        if ffi_inc is not None and ffi_lib is None:
+             for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
+                 if (self.compiler.find_library_file(lib_dirs, lib_name)):
+                     ffi_lib = lib_name

diff --git a/dev-lang/python/python-3.5.4.ebuild 
b/dev-lang/python/python-3.5.4.ebuild
new file mode 100644
index 0000000000..37d3bc1086
--- /dev/null
+++ b/dev-lang/python/python-3.5.4.ebuild
@@ -0,0 +1,436 @@
+# Copyright 1999-2017 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
+
+MY_P="Python-${PV/_/}"
+PATCHSET_VERSION="3.5.4-0"
+PREFIX_PATCHREV="r0"
+
+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";
+
+LICENSE="PSF-2"
+SLOT="3.5/3.5m"
+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 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"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       !sys-devel/gcc[libffi(-)]"
+RDEPEND+=" !build? ( app-misc/mime-types )"
+PDEPEND=">=app-eselect/eselect-python-20140125-r1"
+
+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.5-distutils-OO-build.patch"
+
+       epatch_user
+
+       # Prefix' round of patches
+       # http://prefix.gentooexperimental.org:8000/python-patches-3_3
+       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-${PV}-libffi-pkgconfig.patch"
+
+       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/getpath.c \
+               Modules/Setup.dist \
+               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
+       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
+       local myeconfargs=(
+               $(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
+               --without-ensurepip
+               --with-system-expat
+               --with-system-ffi
+               --without-pymalloc
+       )
+
+       ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}"
+
+       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
+
+       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
+
+       # python seems to get rebuilt in src_install (bug 569908)
+       # Work around it for now.
+       if has_version dev-libs/libffi[pax_kernel]; then
+               pax-mark E "${ED}usr/bin/${abiver}"
+       else
+               pax-mark m "${ED}usr/bin/${abiver}"
+       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}:}.
+               local -x 
DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}.
+       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