Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: dev-lang/python/, dev-lang/python/files/
Date: Sun, 29 Oct 2017 17:00:15
Message-Id: 1509296383.e158fb2e33d8109c371faa0eecc2c936f2aee16a.grobian@gentoo
1 commit: e158fb2e33d8109c371faa0eecc2c936f2aee16a
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 29 16:59:43 2017 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 29 16:59:43 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e158fb2e
7
8 dev-lang/python: version bump to 3.5.4
9
10 Package-Manager: Portage-2.3.13-prefix, Repoman-2.3.4
11
12 dev-lang/python/Manifest | 3 +
13 .../files/python-3.5.4-libffi-pkgconfig.patch | 44 +++
14 dev-lang/python/python-3.5.4.ebuild | 436 +++++++++++++++++++++
15 3 files changed, 483 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 9796e4495c..d8a1cbde99 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -6,15 +6,18 @@ DIST Python-3.4.3.tar.xz 14421964 SHA256 b5b3963533768d5fc325a4d7a6bd6f666726002
22 DIST Python-3.4.5.tar.xz 14516820 SHA256 ee64b1c8a47461009abf25252332d29a4e587cb4f0c1c96aa793a3732e9d898a SHA512 b548a5338d141b3086dea372fa2cc245ba5350ee9f0d1304ef6222dc45380b66d380b092e547d54206d56ca68563b95036f445f97f72bb0ef1d48f81a74a3d4c WHIRLPOOL 43e0aed0177d46148964447b4fb24475c4c736afb2ba84ec393fbf55db3da3f192308f9c8f236deaa7a608dac56946ee7755970fadaa82bf406c910a05f36883
23 DIST Python-3.5.1.tar.xz 14830408 SHA256 c6d57c0c366d9060ab6c0cdf889ebf3d92711d466cc0119c441dbf2746f725c9 SHA512 261c9e42ae351853c718707a8887817e308b3ba7a37e9463a0bc8f50ee9be9ac1a011b2891f8877ecdb40beab99279bcfa8e04f813b8998fcf6cefb7fd52d850 WHIRLPOOL 7ff4ddb852c74f75d1f327e418f5af09ae66403cc3fb2431ab31786c046cec2d761ee57e8c6674a92bb08f95cfff7c7c7d5ddd965994096a0380fbd6b55fcc8f
24 DIST Python-3.5.2.tar.xz 15222676 SHA256 0010f56100b9b74259ebcd5d4b295a32324b58b517403a10d1a2aa7cb22bca40 SHA512 c07c3366f1c81e214241444bb9da6db9d11da32ad66bfa29cdad5a3b2e34e4d870bda6d4ce3c3910b582942e91f1d8c8a1c1a7b9464cc147b83c9e0007012742 WHIRLPOOL cf55d67f362b6a7529d43bb5aa8014c8349be190c6d4dae9d48de1679ab8623087478f41686cdced981cf18bb3d107052732cd437ff31ba5de2cc06b04ec2289
25 +DIST Python-3.5.4.tar.xz 15332320 SHA256 94d93bfabb3b109f8a10365a325f920f9ec98c6e2380bf228f9700a14054c84c SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff WHIRLPOOL 63bca2b7b6f5da024c30f84d7e4152a37232e3b277fc5ec58ede9a1da57a44e31bb5f2e5ee33874328526f8d7fdd05dc12df5c69fb827394d5b57907671d3dd3
26 DIST python-gentoo-patches-2.7.11-0.tar.xz 12916 SHA256 e14b47bb1fd64d366d7dfb8339cc2cbf4a53fc288b11dd83f575eb36a8a6408d SHA512 f0447bb699a163afc08df39b111394377539935546ae23732d7239e78d2bff0c04bc94949f86aef0c1be83736127dbd25c2c531e49befed2d638c3cd4940ac52 WHIRLPOOL 305992849d9d244da1e308e739c9bf62a3ef5c74eb65c765bdc666fb5767eb16c7a609f7c442c17da17f76c3ab81e4b09fa8c21e43f89366539a6a9d656bea77
27 DIST python-gentoo-patches-2.7.12-0.tar.xz 13576 SHA256 cd842eec7202df57c153adc1fbb81e70b26ef651f8e9346e065d8577b93f343b SHA512 8bf530fca15c47fa5d9bc958e433b35943a12c98e4172806a45aa60dc85ec92f8ab6ffcd90f752dc5bf8ffc711414894c15820c4b6ef72dbcedc2808119fb1f6 WHIRLPOOL 54b8ca6a4371d460dadccfdffcc096c12930d58714eef95117a658d7a1337ea89c45c69553b5b993017211faaa0f8d670e09a8452e53c0fb176be3e908524ee6
28 DIST python-gentoo-patches-3.4.3-0.tar.xz 11736 SHA256 917a9d98d40a91379c81ea57922a8632ba3c6f6db6f304ed6262bc88c5044946 SHA512 7ad1b30cf8bb7900fe518ed71e4ee55dd92ce7e23ae583a1f2f851b26cfa8c4f4271d28f418e780f3725a48d4ca8eeb8fd083f850810c66c29fb08c430828d72 WHIRLPOOL 074e8c0055b49a028eebda21d1acfb8a25ec968eb8b350c2bed37e042f9f354871e413db13e0ef2fe41d7e56d647178a7b3622019f36c4819c2c68f088366eb1
29 DIST python-gentoo-patches-3.4.5-0.tar.xz 12044 SHA256 84ee7630670a1dac4bbbc55fabf5f99b5b29007de4f140ad956e93d2e7aba8fa SHA512 108a4845667ecdf4001fcbeffab0cfbbac87439a449a7351428b0f3e2f159e3848ee0c0dfa45c9fba893b9f9584b33722fc8bb0bd7485a1d0909c3a35ede6ed8 WHIRLPOOL f0248faa0b4ce5679e37381bba90f8a4d361a49db792787bffc06a54a4bc82fea4d53255120f10e6dbf51b99e12417fc1b469be9624e73508fa3a212a38e7352
30 DIST python-gentoo-patches-3.5.1-0.tar.xz 11788 SHA256 668fabdb9326ba3df81dd299619d5245b7806934e9341ef89a06f90c9a98018b SHA512 3948af801e3e70b55b15165d6cc56fb33cdb9fcc9d80b913550c8609273bad28db0c10ec64cb14d010b80020716a1e45d720e08864f6ac850291cb1713800a1a WHIRLPOOL 2fd3b25186c26412dc642f76228d8e75f24cdc7452407dd105f027be5841b1b865f6b5b74a0072a0299153e5d5af699542253b366e4eb78dfbf114ad02b14bcc
31 DIST python-gentoo-patches-3.5.2-0.tar.xz 12008 SHA256 eb898fb448bd40f086ae2910e94c608faa932eb377fe40bd34f4390b4c37aac1 SHA512 e2ef1b8f10f9ea849bf52a0be65d48f7cfecf07bdf151cbbd7e3a1c9428a8d96e901650496c4ae7fd0093af8cc90de8df674dc1a4c66ad21916a4ee45a81efc8 WHIRLPOOL 66b99c7c50e3eaca783f773349b3e8a357f706a7da6a66bd2e0a53946bc81d965ac99d8fd4c50ba7e42052aa84508c8aede5eacedbb95f040a48cf1a5de6b6b0
32 +DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 SHA256 30c9dbcd5c11ed025b9d8dd201da84c5b9f9756f9b6ba77ccaebc6b79a91e320 SHA512 d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec WHIRLPOOL 2191dc89805c1bc11d125005a5c5dd0e5fe635eb0a3d6698bef8b55f54741edc3b3e2588bb21f5eda517963489c15296cd5fd265c8a548d78be6093698e6b002
33 DIST python-prefix-2.7.11-gentoo-patches-r1.tar.xz 17268 SHA256 ecebc430e475030fdbfcd940f314f80ebcb8c6e01a6b2498478bb8f37e525484 SHA512 22218128ff83856dd042ecd6aab3615282ab29c4420e6cce4a0bba8b6508e3f5649c27cdf50cf342fffd3c87ea29f8b7d32d28b9b1f4dc200771b52ee41f27e5 WHIRLPOOL 2a942b39e56955df5b24f50d68a39ca78152e10f13ccc856340cd4651eb87847097ec3ff79efde81c2130b12f2885764194fb8d51c05278f4acc550bcd4ba032
34 DIST python-prefix-2.7.12-gentoo-patches-r0.tar.xz 17380 SHA256 c488011046a678eaf2febe3d02726a0efbd2f8378a0c5b896b03bcbed5b5f00a SHA512 ef17c8e8083da0ed0e6a63c96f59cc1243b0376fc6d4d7fcecb165e557403c54ae87625ed6dfe4d7d73693f8220ec98ef8a3f16124d8022dbac6a3a9d5514d9c WHIRLPOOL 7e427be36a8d558193058d7112f704993474eff7bb554b6f2f0d9cfe085c653a9cf0522a33249a92e813fad667a53439c9f70d74bcde0df9f78824bfbbfaae46
35 DIST python-prefix-3.4.3-gentoo-patches-r1.tar.xz 12896 SHA256 39da669913d8627a74e6d9a7e1ee6eae3e184d7525097090d4b05a71b0a79100 SHA512 dd1082ef9605fdcb84bcc769318be6934c889a5b6134971fb121b3be8301cb9519fb687841a359c65e0614d05a8c27eab4b3dbfe94ed8dbbf2fc64f82206a6d9 WHIRLPOOL 884f0e9e5e177543c74f3c3e87629113db6c53c556f55bf7310de79f101fa825472d886eea216cea471e981dc4fd6743622e1c7472b5ffe04eda4c6790d73c62
36 DIST python-prefix-3.4.5-gentoo-patches-r0.tar.xz 12932 SHA256 ab0b1f138c8bd22b2be862923e219d68513d98e77d32260b9625d19be08b1bf3 SHA512 e32556c63e48d8dacd86218945147d1bbbc5777a6bb3441373827da47771a8eb387f26885acd35343cc598c719c9feec63007144fc1fdd1aca253a2ec1a19825 WHIRLPOOL fda061e683462252bf777ea43d84958fb07ca0144be3f87cc42e4e2baa4f69cb0ed3075b55445398f88c514d28c8c310c6b5b312883a4949c8745161aaf3d786
37 DIST python-prefix-3.5.1-gentoo-patches-r2.tar.xz 12680 SHA256 73b1166eded9867b473c90171b613d32bbe8f72e523c74b1563a9c25c555e13b SHA512 82b08b8cf7f3620c4c2a6a6c3ed5ec8c3318c6f43e4bcc4950c7aeb56ec755e0e47d46f068843f5b04159583994c8620dab14827278a199789a3867532cc6e0c WHIRLPOOL ac4ea106ca744d6e154e14a53ae2e8eeb119207069ead95d0ef19657a58e1d31ed1933de6315ab61ce532c11d1ae4a999c73d34121028a0a246b7dd2b1ac857a
38 DIST python-prefix-3.5.2-gentoo-patches-r0.tar.xz 12652 SHA256 2a1288ef4b50c0dd679e29912cff93cfd168f9d843dc3090751460968cf40d7c SHA512 e214583393aaf6ec603495531fd2c8d3c668c1fc72c4e3226a4daa537ad34e763302d7110b9ca8a58eb77955aad22371f6cf13247c6d06350f56989301faae8b WHIRLPOOL 4fb513181557fe3be4cf3a3fe12cac5b99bfc7365c37df28a8b30e05a2b58ec74d9b2e8e6c9a7ecfca643c3ab477d2b65b27e4a33f929f28f9749611d913b04a
39 +DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 SHA256 cb62db1caaa01aeab6a9e5264d2873eff1c194f9d6fb8e6e1bce0e515a8611ad SHA512 334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5 WHIRLPOOL 295187be131a3f89597e68072687bf1f1140757798230cc76cedb964fe810642b4b4c81d190d92fd40927542d8024c9d7ad877224d2c0ab8702d2435b3fd5b6e
40
41 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
42 new file mode 100644
43 index 0000000000..0edd83b6ae
44 --- /dev/null
45 +++ b/dev-lang/python/files/python-3.5.4-libffi-pkgconfig.patch
46 @@ -0,0 +1,44 @@
47 +diff -u -r Python-3.3.3-orig//configure.ac Python-3.3.3/configure.ac
48 +--- Python-3.3.3-orig//configure.ac 2014-03-06 05:25:46.000000000 +0100
49 ++++ Python-3.3.3/configure.ac 2014-03-06 05:26:27.000000000 +0100
50 +@@ -2247,10 +2247,13 @@
51 +
52 + if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then
53 + LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`"
54 ++ LIBFFI_LIB="`"$PKG_CONFIG" libffi --libs-only-l 2>/dev/null | sed -e 's/^-l//;s/ *$//'`"
55 + else
56 + LIBFFI_INCLUDEDIR=""
57 ++ LIBFFI_LIB=""
58 + fi
59 + AC_SUBST(LIBFFI_INCLUDEDIR)
60 ++AC_SUBST(LIBFFI_LIB)
61 +
62 + AC_MSG_RESULT($with_system_ffi)
63 +
64 +diff -u -r Python-3.3.3-orig//Makefile.pre.in Python-3.3.3/Makefile.pre.in
65 +--- Python-3.3.3-orig//Makefile.pre.in 2014-03-06 05:25:46.000000000 +0100
66 ++++ Python-3.3.3/Makefile.pre.in 2014-03-06 05:26:42.000000000 +0100
67 +@@ -252,6 +252,7 @@
68 +
69 +
70 + LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
71 ++LIBFFI_LIB= @LIBFFI_LIB@
72 +
73 + ##########################################################################
74 + # Parser
75 +diff -u -r Python-3.3.3-orig//setup.py Python-3.3.3/setup.py
76 +--- Python-3.3.3-orig//setup.py 2014-03-06 05:25:46.000000000 +0100
77 ++++ Python-3.3.3/setup.py 2014-03-06 05:27:05.000000000 +0100
78 +@@ -1763,8 +1763,10 @@
79 + ffi_inc = None
80 + print('Header file {} does not define LIBFFI_H or '
81 + 'ffi_wrapper_h'.format(ffi_h))
82 +- ffi_lib = None
83 +- if ffi_inc is not None:
84 ++ ffi_lib = sysconfig.get_config_var("LIBFFI_LIB")
85 ++ if not ffi_lib or ffi_lib == '':
86 ++ ffi_lib = None
87 ++ if ffi_inc is not None and ffi_lib is None:
88 + for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
89 + if (self.compiler.find_library_file(lib_dirs, lib_name)):
90 + ffi_lib = lib_name
91
92 diff --git a/dev-lang/python/python-3.5.4.ebuild b/dev-lang/python/python-3.5.4.ebuild
93 new file mode 100644
94 index 0000000000..37d3bc1086
95 --- /dev/null
96 +++ b/dev-lang/python/python-3.5.4.ebuild
97 @@ -0,0 +1,436 @@
98 +# Copyright 1999-2017 Gentoo Foundation
99 +# Distributed under the terms of the GNU General Public License v2
100 +
101 +EAPI="5"
102 +WANT_LIBTOOL="none"
103 +
104 +inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs
105 +
106 +MY_P="Python-${PV/_/}"
107 +PATCHSET_VERSION="3.5.4-0"
108 +PREFIX_PATCHREV="r0"
109 +
110 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
111 +HOMEPAGE="https://www.python.org/"
112 +SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz
113 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
114 + https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz"
115 +
116 +LICENSE="PSF-2"
117 +SLOT="3.5/3.5m"
118 +KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
119 +IUSE="aqua build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml"
120 +
121 +# Do not add a dependency on dev-lang/python to this ebuild.
122 +# If you need to apply a patch which requires python for bootstrapping, please
123 +# run the bootstrap code on your dev box and include the results in the
124 +# patchset. See bug 447752.
125 +
126 +RDEPEND="app-arch/bzip2:0=
127 + app-arch/xz-utils:0=
128 + >=sys-libs/zlib-1.1.3:0=
129 + virtual/libffi
130 + virtual/libintl
131 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
132 + ncurses? (
133 + >=sys-libs/ncurses-5.2:0=
134 + readline? ( >=sys-libs/readline-4.1:0= )
135 + )
136 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
137 + ssl? (
138 + !libressl? ( dev-libs/openssl:0= )
139 + libressl? ( dev-libs/libressl:= )
140 + )
141 + tk? (
142 + >=dev-lang/tcl-8.0:0=
143 + >=dev-lang/tk-8.0:0=[-aqua]
144 + dev-tcltk/blt:0=
145 + dev-tcltk/tix
146 + )
147 + xml? ( >=dev-libs/expat-2.1:0= )
148 + !!<sys-apps/sandbox-2.6-r1"
149 +DEPEND="${RDEPEND}
150 + virtual/pkgconfig
151 + !sys-devel/gcc[libffi(-)]"
152 +RDEPEND+=" !build? ( app-misc/mime-types )"
153 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
154 +
155 +S="${WORKDIR}/${MY_P}"
156 +
157 +PYVER=${SLOT%/*}
158 +
159 +src_prepare() {
160 + # Ensure that internal copies of expat, libffi and zlib are not used.
161 + rm -fr Modules/expat
162 + rm -fr Modules/_ctypes/libffi*
163 + rm -fr Modules/zlib
164 +
165 + if tc-is-cross-compiler; then
166 + # Invokes BUILDPYTHON, which is built for the host arch
167 + local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
168 + fi
169 +
170 + EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
171 + epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch"
172 + epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch"
173 +
174 + epatch_user
175 +
176 + # Prefix' round of patches
177 + # http://prefix.gentooexperimental.org:8000/python-patches-3_3
178 + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
179 + epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}
180 +
181 + # https://forums.developer.apple.com/thread/9233, bug #572726
182 + sed -i -e '/$(RUNSHARED) .\/regen/s/^/export RUNSHARED=$(RUNSHARED); /' \
183 + Makefile.pre.in || die
184 + sed -i -e '/python$EXE/s/^/env ${RUNSHARED} /' \
185 + Lib/plat-darwin/regen || die
186 +
187 + # we provide a fully working readline also on Darwin, so don't force
188 + # usage of less functional libedit
189 + sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
190 +
191 + # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
192 + sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
193 +
194 + # Make sure python doesn't use the host libffi.
195 + use prefix && epatch "${FILESDIR}/python-${PV}-libffi-pkgconfig.patch"
196 +
197 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
198 + configure.ac \
199 + Lib/distutils/command/install.py \
200 + Lib/distutils/sysconfig.py \
201 + Lib/site.py \
202 + Lib/sysconfig.py \
203 + Lib/test/test_site.py \
204 + Makefile.pre.in \
205 + Modules/getpath.c \
206 + Modules/Setup.dist \
207 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
208 +
209 + # workaround a development build env problem and muck around
210 + # framework install to get the best of both worlds (non-standard)
211 + sed -i \
212 + -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
213 + -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
214 + configure.ac configure || die
215 + sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
216 +
217 + # Disable ABI flags.
218 + sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed"
219 +
220 + eautoreconf
221 +}
222 +
223 +src_configure() {
224 + local disable
225 + use gdbm || disable+=" gdbm"
226 + use ncurses || disable+=" _curses _curses_panel"
227 + use readline || disable+=" readline"
228 + use sqlite || disable+=" _sqlite3"
229 + use ssl || export PYTHON_DISABLE_SSL="1"
230 + use tk || disable+=" _tkinter"
231 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
232 + export PYTHON_DISABLE_MODULES="${disable}"
233 +
234 + if ! use xml; then
235 + ewarn "You have configured Python without XML support."
236 + ewarn "This is NOT a recommended configuration as you"
237 + ewarn "may face problems parsing any XML documents."
238 + fi
239 +
240 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
241 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
242 + fi
243 +
244 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
245 + append-flags -fwrapv
246 + fi
247 +
248 + filter-flags -malign-double
249 +
250 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
251 + if is-flagq -O3; then
252 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
253 + use hardened && replace-flags -O3 -O2
254 + fi
255 +
256 + # Export CC so even AIX will use gcc instead of xlc_r.
257 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
258 + tc-export CC CXX
259 +
260 + # The configure script fails to use pkg-config correctly.
261 + # http://bugs.python.org/issue15506
262 + export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG)
263 +
264 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
265 + # Needed on FreeBSD unless Python 3.2 is already installed.
266 + # Please query BSD team before removing this!
267 + append-ldflags "-L."
268 +
269 + # make sure setup.py considers Prefix' paths before system ones
270 + use prefix && append-cppflags -I"${EPREFIX}"/usr/include
271 + use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib
272 +
273 + local dbmliborder
274 + if use gdbm; then
275 + dbmliborder+="${dbmliborder:+:}gdbm"
276 + fi
277 +
278 + BUILD_DIR="${WORKDIR}/${CHOST}"
279 + mkdir -p "${BUILD_DIR}" || die
280 + cd "${BUILD_DIR}" || die
281 +
282 + if use aqua ; then
283 + ECONF_SOURCE="${S}" OPT="" \
284 + econf \
285 + --enable-framework="${EPREFIX}"/usr/lib \
286 + --config-cache
287 + fi
288 +
289 + # pymalloc #452720
290 + local myeconfargs=(
291 + $(use aqua && echo --config-cache) \
292 + --with-fpectl
293 + --enable-shared
294 + $(use_enable ipv6)
295 + $(use_with threads)
296 + --infodir='${prefix}/share/info'
297 + --mandir='${prefix}/share/man'
298 + --with-computed-gotos
299 + --with-dbmliborder="${dbmliborder}"
300 + --with-libc=
301 + --enable-loadable-sqlite-extensions
302 + --without-ensurepip
303 + --with-system-expat
304 + --with-system-ffi
305 + --without-pymalloc
306 + )
307 +
308 + ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}"
309 +
310 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
311 + eerror "configure has detected that the sem_open function is broken."
312 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
313 + die "Broken sem_open function (bug 496328)"
314 + fi
315 +}
316 +
317 +src_compile() {
318 + # Ensure sed works as expected
319 + # https://bugs.gentoo.org/594768
320 + local -x LC_ALL=C
321 +
322 + cd "${BUILD_DIR}" || die
323 +
324 + emake CPPFLAGS= CFLAGS= LDFLAGS=
325 +
326 + # Work around bug 329499. See also bug 413751 and 457194.
327 + if has_version dev-libs/libffi[pax_kernel]; then
328 + pax-mark E python
329 + else
330 + pax-mark m python
331 + fi
332 +}
333 +
334 +src_test() {
335 + # Tests will not work when cross compiling.
336 + if tc-is-cross-compiler; then
337 + elog "Disabling tests due to crosscompiling."
338 + return
339 + fi
340 +
341 + cd "${BUILD_DIR}" || die
342 +
343 + # Skip failing tests.
344 + local skipped_tests="gdb"
345 +
346 + for test in ${skipped_tests}; do
347 + mv "${S}"/Lib/test/test_${test}.py "${T}"
348 + done
349 +
350 + local -x PYTHONDONTWRITEBYTECODE=
351 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
352 + local result=$?
353 +
354 + for test in ${skipped_tests}; do
355 + mv "${T}/test_${test}.py" "${S}"/Lib/test
356 + done
357 +
358 + elog "The following tests have been skipped:"
359 + for test in ${skipped_tests}; do
360 + elog "test_${test}.py"
361 + done
362 +
363 + elog "If you would like to run them, you may:"
364 + elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'"
365 + elog "and run the tests separately."
366 +
367 + if [[ ${result} -ne 0 ]]; then
368 + die "emake test failed"
369 + fi
370 +}
371 +
372 +src_install() {
373 + local libdir=${ED}/usr/$(get_libdir)/python${PYVER}
374 +
375 + cd "${BUILD_DIR}" || die
376 +
377 + emake DESTDIR="${D}" altinstall
378 +
379 + if use aqua ; then
380 + # avoid config.status to be triggered
381 + find Mac -name "Makefile" -exec touch \{\} + || die
382 +
383 + # Python_Launcher is kind of a wrapper, and we should fix it for
384 + # Prefix (it uses /usr/bin/pythonw) so useless
385 + # IDLE doesn't run, no idea, but definitely not used
386 + emake DESTDIR="${D}" -C Mac install_Python || die
387 + rmdir "${ED}"/Applications/Python* || die
388 + rmdir "${ED}"/Applications || die
389 +
390 + local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER}
391 + ln -s "${EPREFIX}"/usr/include/python${PYVER} \
392 + "${ED}${fwdir}"/Headers || die
393 + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \
394 + "${ED}${fwdir}"/Python || die
395 + fi
396 +
397 + sed \
398 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
399 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
400 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
401 +
402 + # Fix collisions between different slots of Python.
403 + rm -f "${ED}usr/$(get_libdir)/libpython3.so"
404 +
405 + # Cheap hack to get version with ABIFLAGS
406 + local abiver=$(cd "${ED}usr/include"; echo python*)
407 + if [[ ${abiver} != python${PYVER} ]]; then
408 + # Replace python3.X with a symlink to python3.Xm
409 + rm "${ED}usr/bin/python${PYVER}" || die
410 + dosym "${abiver}" "/usr/bin/python${PYVER}"
411 + # Create python3.X-config symlink
412 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
413 + # Create python-3.5m.pc symlink
414 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
415 + fi
416 +
417 + # python seems to get rebuilt in src_install (bug 569908)
418 + # Work around it for now.
419 + if has_version dev-libs/libffi[pax_kernel]; then
420 + pax-mark E "${ED}usr/bin/${abiver}"
421 + else
422 + pax-mark m "${ED}usr/bin/${abiver}"
423 + fi
424 +
425 + use elibc_uclibc && rm -fr "${libdir}/test"
426 + use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
427 + use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*}
428 +
429 + use threads || rm -fr "${libdir}/multiprocessing"
430 + use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
431 +
432 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
433 +
434 + if use examples; then
435 + insinto /usr/share/doc/${PF}/examples
436 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
437 + doins -r "${S}"/Tools
438 + fi
439 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
440 + if use aqua ; then
441 + # we do framework, so the emake trick below returns a pathname
442 + # since that won't work here, use a (cheap) trick instead
443 + local libname=libpython${PYVER}
444 + else
445 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
446 + emake --no-print-directory -s -f - 2>/dev/null)
447 + fi
448 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
449 +
450 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
451 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
452 + sed \
453 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
454 + -e "s:@PYDOC@:pydoc${PYVER}:" \
455 + -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
456 +
457 + # for python-exec
458 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
459 +
460 + # if not using a cross-compiler, use the fresh binary
461 + if ! tc-is-cross-compiler; then
462 + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
463 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}.
464 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}.
465 + else
466 + vars=( PYTHON "${vars[@]}" )
467 + fi
468 +
469 + python_export "python${PYVER}" "${vars[@]}"
470 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
471 + python_domodule epython.py
472 +
473 + # python-exec wrapping support
474 + local pymajor=${PYVER%.*}
475 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
476 + # python and pythonX
477 + ln -s "../../../bin/${abiver}" \
478 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
479 + ln -s "python${pymajor}" \
480 + "${D}${PYTHON_SCRIPTDIR}/python" || die
481 + # python-config and pythonX-config
482 + # note: we need to create a wrapper rather than symlinking it due
483 + # to some random dirname(argv[0]) magic performed by python-config
484 + cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
485 + #!/bin/sh
486 + exec "${abiver}-config" "\${@}"
487 + EOF
488 + chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
489 + ln -s "python${pymajor}-config" \
490 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
491 + # 2to3, pydoc, pyvenv
492 + ln -s "../../../bin/2to3-${PYVER}" \
493 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
494 + ln -s "../../../bin/pydoc${PYVER}" \
495 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
496 + ln -s "../../../bin/pyvenv-${PYVER}" \
497 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
498 + # idle
499 + if use tk; then
500 + ln -s "../../../bin/idle${PYVER}" \
501 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
502 + fi
503 +}
504 +
505 +pkg_preinst() {
506 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
507 + python_updater_warning="1"
508 + fi
509 +}
510 +
511 +eselect_python_update() {
512 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
513 + eselect python update
514 + fi
515 +
516 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
517 + eselect python update --python${PV%%.*}
518 + fi
519 +}
520 +
521 +pkg_postinst() {
522 + eselect_python_update
523 +
524 + if [[ "${python_updater_warning}" == "1" ]]; then
525 + ewarn "You have just upgraded from an older version of Python."
526 + ewarn
527 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
528 + fi
529 +}
530 +
531 +pkg_postrm() {
532 + eselect_python_update
533 +}