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/
Date: Wed, 11 May 2022 20:18:25
Message-Id: 1652300290.7e2a2e320eba675f3acab46e22647ca6514a329f.grobian@gentoo
1 commit: 7e2a2e320eba675f3acab46e22647ca6514a329f
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 11 20:18:10 2022 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Wed May 11 20:18:10 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7e2a2e32
7
8 dev-lang/python-3.9.12: version bump
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 dev-lang/python/Manifest | 4 +
14 dev-lang/python/python-3.9.12.ebuild | 475 +++++++++++++++++++++++++++++++++++
15 2 files changed, 479 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index f18ad79618..d71c4cd59f 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -2,11 +2,15 @@ DIST Python-3.10.4.tar.xz 19342692 BLAKE2B c430ad9bed71729fda29433af0614b6c0110a
22 DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf SHA512 699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d
23 DIST Python-3.8.8.tar.xz 18271736 BLAKE2B af0ff1acd919b365a58278e82678324ff884cc8120bcaf12e0e3afb1bd978e6469e256335df131935f51ff481fb83dda04e4b6f1cd1746611f9ec944db73d692 SHA512 64181db5aa48281284a3230436ebfb8cb91b645a9dec956fd48c0048334498477073fc4e14d6b426d0ef7fbcdcfd5d59cbf01a504e6c9014dc9529494b9309fb
24 DIST Python-3.8.8.tar.xz.asc 833 BLAKE2B a11188f9f68c518259de1a4e271bf56409d7356a7eb3dd8cbea7bbb0b5bc1b43f9aeb85bda4add65bbae906bef65cb20a30bcc77da04c0d383cd5b527821fd85 SHA512 0e6f11a310c1796dd056d9a4b63b5e03aa8dbd290088966e04a590a78c00003887dbfd7a7029a6cf8c5626ecd6ca91c1c16433bb0a41bf1225b02b8db8541b95
25 +DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25 SHA512 081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97
26 +DIST Python-3.9.12.tar.xz.asc 833 BLAKE2B 33436d0404a643215a8fd2b967ffd216201da24f374941bf65b888159ccfabcbe79b751eca2dd489b06605604338c8bbaab74aa10abbe4bcffaa54236301228e SHA512 dddaa27f8a29034f458edb6739398a5455c87fe37b6349e161865a9deedca118ffe9cb82663cc75bbe60b3b556399c0c6855f5262aac1fe90d36a3694fca65b2
27 DIST Python-3.9.6.tar.xz 19051972 BLAKE2B 0d8586b2935088eeab7138cf2210c1a74f1bf7359359d25750af5f69de55eb39c92f518b887a8b749c772ed7d33e85b912928ae6d878514eb58d85ef210f54f0 SHA512 01c529e3207738d8771caeb5ed6217e10745c21aa39832fe3185e1c87fdb6aedead97ce38dbb11e02d873654028bd8071c3f345c18452769520723284efe9dc1
28 DIST Python-3.9.6.tar.xz.asc 833 BLAKE2B 41901bfb80a901f2f14e86769e6d08ded8f75656d347201345183162e180e61442da871a1067572a54da579551166a19bf5436e51581bb10cb78afc4d28773fc SHA512 0673c8833f302c829bfde97453c52744f6aa99b4a72520f4cc384d4aa9d6ffd28a1407ceafb0a1ec4462b3aa74b656bf39c67872c4e6a131429ea58c47ad0ecc
29 DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2
30 DIST python-gentoo-patches-3.8.8_p1.tar.xz 15456 BLAKE2B 7d9f55f951f97ef7e08d0245dddd21f5b8d126735c1c392ba6326ad1c18023b477f62e9b6663d8e5b6f0362e442137d0b6ed3ea13b279cca6734d36dbe6e654f SHA512 7fff74d03a0c4cd4b5c977761179c2b9a0ed472847ee9544f54331cef7549557ac4d6b78e676058bd2b01c96ca59d84f04c55beca8ddc45f16b11ce349210eea
31 +DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b SHA512 07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91
32 DIST python-gentoo-patches-3.9.6_p1.tar.xz 12764 BLAKE2B 927718f1aadb5d5ef67e647a639a10bffdd48474bf01e50bd37ef1242bce57606b7b54c4823c1da3585ee76e737028163e38e9b4e19037585cc53f925e1c5fa7 SHA512 f06fb55786bd942e72e3225ee9ce218724aeee29f301279743588749007e991851a8f29db5b5dfd85435e3d763c00942947909a6fc60581bd0f3e8a6e913bff8
33 DIST python-prefix-gentoo-3.10.4-patches-r0.tar.xz 6772 BLAKE2B b807ae02242926d99c3823b73ce33193926d55891d54b5d214b4bdf24d2213b4d7b248030146a01698ceadd255affffef8937d84fc11e6d587ffcc91286e81b2 SHA512 a8f16d12b785a4b9ca884e4235cb298e4155273534a7957e517a679f0c2d4b35dcca08e445bed3fe2a80e3a6441f04004eae955a362eb1091ac1f9e2b9a5448f
34 DIST python-prefix-gentoo-3.8.7-patches-r2.tar.xz 8312 BLAKE2B 268f3cff62dc51d4f91994c3f6b05cea0e29edb1ccf39476ba52485fb94c3cad72b54ed5cd941c227bdad004a7ae0069d60ee6bbde5a30d16115263d0dc2a5c3 SHA512 e43ce1e9e851bebce968ee025f765fc9a558c8edc4ee2d51616043183fd12301ab3d5c7f92915238e53b5cf92f6c00617ab0fcf9859d4cebe0966271e6f64725
35 +DIST python-prefix-gentoo-3.9.12-patches-r0.tar.xz 7016 BLAKE2B 77045f38d8ee20138802a99cbf4590c7ef52bd6e4a2a3f159af8430f5f625d37e924b3b8cd10af3f63f959d9cf0ba7f6cd632bc188a45a4618a01cd619234d10 SHA512 60db6e270708b22f069df4ce25ea92a86de8ff6b09baa50bf1aa600b36dbf30f0de35aa7c7c4cfbcdc4ec8b235dd033e57838f98b0768749bc1a74d42163f530
36 DIST python-prefix-gentoo-3.9.6_p1-patches-r0.tar.xz 6984 BLAKE2B 8b032d3000fd2dfcb8e099ac071c1a911ba2a0e30343788f7191043800f9d0088307cd7007b2b3f6cc7d2f315fc22bbac5990fed81f0dd8d60dca0314bd59b88 SHA512 76c56895c99ee203bd266f475766d2572659939abaf478932e7c9c65ddc52cb5e012e23c9455dd0a4bf0281a07c70e23a2fea8337c693b8a4ac8abb534e21982
37
38 diff --git a/dev-lang/python/python-3.9.12.ebuild b/dev-lang/python/python-3.9.12.ebuild
39 new file mode 100644
40 index 0000000000..6ac508e466
41 --- /dev/null
42 +++ b/dev-lang/python/python-3.9.12.ebuild
43 @@ -0,0 +1,475 @@
44 +# Copyright 1999-2022 Gentoo Authors
45 +# Distributed under the terms of the GNU General Public License v2
46 +
47 +EAPI="7"
48 +WANT_LIBTOOL="none"
49 +
50 +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \
51 + python-utils-r1 toolchain-funcs verify-sig
52 +
53 +MY_PV=${PV/_rc/rc}
54 +MY_P="Python-${MY_PV%_p*}"
55 +PYVER=$(ver_cut 1-2)
56 +PATCHSET="python-gentoo-patches-${MY_PV}"
57 +PREFIX_PATCHSET="python-prefix-gentoo-${MY_PV}-patches-r0"
58 +
59 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
60 +HOMEPAGE="https://www.python.org/"
61 +SRC_URI="
62 + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz
63 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
64 + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz
65 + verify-sig? (
66 + https://www.python.org/ftp/python/${PV%_*}/${MY_P}.tar.xz.asc
67 + )
68 +"
69 +S="${WORKDIR}/${MY_P}"
70 +
71 +LICENSE="PSF-2"
72 +SLOT="${PYVER}"
73 +KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
74 +IUSE="aqua bluetooth build examples gdbm hardened lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml"
75 +RESTRICT="!test? ( test )"
76 +
77 +# Do not add a dependency on dev-lang/python to this ebuild.
78 +# If you need to apply a patch which requires python for bootstrapping, please
79 +# run the bootstrap code on your dev box and include the results in the
80 +# patchset. See bug 447752.
81 +
82 +RDEPEND="
83 + app-arch/bzip2:=
84 + app-arch/xz-utils:=
85 + dev-lang/python-exec[python_targets_python3_9(-)]
86 + dev-libs/libffi:=
87 + kernel_linux? ( sys-apps/util-linux:= )
88 + >=sys-libs/zlib-1.1.3:=
89 + virtual/libcrypt:=
90 + virtual/libintl
91 + gdbm? ( sys-libs/gdbm:=[berkdb] )
92 + ncurses? ( >=sys-libs/ncurses-5.2:= )
93 + readline? ( >=sys-libs/readline-4.1:= )
94 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
95 + ssl? ( >=dev-libs/openssl-1.1.1:= )
96 + tk? (
97 + >=dev-lang/tcl-8.0:=
98 + >=dev-lang/tk-8.0:=
99 + dev-tcltk/blt:=
100 + dev-tcltk/tix
101 + )
102 + xml? ( >=dev-libs/expat-2.1:= )
103 +"
104 +# bluetooth requires headers from bluez
105 +DEPEND="
106 + ${RDEPEND}
107 + bluetooth? ( net-wireless/bluez )
108 + test? ( app-arch/xz-utils[extra-filters(+)] )
109 +"
110 +BDEPEND="
111 + virtual/awk
112 + virtual/pkgconfig
113 + sys-devel/autoconf-archive
114 + verify-sig? ( sec-keys/openpgp-keys-python )
115 + !sys-devel/gcc[libffi(-)]
116 +"
117 +RDEPEND+="
118 + !build? ( app-misc/mime-types )
119 +"
120 +
121 +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc
122 +
123 +# large file tests involve a 2.5G file being copied (duplicated)
124 +CHECKREQS_DISK_BUILD=5500M
125 +
126 +QA_PKGCONFIG_VERSION=${PYVER}
127 +
128 +pkg_pretend() {
129 + use test && check-reqs_pkg_pretend
130 +}
131 +
132 +pkg_setup() {
133 + use test && check-reqs_pkg_setup
134 +}
135 +
136 +src_unpack() {
137 + if use verify-sig; then
138 + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc}
139 + fi
140 + default
141 +}
142 +
143 +src_prepare() {
144 + # Ensure that internal copies of expat, libffi and zlib are not used.
145 + rm -fr Modules/expat || die
146 + rm -fr Modules/_ctypes/libffi* || die
147 + rm -fr Modules/zlib || die
148 +
149 + local PATCHES=(
150 + "${WORKDIR}/${PATCHSET}"
151 + # Prefix' round of patches
152 + "${WORKDIR}"/${PREFIX_PATCHSET}
153 + )
154 +
155 + default
156 +
157 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
158 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
159 +
160 + # force correct number of jobs
161 + # https://bugs.gentoo.org/737660
162 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
163 + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
164 + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
165 +
166 + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets
167 + # miscompiled when optimisation is being used
168 + if [[ ${CHOST} == powerpc*-darwin* ]] && \
169 + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ;
170 + then
171 + sed -i \
172 + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die
173 + fi
174 +
175 + # Darwin 9's kqueue seems to act up (at least at this stage), so
176 + # make Python's selectors resort to poll() or select()
177 + if [[ ${CHOST} == powerpc*-darwin9 ]] ; then
178 + sed -i \
179 + -e 's/KQUEUE/KQUEUE_DISABLED/' \
180 + configure.ac configure || die
181 + fi
182 +
183 + if [[ ${CHOST} == *-darwin19 ]] ; then
184 + # HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH is set because
185 + # _dyld_shared_cache_contains_path could be found, yet it cannot
186 + # be resolved when dlopen()ing, so simply pretend it doesn't
187 + # exist here
188 + sed -i \
189 + -e 's/_dyld_shared_cache_contains_path/disabled&/' \
190 + configure.ac configure || die
191 + fi
192 +
193 + eautoreconf
194 +}
195 +
196 +src_configure() {
197 + local disable
198 + # disable automagic bluetooth headers detection
199 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
200 + use gdbm || disable+=" gdbm"
201 + use ncurses || disable+=" _curses _curses_panel"
202 + use readline || disable+=" readline"
203 + use sqlite || disable+=" _sqlite3"
204 + use ssl || export PYTHON_DISABLE_SSL="1"
205 + use tk || disable+=" _tkinter"
206 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
207 + export PYTHON_DISABLE_MODULES="${disable}"
208 +
209 + if ! use xml; then
210 + ewarn "You have configured Python without XML support."
211 + ewarn "This is NOT a recommended configuration as you"
212 + ewarn "may face problems parsing any XML documents."
213 + fi
214 +
215 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
216 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
217 + fi
218 +
219 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
220 + append-flags -fwrapv
221 + fi
222 +
223 + filter-flags -malign-double
224 +
225 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
226 + if is-flagq -O3; then
227 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
228 + use hardened && replace-flags -O3 -O2
229 + fi
230 +
231 + # https://bugs.gentoo.org/700012
232 + if is-flagq -flto || is-flagq '-flto=*'; then
233 + append-cflags $(test-flags-CC -ffat-lto-objects)
234 + fi
235 +
236 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
237 + tc-export CXX
238 +
239 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
240 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
241 +
242 + local dbmliborder
243 + if use gdbm; then
244 + dbmliborder+="${dbmliborder:+:}gdbm"
245 + fi
246 +
247 + if use aqua ; then
248 + ECONF_SOURCE="${S}" OPT="" \
249 + econf \
250 + --enable-framework="${EPREFIX}" \
251 + --config-cache
252 + fi
253 +
254 + # flock on 32-bits sparc Solaris is broken
255 + [[ ${CHOST} == sparc-*-solaris* ]] && \
256 + export ac_cv_flock_decl=no
257 +
258 + if use pgo; then
259 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
260 + export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network"
261 +
262 + # All of these seem to occasionally hang for PGO inconsistently
263 + # They'll even hang here but be fine in src_test sometimes.
264 + # bug #828535 (and related: bug #788022)
265 + PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc"
266 +
267 + if has_version "app-arch/rpm" ; then
268 + # Avoid sandbox failure (attempts to write to /var/lib/rpm)
269 + PROFILE_TASK+=" -x test_distutils"
270 + fi
271 + fi
272 +
273 + local myeconfargs=(
274 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
275 + # Python on glibc upgrade, remove it proactively to give
276 + # a chance for users rebuilding python before glibc
277 + # except on non-glibc systems this breaks the build, so be
278 + # conservative!
279 + $(use elibc_glibc && echo ac_cv_header_stropts_h=no)
280 +
281 + $(use aqua && echo --config-cache)
282 + --enable-shared
283 + --enable-ipv6
284 + --infodir='${prefix}/share/info'
285 + --mandir='${prefix}/share/man'
286 + --with-computed-gotos
287 + --with-dbmliborder="${dbmliborder}"
288 + --with-libc=
289 + --enable-loadable-sqlite-extensions
290 + --without-ensurepip
291 + --with-system-expat
292 + --with-system-ffi
293 +
294 + $(use_with lto)
295 + $(use_enable pgo optimizations)
296 + )
297 +
298 + # disable implicit optimization/debugging flags
299 + local -x OPT=
300 + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
301 + # propagated to sysconfig for built extensions
302 + local -x CFLAGS_NODIST=${CFLAGS}
303 + local -x LDFLAGS_NODIST=${LDFLAGS}
304 + local -x CFLAGS= LDFLAGS=
305 +
306 + econf "${myeconfargs[@]}"
307 +
308 + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
309 + eerror "configure has detected that the sem_open function is broken."
310 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
311 + die "Broken sem_open function (bug 496328)"
312 + fi
313 +}
314 +
315 +src_compile() {
316 + # Ensure sed works as expected
317 + # https://bugs.gentoo.org/594768
318 + local -x LC_ALL=C
319 + # Prevent using distutils bundled by setuptools.
320 + # https://bugs.gentoo.org/823728
321 + export SETUPTOOLS_USE_DISTUTILS=stdlib
322 +
323 + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't
324 + # end up writing bytecode & violating sandbox.
325 + # bug #831897
326 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE}
327 +
328 + if use pgo ; then
329 + # bug 660358
330 + local -x COLUMNS=80
331 + local -x PYTHONDONTWRITEBYTECODE=
332 +
333 + addpredict /usr/lib/python3.9/site-packages
334 + fi
335 +
336 + # also need to clear the flags explicitly here or they end up
337 + # in _sysconfigdata*
338 + emake CPPFLAGS= CFLAGS= LDFLAGS=
339 +
340 + # Restore saved value from above.
341 + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE}
342 +
343 + # Work around bug 329499. See also bug 413751 and 457194.
344 + if has_version dev-libs/libffi[pax-kernel]; then
345 + pax-mark E python
346 + else
347 + pax-mark m python
348 + fi
349 +}
350 +
351 +src_test() {
352 + # Tests will not work when cross compiling.
353 + if tc-is-cross-compiler; then
354 + elog "Disabling tests due to crosscompiling."
355 + return
356 + fi
357 +
358 + # Skip failing tests.
359 + local skipped_tests="gdb"
360 +
361 + if use sparc ; then
362 + # bug #788022
363 + skipped_tests+=" multiprocessing_fork"
364 + skipped_tests+=" multiprocessing_forkserver"
365 + fi
366 +
367 + for test in ${skipped_tests}; do
368 + mv "${S}"/Lib/test/test_${test}.py "${T}"
369 + done
370 +
371 + # bug 660358
372 + local -x COLUMNS=80
373 + local -x PYTHONDONTWRITEBYTECODE=
374 +
375 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")
376 +
377 + emake test EXTRATESTOPTS="-u-network -j${jobs}" \
378 + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
379 + local result=$?
380 +
381 + for test in ${skipped_tests}; do
382 + mv "${T}/test_${test}.py" "${S}"/Lib/test
383 + done
384 +
385 + elog "The following tests have been skipped:"
386 + for test in ${skipped_tests}; do
387 + elog "test_${test}.py"
388 + done
389 +
390 + elog "If you would like to run them, you may:"
391 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
392 + elog "and run the tests separately."
393 +
394 + if [[ ${result} -ne 0 ]]; then
395 + die "emake test failed"
396 + fi
397 +}
398 +
399 +src_install() {
400 + local libdir=${ED}/usr/lib/python${PYVER}
401 +
402 + emake DESTDIR="${D}" altinstall
403 +
404 + if use aqua ; then
405 + # avoid config.status to be triggered
406 + find Mac -name "Makefile" -exec touch \{\} + || die
407 +
408 + # Python_Launcher is kind of a wrapper, and we should fix it for
409 + # Prefix (it uses /usr/bin/pythonw) so useless
410 + # IDLE doesn't run, no idea, but definitely not used
411 + emake DESTDIR="${D}" -C Mac install_Python || die
412 + rmdir "${ED}"/Applications/Python* || die
413 + rmdir "${ED}"/Applications || die
414 +
415 + local fwdir=/Frameworks/Python.framework/Versions/${PYVER}
416 + ln -s "${EPREFIX}"/usr/include/python${PYVER} \
417 + "${ED}${fwdir}"/Headers || die
418 + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \
419 + "${ED}${fwdir}"/Python || die
420 + fi
421 +
422 + # Remove static library
423 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
424 +
425 + # Fix collisions between different slots of Python.
426 + rm "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die
427 +
428 + # Cheap hack to get version with ABIFLAGS
429 + local abiver=$(cd "${ED}/usr/include"; echo python*)
430 + if [[ ${abiver} != python${PYVER} ]]; then
431 + # Replace python3.X with a symlink to python3.Xm
432 + rm "${ED}/usr/bin/python${PYVER}" || die
433 + dosym "${abiver}" "/usr/bin/python${PYVER}"
434 + # Create python3.X-config symlink
435 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
436 + # Create python-3.5m.pc symlink
437 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
438 + fi
439 +
440 + # python seems to get rebuilt in src_install (bug 569908)
441 + # Work around it for now.
442 + if has_version dev-libs/libffi[pax-kernel]; then
443 + pax-mark E "${ED}/usr/bin/${abiver}"
444 + else
445 + pax-mark m "${ED}/usr/bin/${abiver}"
446 + fi
447 +
448 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
449 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
450 +
451 + dodoc Misc/{ACKS,HISTORY,NEWS}
452 +
453 + if use examples; then
454 + docinto examples
455 + find Tools -name __pycache__ -exec rm -fr {} + || die
456 + dodoc -r Tools
457 + fi
458 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
459 + if use aqua ; then
460 + # we do framework, so the emake trick below returns a pathname
461 + # since that won't work here, use a (cheap) trick instead
462 + local libname=libpython${PYVER}
463 + else
464 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
465 + emake --no-print-directory -s -f - 2>/dev/null)
466 + fi
467 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
468 +
469 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
470 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
471 + sed \
472 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
473 + -e "s:@PYDOC@:pydoc${PYVER}:" \
474 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
475 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
476 +
477 + local -x EPYTHON=python${PYVER}
478 + # if not using a cross-compiler, use the fresh binary
479 + if ! tc-is-cross-compiler; then
480 + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
481 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
482 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD}
483 + else
484 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
485 + fi
486 +
487 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
488 + python_domodule epython.py
489 +
490 + # python-exec wrapping support
491 + local pymajor=${PYVER%.*}
492 + local scriptdir=${D}$(python_get_scriptdir)
493 + mkdir -p "${scriptdir}" || die
494 + # python and pythonX
495 + ln -s "../../../bin/${abiver}" \
496 + "${scriptdir}/python${pymajor}" || die
497 + ln -s "python${pymajor}" "${scriptdir}/python" || die
498 + # python-config and pythonX-config
499 + # note: we need to create a wrapper rather than symlinking it due
500 + # to some random dirname(argv[0]) magic performed by python-config
501 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
502 + #!/bin/sh
503 + exec "${abiver}-config" "\${@}"
504 + EOF
505 + chmod +x "${scriptdir}/python${pymajor}-config" || die
506 + ln -s "python${pymajor}-config" \
507 + "${scriptdir}/python-config" || die
508 + # 2to3, pydoc
509 + ln -s "../../../bin/2to3-${PYVER}" \
510 + "${scriptdir}/2to3" || die
511 + ln -s "../../../bin/pydoc${PYVER}" \
512 + "${scriptdir}/pydoc" || die
513 + # idle
514 + if use tk; then
515 + ln -s "../../../bin/idle${PYVER}" \
516 + "${scriptdir}/idle" || die
517 + fi
518 +}