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