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: Sun, 31 May 2020 12:04:29
Message-Id: 1590926652.0e0f409938e32bf6c6a58177cfc82bccb890a37e.grobian@gentoo
1 commit: 0e0f409938e32bf6c6a58177cfc82bccb890a37e
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun May 31 12:04:12 2020 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun May 31 12:04:12 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=0e0f4099
7
8 dev-lang/python-3.7.7-r2: bump/sync with gx86
9
10 Package-Manager: Portage-2.3.84-prefix, Repoman-2.3.22
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 dev-lang/python/Manifest | 3 +
14 dev-lang/python/python-3.7.7-r2.ebuild | 442 +++++++++++++++++++++++++++++++++
15 2 files changed, 445 insertions(+)
16
17 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
18 index 88335e2d49..4cef695d57 100644
19 --- a/dev-lang/python/Manifest
20 +++ b/dev-lang/python/Manifest
21 @@ -1,12 +1,15 @@
22 DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 7d6b5b853f9974d44e04dd35ecdffaab87511e183b4b01dd4f8f4ee109c4b4ab208f045708f69717be9d3a706aa078b71438ed482c062c0b89c12730eae074ae SHA512 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0
23 DIST Python-3.6.8.tar.xz 17212420 BLAKE2B e104b49a35492b622080ab81a446c0cdd1223e8ddf95c4e1b262762a027664b59f3e4deeda4ba7177115d780e48b6764a053acef640a645327df428d2e4820cd SHA512 b17867e451ebe662f50df83ed112d3656c089e7d750651ea640052b01b713b58e66aac9e082f71fd16f5b5510bc9b797f5ccd30f5399581e9aa406197f02938a
24 DIST Python-3.7.2.tar.xz 17042320 BLAKE2B 79b06b7d38590b7ad00850a4323156bfee07c4cf8531cbc09d262c6eb38721e32b8b0591fc21017e56948dd81763e9061f118f204eda5b9cc0b84e7132b42979 SHA512 6cd2d6d8455558783b99d55985cd7b22d67b98f41a09b4fdd96f680a630a4e035220d2b903f8c59ed513aa5ffe6730fa947ddb55bb72ce36f0e945ef8af5d971
25 +DIST Python-3.7.7.tar.xz 17268888 BLAKE2B 5f16c9559249470a9e6c0aa686965e7d78ce0f7364b5d03fc9590613c7a5456f92835340e49bf9becbec18b18d1e5a6fc318b6e30f2349da3246a918cf8b05ff SHA512 ddc838a7b0c442c2e465616f20231f2b703ed6b69ed2dc17858aac8760814fdf7cff43d350d359300e47b6bb1f0bd38c31126b855e423a3a65ed06a8fa16d136
26 DIST python-gentoo-patches-2.7.16.tar.xz 13904 BLAKE2B 218b46f8656f4a792dcd47eabca6d59a1558276b77676544991ee75914cd76dda84c36f43e72e477b850dd4cb52374d289f20dccd244a3b52ae5debaf3363432 SHA512 83f90545231c663a34c6925352a357a2b15997ac0362578a1893304c5070b5251922585ae8bc1bafb68d306bcddd4cdba4b6406648d473bd3e980eef65fe3ecd
27 DIST python-gentoo-patches-3.6.8.tar.xz 11224 BLAKE2B 5fe38282bcf28df18e0bd37756c880ae191ea738dc92f1cf83f682cfdc52525b9c44287dc99191a73d75c90672ab501b56adf49515b35ff1fdee88c8dc07b175 SHA512 89e700663db25d6d78eee1d4bfdab686c5341a794062f3a63df3485ac0b58deb4b4885d24701f3ae138d06ca783be92e310e1100c6d633910c33732f3cb0d7df
28 DIST python-gentoo-patches-3.7.2.tar.xz 9776 BLAKE2B fe451c3fb44a1ace4489d1bc68db9848b4227422fe9135659594248d057a8916e2abfe8e2677ef6efc9c962dbefe3ca7cd05cbd62b325d53eef6b05928f82017 SHA512 55e932624333b78b55e8981aaa7e7bfbddb635a61f594353a77a6bd5c2b57de31a4ee9ae04e072c4e2eb0fddd1c2702b4bd6133cf0a2c94ab35808df86550156
29 +DIST python-gentoo-patches-3.7.7.tar.xz 14644 BLAKE2B 1a377eac945310082ec9fa257bcb406c7eaf24b5e80469dd49e82a1bc0554b75394678609cae447cb0fc7a19059b29166bf110b6ed99a89a9919b3a56a323f87 SHA512 2c7fbcefd6f4d1674b78f3b67f2be3f1b168e08c318fefe8d4757f2d30c22477f5010ad6f2c0abb265d819ee667617f21f93e002242e216b4ee570200b0ddf74
30 DIST python-prefix-2.7.16-gentoo-patches-r0.tar.xz 14636 BLAKE2B 54320f5197bb7adeca1e7c97447253e6535a11f380b6d66bc2ce46fa671fe23697aced8fd5619633a00e3ea19ae9dbc3ffe2981173d83dcab6b447d514555c43 SHA512 5380d9b92eb81603ec4d60ff9c940a3a061c06bd6f593d5837e600da5d4417b529d20d98d758aa95cef18fac10bdb5c33f90fa943deb15fdaf048492cf286581
31 DIST python-prefix-3.6.8-gentoo-patches-r0.tar.xz 12732 BLAKE2B 82c91f451aff1dcda6182dfc05f5566261d5ffa36bbf5527931a442e46563220884ca1fb192a7226411f5e0f7c59f347f6f1ed1ffa34aec0eb5208b22cc3f756 SHA512 e52587d5c9169b75f79e942cf5bbade9e499335f7e242ec262bc678e136f1d857803d4a8cb9630fdb8847ea1ab4c293aebf2d498e630984accea48ee0c3723f5
32 DIST python-prefix-3.7.2-gentoo-patches-r0.tar.xz 12568 BLAKE2B 1894b4a6081c8c6184ed10d405f7d320a25978f5c94be6b43d83a62afb125162fc2b12c4b06552a90bd92866a9a00b259f6c4894b41e1918c5315639b3866771 SHA512 cd2f6cfd65464ebdda7629ce2ff3e204c645bfa05dcecfe9cf02327049733366e069f1cd1291e6733946ad592a7dcd1d4a67877e96a1f41e232a01561b269c95
33 +DIST python-prefix-gentoo-3.7.7-patches-r1.tar.xz 12812 BLAKE2B 140b5621ac9fcdaf99dd11258d371ecb72a4ee69e17c4e835c49fd60352dc50d3547f3ebc3cd2030906e83bad1b337b0965b15c6250b774ff1f03a2cefde2f6a SHA512 28501546d94b30af3bf664abfef908dce0c48398a6ebac6976697ae0b04d05148d93e4c03aaba8ee3aa6660a7c8b9cf1c3321acc308d5f1b54f548fb9aa1a01f
34 DIST python2-cygwinports-7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 BLAKE2B 85803bc1677bd16650cb5fc4a2c54fdac0228326f25cfba4fcd098ac9d689312d3e0dde6fca57f720d5235361d6462461cf018325c23fda9139e0f1683055aff SHA512 cabc21d2d7379daf1f4bafe7ab00b70e5b4f707d3102496b96ff0dfdced26347097ad771c69e0b9488b7c54b1ef36f9bc019bee72f1ffcbb55dcd0e71095edfe
35 DIST python36-cygwinports-f11d606e98b00f5b143cba92bfee8b7f5ba779b0.zip 15874 BLAKE2B 4d6759dfa7afef796abb25dac94a8dac955638960c0335b0be59d88438d9ac3c1fa3e6e51280ff0ac8f30a77f7129f4d784791f84de80bd5fb57fde3e11fa0e8 SHA512 5d0a286a9444019d70a831432794a3d44ea981f141c327118679c1f16e694525b7d469138b174f1afe02ce069fc8d8ec5be0c924faab04ec24e9f35ab453acc2
36 DIST python37-cygwinports-941cf340422fe6da6dc48756c1bcbadd7da58f9d.tar.gz 7945 BLAKE2B 6e6ea4d9ca97b04f1a6b17bf40c2f28d2f1d47b093d85f5989e89a09758719e9ca148254ffbe2053dd551b998e5e510f256cce7870c196e37378c9f8a6d5bc86 SHA512 9b79962aed79af742c242c82ddd900cbabd6727d365e107fa3106fd63e169944424819037ee0f7c72898f09c853308572813f31da3c920a2be244c8d53c00769
37
38 diff --git a/dev-lang/python/python-3.7.7-r2.ebuild b/dev-lang/python/python-3.7.7-r2.ebuild
39 new file mode 100644
40 index 0000000000..fda0bcec10
41 --- /dev/null
42 +++ b/dev-lang/python/python-3.7.7-r2.ebuild
43 @@ -0,0 +1,442 @@
44 +# Copyright 1999-2020 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 flag-o-matic pax-utils python-utils-r1 toolchain-funcs
51 +
52 +MY_P="Python-${PV}"
53 +PYVER=$(ver_cut 1-2)
54 +PATCHSET="python-gentoo-patches-3.7.7"
55 +PREFIX_PATCHSET="python-prefix-gentoo-3.7.7-patches-r1"
56 +CYGWINPORTS_GITREV="941cf340422fe6da6dc48756c1bcbadd7da58f9d"
57 +
58 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
59 +HOMEPAGE="https://www.python.org/"
60 +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
61 + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
62 + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz"
63 +[[ -n ${CYGWINPORTS_GITREV} ]] &&
64 +SRC_URI+=" elibc_Cygwin? (
65 + https://github.com/cygwinports/python37/archive/${CYGWINPORTS_GITREV}.tar.gz
66 + -> python37-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )"
67 +S="${WORKDIR}/${MY_P}"
68 +
69 +LICENSE="PSF-2"
70 +SLOT="${PYVER}/${PYVER}m"
71 +KEYWORDS="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
72 +IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test tk wininst +xml"
73 +RESTRICT="!test? ( test )"
74 +
75 +# Do not add a dependency on dev-lang/python to this ebuild.
76 +# If you need to apply a patch which requires python for bootstrapping, please
77 +# run the bootstrap code on your dev box and include the results in the
78 +# patchset. See bug 447752.
79 +
80 +RDEPEND="app-arch/bzip2:=
81 + app-arch/xz-utils:=
82 + dev-libs/libffi:=
83 + kernel_linux? ( sys-apps/util-linux:= )
84 + >=sys-libs/zlib-1.1.3:=
85 + virtual/libcrypt:=
86 + virtual/libintl
87 + gdbm? ( sys-libs/gdbm:=[berkdb] )
88 + ncurses? ( >=sys-libs/ncurses-5.2:= )
89 + readline? ( >=sys-libs/readline-4.1:= )
90 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
91 + ssl? (
92 + !libressl? ( dev-libs/openssl:= )
93 + libressl? ( dev-libs/libressl:= )
94 + )
95 + tk? (
96 + >=dev-lang/tcl-8.0:=
97 + >=dev-lang/tk-8.0:=
98 + dev-tcltk/blt:=
99 + dev-tcltk/tix
100 + )
101 + xml? ( >=dev-libs/expat-2.1:= )"
102 +# bluetooth requires headers from bluez
103 +DEPEND="${RDEPEND}
104 + bluetooth? ( net-wireless/bluez )
105 + test? ( app-arch/xz-utils[extra-filters(+)] )
106 + virtual/pkgconfig
107 + !sys-devel/gcc[libffi(-)]"
108 +RDEPEND+=" !build? ( app-misc/mime-types )"
109 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
110 +
111 +src_prepare() {
112 + # Ensure that internal copies of expat, libffi and zlib are not used.
113 + rm -fr Modules/expat || die
114 + rm -fr Modules/_ctypes/libffi* || die
115 + rm -fr Modules/zlib || die
116 +
117 + local PATCHES=(
118 + "${WORKDIR}/${PATCHSET}"
119 + # Prefix' round of patches
120 + "${WORKDIR}"/${PREFIX_PATCHSET}
121 + )
122 +
123 + [[ ${CHOST} != *mint* ]] \
124 + && rm "${WORKDIR}"/${PREFIX_PATCHSET}/*_m68k-mint_*
125 +
126 + default
127 +
128 + if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
129 + local p d="${WORKDIR}/python37-${CYGWINPORTS_GITREV}"
130 + for p in $(
131 + sed -ne '/PATCH_URI="/,/"/{s/.*="//;s/".*$//;p}' \
132 + < "${d}/python3.cygport"
133 + ); do
134 + # dropped by 01_all_prefix-no-patch-invention.patch
135 + [[ ${p} == *-tkinter-* ]] && continue
136 + eapply "${d}/${p}"
137 + done
138 + fi
139 +
140 + # we provide a fully working readline also on Darwin, so don't force
141 + # usage of less functional libedit
142 + sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
143 +
144 + # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
145 + sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
146 +
147 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
148 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
149 +
150 + # workaround a development build env problem and muck around
151 + # framework install to get the best of both worlds (non-standard)
152 + sed -i \
153 + -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
154 + -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
155 + configure.ac configure || die
156 + sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
157 +
158 + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets
159 + # miscompiled when optimisation is being used
160 + if [[ ${CHOST} == powerpc*-darwin* ]] && \
161 + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ;
162 + then
163 + sed -i \
164 + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die
165 + fi
166 +
167 + # Darwin 9's kqueue seems to act up (at least at this stage), so
168 + # make Python's selectors resort to poll() or select()
169 + if [[ ${CHOST} == powerpc*-darwin* ]] ; then
170 + sed -i \
171 + -e 's/KQUEUE/KQUEUE_DISABLED/' \
172 + configure.ac configure || die
173 + fi
174 +
175 + eautoreconf
176 +}
177 +
178 +src_configure() {
179 + local disable
180 + # disable automagic bluetooth headers detection
181 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
182 + use gdbm || disable+=" gdbm"
183 + use ncurses || disable+=" _curses _curses_panel"
184 + use readline || disable+=" readline"
185 + use sqlite || disable+=" _sqlite3"
186 + use ssl || export PYTHON_DISABLE_SSL="1"
187 + use tk || disable+=" _tkinter"
188 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
189 + export PYTHON_DISABLE_MODULES="${disable}"
190 +
191 + if ! use xml; then
192 + ewarn "You have configured Python without XML support."
193 + ewarn "This is NOT a recommended configuration as you"
194 + ewarn "may face problems parsing any XML documents."
195 + fi
196 +
197 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
198 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
199 + fi
200 +
201 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
202 + append-flags -fwrapv
203 + fi
204 +
205 + filter-flags -malign-double
206 +
207 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
208 + if is-flagq -O3; then
209 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
210 + use hardened && replace-flags -O3 -O2
211 + fi
212 +
213 + # Export CC so even AIX will use gcc instead of xlc_r.
214 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
215 + tc-export CC CXX
216 +
217 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
218 + # Needed on FreeBSD unless Python 3.2 is already installed.
219 + # Please query BSD team before removing this!
220 + append-ldflags "-L."
221 +
222 + # Fix implicit declarations on cross and prefix builds. Bug #674070.
223 + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
224 + use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib
225 +
226 + local dbmliborder
227 + if use gdbm; then
228 + dbmliborder+="${dbmliborder:+:}gdbm"
229 + fi
230 +
231 + if use aqua ; then
232 + ECONF_SOURCE="${S}" OPT="" \
233 + econf \
234 + --enable-framework="${EPREFIX}"/usr/lib \
235 + --config-cache
236 + fi
237 +
238 + local myeconfargs=(
239 + # glibc-2.30 removes it; since we can't cleanly force-rebuild
240 + # Python on glibc upgrade, remove it proactively to give
241 + # a chance for users rebuilding python before glibc
242 + # except on non-glibc systems this breaks the build, so be
243 + # conservative!
244 + $(use elibc_glibc && echo ac_cv_header_stropts_h=no)
245 +
246 + $(use aqua && echo --config-cache)
247 + --enable-shared
248 + $(use_enable ipv6)
249 + --infodir='${prefix}/share/info'
250 + --mandir='${prefix}/share/man'
251 + --with-computed-gotos
252 + --with-dbmliborder="${dbmliborder}"
253 + --with-libc=
254 + --enable-loadable-sqlite-extensions
255 + --without-ensurepip
256 + --with-system-expat
257 + --with-system-ffi
258 + )
259 +
260 + OPT="" econf "${myeconfargs[@]}"
261 +}
262 +
263 +src_compile() {
264 + # Ensure sed works as expected
265 + # https://bugs.gentoo.org/594768
266 + local -x LC_ALL=C
267 +
268 + emake CPPFLAGS= CFLAGS= LDFLAGS=
269 +
270 + # Work around bug 329499. See also bug 413751 and 457194.
271 + if has_version dev-libs/libffi[pax_kernel]; then
272 + pax-mark E python
273 + else
274 + pax-mark m python
275 + fi
276 +}
277 +
278 +src_test() {
279 + # Tests will not work when cross compiling.
280 + if tc-is-cross-compiler; then
281 + elog "Disabling tests due to crosscompiling."
282 + return
283 + fi
284 +
285 + # Skip failing tests.
286 + local skipped_tests="gdb"
287 +
288 + for test in ${skipped_tests}; do
289 + mv "${S}"/Lib/test/test_${test}.py "${T}"
290 + done
291 +
292 + # bug 660358
293 + local -x COLUMNS=80
294 +
295 + local -x PYTHONDONTWRITEBYTECODE=
296 +
297 + emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
298 + local result=$?
299 +
300 + for test in ${skipped_tests}; do
301 + mv "${T}/test_${test}.py" "${S}"/Lib/test
302 + done
303 +
304 + elog "The following tests have been skipped:"
305 + for test in ${skipped_tests}; do
306 + elog "test_${test}.py"
307 + done
308 +
309 + elog "If you would like to run them, you may:"
310 + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'"
311 + elog "and run the tests separately."
312 +
313 + if [[ ${result} -ne 0 ]]; then
314 + die "emake test failed"
315 + fi
316 +}
317 +
318 +src_install() {
319 + local libdir=${ED}/usr/lib/python${PYVER}
320 +
321 + emake DESTDIR="${D}" altinstall
322 +
323 + if use aqua ; then
324 + # avoid config.status to be triggered
325 + find Mac -name "Makefile" -exec touch \{\} + || die
326 +
327 + # Python_Launcher is kind of a wrapper, and we should fix it for
328 + # Prefix (it uses /usr/bin/pythonw) so useless
329 + # IDLE doesn't run, no idea, but definitely not used
330 + emake DESTDIR="${D}" -C Mac install_Python || die
331 + rmdir "${ED}"/Applications/Python* || die
332 + rmdir "${ED}"/Applications || die
333 +
334 + local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER}
335 + ln -s "${EPREFIX}"/usr/include/python${PYVER} \
336 + "${ED}${fwdir}"/Headers || die
337 + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \
338 + "${ED}${fwdir}"/Python || die
339 + fi
340 +
341 + # Remove static library
342 + rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
343 +
344 + if use elibc_Cygwin; then
345 + # We may recreate symlinks, but without any .exe extension. Cygwin
346 + # can resolv either without it, so just drop .exe from shebangs:
347 + sed -i -e '1s/\.exe//' "$ED"/usr/bin/* || die
348 + fi
349 +
350 + sed \
351 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
352 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
353 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
354 +
355 + # Fix collisions between different slots of Python.
356 + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die
357 +
358 + # Cheap hack to get version with ABIFLAGS
359 + local abiver=$(cd "${ED}/usr/include"; echo python*)
360 + if [[ ${abiver} != python${PYVER} ]]; then
361 + # Replace python3.X with a symlink to python3.Xm
362 + rm "${ED}/usr/bin/python${PYVER}" || die
363 + dosym "${abiver}" "/usr/bin/python${PYVER}"
364 + # Create python3.X-config symlink
365 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
366 + # Create python-3.5m.pc symlink
367 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
368 + fi
369 +
370 + # python seems to get rebuilt in src_install (bug 569908)
371 + # Work around it for now.
372 + if has_version dev-libs/libffi[pax_kernel]; then
373 + pax-mark E "${ED}/usr/bin/${abiver}"
374 + else
375 + pax-mark m "${ED}/usr/bin/${abiver}"
376 + fi
377 +
378 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
379 + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
380 +
381 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
382 +
383 + dodoc Misc/{ACKS,HISTORY,NEWS}
384 +
385 + if use examples; then
386 + docinto examples
387 + find Tools -name __pycache__ -exec rm -fr {} + || die
388 + dodoc -r Tools
389 + fi
390 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
391 + if use aqua ; then
392 + # we do framework, so the emake trick below returns a pathname
393 + # since that won't work here, use a (cheap) trick instead
394 + local libname=libpython${PYVER}
395 + else
396 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
397 + emake --no-print-directory -s -f - 2>/dev/null)
398 + fi
399 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
400 +
401 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
402 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
403 + sed \
404 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
405 + -e "s:@PYDOC@:pydoc${PYVER}:" \
406 + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
407 + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
408 +
409 + local -x EPYTHON=python${PYVER}
410 + # if not using a cross-compiler, use the fresh binary
411 + if ! tc-is-cross-compiler; then
412 + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
413 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
414 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD}
415 + else
416 + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON}
417 + fi
418 +
419 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
420 + python_domodule epython.py
421 +
422 + # python-exec wrapping support
423 + local pymajor=${PYVER%.*}
424 + local scriptdir=${D}$(python_get_scriptdir)
425 + mkdir -p "${scriptdir}" || die
426 + # python and pythonX
427 + ln -s "../../../bin/${abiver}" \
428 + "${scriptdir}/python${pymajor}" || die
429 + ln -s "python${pymajor}" "${scriptdir}/python" || die
430 + # python-config and pythonX-config
431 + # note: we need to create a wrapper rather than symlinking it due
432 + # to some random dirname(argv[0]) magic performed by python-config
433 + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
434 + #!/bin/sh
435 + exec "${abiver}-config" "\${@}"
436 + EOF
437 + chmod +x "${scriptdir}/python${pymajor}-config" || die
438 + ln -s "python${pymajor}-config" \
439 + "${scriptdir}/python-config" || die
440 + # 2to3, pydoc, pyvenv
441 + ln -s "../../../bin/2to3-${PYVER}" \
442 + "${scriptdir}/2to3" || die
443 + ln -s "../../../bin/pydoc${PYVER}" \
444 + "${scriptdir}/pydoc" || die
445 + ln -s "../../../bin/pyvenv-${PYVER}" \
446 + "${scriptdir}/pyvenv" || die
447 + # idle
448 + if use tk; then
449 + ln -s "../../../bin/idle${PYVER}" \
450 + "${scriptdir}/idle" || die
451 + fi
452 +}
453 +
454 +pkg_preinst() {
455 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
456 + python_updater_warning="1"
457 + fi
458 +}
459 +
460 +eselect_python_update() {
461 + if [[ -z "$(eselect python show)" || \
462 + ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
463 + eselect python update
464 + fi
465 +
466 + if [[ -z "$(eselect python show --python${PV%%.*})" || \
467 + ! -f "${EROOT}/usr/bin/$(eselect python show --python${PV%%.*})" ]]
468 + then
469 + eselect python update --python${PV%%.*}
470 + fi
471 +}
472 +
473 +pkg_postinst() {
474 + eselect_python_update
475 +
476 + if [[ "${python_updater_warning}" == "1" ]]; then
477 + ewarn "You have just upgraded from an older version of Python."
478 + ewarn
479 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
480 + fi
481 +}
482 +
483 +pkg_postrm() {
484 + eselect_python_update
485 +}