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