Gentoo Archives: gentoo-commits

From: Michael Haubenwallner <haubi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: dev-lang/python/
Date: Thu, 14 Feb 2019 17:00:47
Message-Id: 1550163591.87737d08c50db52ba1abbf7c363182d31f0f05ba.haubi@gentoo
1 commit: 87737d08c50db52ba1abbf7c363182d31f0f05ba
2 Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 14 16:59:44 2019 +0000
4 Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 14 16:59:51 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=87737d08
7
8 dev-lang/python: sync 3.6.6
9
10 Disabling ABIFLAGS is long gone in gentoo repo, to align with upstream
11 and other distros. While --without-pymalloc would omit the 'm' abi
12 flag, this breaks 'import ctypes' on Cygwin. However, bug#452720 is
13 handled differently now, so this is not a problem any more.
14 Not changing 3.6.5 in hope for less breakage, yet that one's patches
15 still apply to 3.6.6.
16 Bug: https://bugs.gentoo.org/452720
17 Package-Manager: Portage-2.3.55.1-prefix, Repoman-2.3.12
18
19 Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>
20
21 dev-lang/python/Manifest | 2 +
22 dev-lang/python/python-3.6.6.ebuild | 427 ++++++++++++++++++++++++++++++++++++
23 2 files changed, 429 insertions(+)
24
25 diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
26 index 22f367d1dd..88425522f7 100644
27 --- a/dev-lang/python/Manifest
28 +++ b/dev-lang/python/Manifest
29 @@ -5,11 +5,13 @@ DIST Python-3.4.8.tar.xz 14576444 BLAKE2B 262b82fbc0e4852216d2edf05f9e9194bc93be
30 DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61 SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
31 DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22
32 DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
33 +DIST Python-3.6.6.tar.xz 17156744 BLAKE2B fa4333149f84570cc4a0d1ec76c819610888750a51268b9db7d05df7d9c11e5ed72daff5d81b404015d9c678cb034d8a32034262ce73629ee8f96772853a706c SHA512 c71f87c5906e770322a14cacad228655659f782207db826320449d12bf86091c3662f317e1773158dec52f8b052eaedfb4c03b561cc2a6cfcd381597fd2d2b04
34 DIST f11d606e98b00f5b143cba92bfee8b7f5ba779b0.zip 15834 BLAKE2B 4d9febb5605fbdefde672efdd5680792c627f4d04ace02f3cec76d152569af94f6daded47c8406405694e8cff1ebab396196f1eee9f8d6a9849ce0f899d16628 SHA512 ab009e9c1ad4c44d00d87cf3216ae4bf44008a45be612a0887c82426fe9b3d9bce7769bcba2a3e7e693606470342d87318ee8c054bfbf8ad81a429b591f775f1
35 DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
36 DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06 SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
37 DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 BLAKE2B 4a7d71feff18c7c8c109bed10748348484d314183c3de3ec950d5ca5ce7048bb322c470f3f5bff2d63eb7f2ed99c0fe75c621df050273d9d118681b28926061d SHA512 d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec
38 DIST python-gentoo-patches-3.6.4.tar.xz 12888 BLAKE2B 7cf49ae22df53e855f2e99df51686b5d4bd0da82ef4c22836e24726ea9ed561808352c0305a5659b052d38b843f1ff61b6466a7bc3673b7e5cfb4d81d22fa4bc SHA512 90a1b685f2539872ffd67f96581f70145b7afaf18af19f4a7f4a61214103d2a10bf0069c1769dac229ae011fceaf8538f041082b33c1671905246d018d184dd7
39 +DIST python-gentoo-patches-3.6.6.tar.xz 13876 BLAKE2B 4be56b54e70c9b83209734097e03a7dbaa8f46ae13e268fc6a7f465ffd052ce03ca9e1fc45f1d432f2de17d4ce16ca8bc684b24344862cd8f52f9d1a90d90b7a SHA512 534b9eaefcbc45908119852a103bf10e400a8628c66aa599812fbceda36810d626d33e6701d1b7866e4df68397f717df6a217cb414049ca6f378eff9f43a27ab
40 DIST python-prefix-2.7.14-gentoo-patches-r0.tar.xz 14736 BLAKE2B 75422fc7390f559d9864f6e22a0b85982ccbdb07d5f2507db8e528285e56d1f11d4bc0b21a0b78d5340eafd562220d2f1b9d0a78b1f7c811c5689a426a81f9f3 SHA512 bf8e5039fff834d03a5a671269905f1ea10961995f2327ea023f6ad4d9b49bf210ec746ac6f45a01ff7501f1eb616013951d164410f6c64bce04df0e8b9715c8
41 DIST python-prefix-3.4.8-gentoo-patches-r0.tar.xz 12928 BLAKE2B d270f27485a70b4186c0d509836f66e6ae8218270cbb0a473b4579de7a8d9fa16eb2387d0441979aa62fc88e54a52f863c58d91b3df64dd6a40ad4bc4236cbb2 SHA512 84554d2b320922d7ac6e20012f847a81d6501693a4d9f2146faa8764fca4fbc5e3bf1c0f352853f1ab34ed905ab13097f2e82285ada54c9b4e219e72b39804c2
42 DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 BLAKE2B ab0cbc5430e9588f71cfd7b001a07f9a77097262f17e1f980e3945e39855e1c9437117bf4eb2d424dadf701d37d025e09627d7efdbb9f8867714039f62f261a7 SHA512 334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5
43
44 diff --git a/dev-lang/python/python-3.6.6.ebuild b/dev-lang/python/python-3.6.6.ebuild
45 new file mode 100644
46 index 0000000000..51c4e48b6e
47 --- /dev/null
48 +++ b/dev-lang/python/python-3.6.6.ebuild
49 @@ -0,0 +1,427 @@
50 +# Copyright 1999-2019 Gentoo Authors
51 +# Distributed under the terms of the GNU General Public License v2
52 +
53 +EAPI="6"
54 +WANT_LIBTOOL="none"
55 +
56 +inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs epatch
57 +
58 +MY_P="Python-${PV}"
59 +PATCHSET_VERSION="3.6.6"
60 +PREFIX_PATCHREV="3.6.5-gentoo-patches-r0"
61 +CYGWINPORTS_GITREV="f11d606e98b00f5b143cba92bfee8b7f5ba779b0"
62 +
63 +DESCRIPTION="An interpreted, interactive, object-oriented programming language"
64 +HOMEPAGE="https://www.python.org/"
65 +SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz
66 + https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz
67 + https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PREFIX_PATCHREV}.tar.xz"
68 +
69 +[[ -n ${CYGWINPORTS_GITREV} ]] &&
70 +SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/python3/archive/${CYGWINPORTS_GITREV}.zip )"
71 +
72 +LICENSE="PSF-2"
73 +SLOT="3.6/3.6m"
74 +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"
75 +IUSE="aqua bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl test +threads tk wininst +xml"
76 +RESTRICT="!test? ( test )"
77 +
78 +# Do not add a dependency on dev-lang/python to this ebuild.
79 +# If you need to apply a patch which requires python for bootstrapping, please
80 +# run the bootstrap code on your dev box and include the results in the
81 +# patchset. See bug 447752.
82 +
83 +RDEPEND="app-arch/bzip2:0=
84 + app-arch/xz-utils:0=
85 + >=sys-libs/zlib-1.1.3:0=
86 + virtual/libffi:=
87 + virtual/libintl
88 + gdbm? ( sys-libs/gdbm:0=[berkdb] )
89 + ncurses? ( >=sys-libs/ncurses-5.2:0= )
90 + readline? ( >=sys-libs/readline-4.1:0= )
91 + sqlite? ( >=dev-db/sqlite-3.3.8:3= )
92 + ssl? (
93 + !libressl? ( dev-libs/openssl:0= )
94 + libressl? ( dev-libs/libressl:0= )
95 + )
96 + tk? (
97 + >=dev-lang/tcl-8.0:0=
98 + >=dev-lang/tk-8.0:0=[-aqua]
99 + dev-tcltk/blt:0=
100 + dev-tcltk/tix
101 + )
102 + xml? ( >=dev-libs/expat-2.1:0= )
103 + !!<sys-apps/sandbox-2.6-r1"
104 +# bluetooth requires headers from bluez
105 +DEPEND="${RDEPEND}
106 + bluetooth? ( net-wireless/bluez )
107 + test? ( app-arch/xz-utils[extra-filters(+)] )
108 + virtual/pkgconfig
109 + !sys-devel/gcc[libffi(-)]"
110 +RDEPEND+=" !build? ( app-misc/mime-types )"
111 +PDEPEND=">=app-eselect/eselect-python-20140125-r1"
112 +
113 +[[ -n ${CYGWINPORTS_GITREV} ]] &&
114 +DEPEND+=" elibc_Cygwin? ( app-arch/unzip )"
115 +
116 +S="${WORKDIR}/${MY_P}"
117 +PYVER=${SLOT%/*}
118 +
119 +src_prepare() {
120 + # Ensure that internal copies of expat, libffi and zlib are not used.
121 + rm -fr Modules/expat
122 + rm -fr Modules/_ctypes/libffi*
123 + rm -fr Modules/zlib
124 +
125 + local PATCHES=(
126 + "${WORKDIR}/patches"
127 + )
128 +
129 + default
130 +
131 + # Prefix' round of patches
132 + EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
133 + epatch "${WORKDIR}"/python-prefix-${PREFIX_PATCHREV}
134 +
135 + if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then
136 + local p d="${WORKDIR}/python3-${CYGWINPORTS_GITREV}"
137 + for p in $(
138 + sed -ne '/PATCH_URI="/,/"/{s/.*="//;s/".*$//;p}' \
139 + < "${d}/python3.cygport"
140 + ); do
141 + # dropped by 01_all_prefix-no-patch-invention.patch
142 + [[ ${p} == *-tkinter-* ]] && continue
143 + epatch "${d}/${p}"
144 + done
145 + fi
146 +
147 + # we provide a fully working readline also on Darwin, so don't force
148 + # usage of less functional libedit
149 + sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die
150 +
151 + # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
152 + sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
153 +
154 + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
155 + Lib/distutils/command/install.py \
156 + Lib/distutils/sysconfig.py \
157 + Lib/site.py \
158 + Lib/sysconfig.py \
159 + Lib/test/test_site.py \
160 + Makefile.pre.in \
161 + Modules/Setup.dist \
162 + Modules/getpath.c \
163 + configure.ac \
164 + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
165 +
166 + # workaround a development build env problem and muck around
167 + # framework install to get the best of both worlds (non-standard)
168 + sed -i \
169 + -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
170 + -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
171 + configure.ac configure || die
172 + sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
173 +
174 + eautoreconf
175 +}
176 +
177 +src_configure() {
178 + local disable
179 + # disable automagic bluetooth headers detection
180 + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
181 + use gdbm || disable+=" gdbm"
182 + use ncurses || disable+=" _curses _curses_panel"
183 + use readline || disable+=" readline"
184 + use sqlite || disable+=" _sqlite3"
185 + use ssl || export PYTHON_DISABLE_SSL="1"
186 + use tk || disable+=" _tkinter"
187 + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat.
188 + export PYTHON_DISABLE_MODULES="${disable}"
189 +
190 + if ! use xml; then
191 + ewarn "You have configured Python without XML support."
192 + ewarn "This is NOT a recommended configuration as you"
193 + ewarn "may face problems parsing any XML documents."
194 + fi
195 +
196 + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
197 + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
198 + fi
199 +
200 + if [[ "$(gcc-major-version)" -ge 4 ]]; then
201 + append-flags -fwrapv
202 + fi
203 +
204 + filter-flags -malign-double
205 +
206 + # https://bugs.gentoo.org/show_bug.cgi?id=50309
207 + if is-flagq -O3; then
208 + is-flagq -fstack-protector-all && replace-flags -O3 -O2
209 + use hardened && replace-flags -O3 -O2
210 + fi
211 +
212 + # Export CC so even AIX will use gcc instead of xlc_r.
213 + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
214 + tc-export CC CXX
215 +
216 + # Set LDFLAGS so we link modules with -lpython3.2 correctly.
217 + # Needed on FreeBSD unless Python 3.2 is already installed.
218 + # Please query BSD team before removing this!
219 + append-ldflags "-L."
220 +
221 + # make sure setup.py considers Prefix' paths before system ones
222 + use prefix && append-cppflags -I"${EPREFIX}"/usr/include
223 + use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib
224 +
225 + local dbmliborder
226 + if use gdbm; then
227 + dbmliborder+="${dbmliborder:+:}gdbm"
228 + fi
229 +
230 + if use aqua ; then
231 + ECONF_SOURCE="${S}" OPT="" \
232 + econf \
233 + --enable-framework="${EPREFIX}"/usr/lib \
234 + --config-cache
235 + fi
236 +
237 + local myeconfargs=(
238 + $(use aqua && echo --config-cache) \
239 + $(use_with !elibc_Cygwin fpectl)
240 + --enable-shared
241 + $(use_enable ipv6)
242 + $(use_with threads)
243 + --infodir='${prefix}/share/info'
244 + --mandir='${prefix}/share/man'
245 + --with-computed-gotos
246 + --with-dbmliborder="${dbmliborder}"
247 + --with-libc=
248 + --enable-loadable-sqlite-extensions
249 + --without-ensurepip
250 + --with-system-expat
251 + --with-system-ffi
252 + )
253 +
254 + OPT="" econf "${myeconfargs[@]}"
255 +
256 + if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then
257 + eerror "configure has detected that the sem_open function is broken."
258 + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777."
259 + die "Broken sem_open function (bug 496328)"
260 + fi
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/$(get_libdir)/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/$(get_libdir)/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 + sed \
342 + -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
343 + -e "s/\(PY_LDFLAGS=\).*/\1/" \
344 + -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
345 +
346 + # Fix collisions between different slots of Python.
347 + rm -f "${ED}usr/$(get_libdir)/libpython3.so"
348 +
349 + # Cheap hack to get version with ABIFLAGS
350 + local abiver=$(cd "${ED}usr/include"; echo python*)
351 + if [[ ${abiver} != python${PYVER} ]]; then
352 + # Replace python3.X with a symlink to python3.Xm
353 + rm "${ED}usr/bin/python${PYVER}" || die
354 + dosym "${abiver}" "/usr/bin/python${PYVER}"
355 + # Create python3.X-config symlink
356 + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config"
357 + # Create python-3.5m.pc symlink
358 + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc"
359 + fi
360 +
361 + # python seems to get rebuilt in src_install (bug 569908)
362 + # Work around it for now.
363 + if has_version dev-libs/libffi[pax_kernel]; then
364 + pax-mark E "${ED}usr/bin/${abiver}"
365 + else
366 + pax-mark m "${ED}usr/bin/${abiver}"
367 + fi
368 +
369 + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die
370 + use tk || rm -r "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
371 +
372 + use threads || rm -r "${libdir}/multiprocessing" || die
373 + use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
374 +
375 + dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
376 +
377 + if use examples; then
378 + insinto /usr/share/doc/${PF}/examples
379 + find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
380 + doins -r "${S}"/Tools
381 + fi
382 + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
383 + if use aqua ; then
384 + # we do framework, so the emake trick below returns a pathname
385 + # since that won't work here, use a (cheap) trick instead
386 + local libname=libpython${PYVER}
387 + else
388 + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
389 + emake --no-print-directory -s -f - 2>/dev/null)
390 + fi
391 + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py
392 +
393 + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
394 + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
395 + sed \
396 + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
397 + -e "s:@PYDOC@:pydoc${PYVER}:" \
398 + -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed"
399 +
400 + # for python-exec
401 + local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR )
402 +
403 + # if not using a cross-compiler, use the fresh binary
404 + if ! tc-is-cross-compiler; then
405 + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile)
406 + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
407 + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD}
408 + else
409 + vars=( PYTHON "${vars[@]}" )
410 + fi
411 +
412 + python_export "python${PYVER}" "${vars[@]}"
413 + echo "EPYTHON='${EPYTHON}'" > epython.py || die
414 + python_domodule epython.py
415 +
416 + # python-exec wrapping support
417 + local pymajor=${PYVER%.*}
418 + mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
419 + # python and pythonX
420 + ln -s "../../../bin/${abiver}" \
421 + "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
422 + ln -s "python${pymajor}" \
423 + "${D}${PYTHON_SCRIPTDIR}/python" || die
424 + # python-config and pythonX-config
425 + # note: we need to create a wrapper rather than symlinking it due
426 + # to some random dirname(argv[0]) magic performed by python-config
427 + cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
428 + #!/bin/sh
429 + exec "${abiver}-config" "\${@}"
430 + EOF
431 + chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
432 + ln -s "python${pymajor}-config" \
433 + "${D}${PYTHON_SCRIPTDIR}/python-config" || die
434 + # 2to3, pydoc, pyvenv
435 + ln -s "../../../bin/2to3-${PYVER}" \
436 + "${D}${PYTHON_SCRIPTDIR}/2to3" || die
437 + ln -s "../../../bin/pydoc${PYVER}" \
438 + "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
439 + ln -s "../../../bin/pyvenv-${PYVER}" \
440 + "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
441 + # idle
442 + if use tk; then
443 + ln -s "../../../bin/idle${PYVER}" \
444 + "${D}${PYTHON_SCRIPTDIR}/idle" || die
445 + fi
446 +}
447 +
448 +pkg_preinst() {
449 + if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
450 + python_updater_warning="1"
451 + fi
452 +}
453 +
454 +eselect_python_update() {
455 + if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then
456 + eselect python update
457 + fi
458 +
459 + if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then
460 + eselect python update --python${PV%%.*}
461 + fi
462 +}
463 +
464 +pkg_postinst() {
465 + eselect_python_update
466 +
467 + if [[ "${python_updater_warning}" == "1" ]]; then
468 + ewarn "You have just upgraded from an older version of Python."
469 + ewarn
470 + ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules."
471 + fi
472 +}
473 +
474 +pkg_postrm() {
475 + eselect_python_update
476 +}