1 |
commit: 6e9d8531e76d1fdfbc97309748756e1430cd5a20 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jul 6 16:10:41 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jul 6 16:11:37 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6e9d8531 |
7 |
|
8 |
dev-lang/python: Backport sqlite and re fixes to 3.11.0_beta3_p1 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
dev-lang/python/Manifest | 1 + |
13 |
dev-lang/python/python-3.11.0_beta3_p1.ebuild | 469 ++++++++++++++++++++++++++ |
14 |
2 files changed, 470 insertions(+) |
15 |
|
16 |
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest |
17 |
index 7b28258b3088..2ba513e0d96f 100644 |
18 |
--- a/dev-lang/python/Manifest |
19 |
+++ b/dev-lang/python/Manifest |
20 |
@@ -16,6 +16,7 @@ DIST python-gentoo-patches-2.7.18_p15.tar.xz 34956 BLAKE2B d173f276dd9c0ce31004d |
21 |
DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2 |
22 |
DIST python-gentoo-patches-3.10.5.tar.xz 8584 BLAKE2B d4a812a33e485b1eae5629e519dca4dc6625b743b07c7f7bbc62562f345d87723ba499893702310b1e96e443d2946e27a8d4971f32ca1125d4827d0d594ccaa6 SHA512 77f0478f7d0491e103857a83a97d6e04a9ec68740a7f9357cbbdd316462e7d98ea8236bd05a30e7556457ece5fbcfa4a7a78a25d4eb12779455ce2bb5b6f30d0 |
23 |
DIST python-gentoo-patches-3.11.0b3.tar.xz 3320 BLAKE2B 588762fe2698a814d0cb89f84620d3ca4754347cb9af4f0eb36429a126ca2386b64594f16621a25e88d518986aad5f3ef3a84d9ce746f58b5cc6d112167c41d1 SHA512 026cb5cc2f3a1b17829fb088ca1dc9af03764a250bebb1fe518a6f7734f731a3f6cc5d83a13b6ca29dd6fa8ca5f0249a7ef0a641b939cd511d05cdc645b9171f |
24 |
+DIST python-gentoo-patches-3.11.0b3_p1.tar.xz 10560 BLAKE2B 4a34de0595490b0e7fcff1761954bfa56f3f82cfdf5a26d739f410e355f9068ccb22a24af0c212543b1288682a9737e4202862c9d4db2f78d08a5a33f80c85e8 SHA512 a0e54b3dd16db8802b93b88ad50bb979b90052a53438fcbf8378288747b627133a492a9071600d7c11163cb9a61c4c80f9b1dd1fc843789aa7507488ff2c1337 |
25 |
DIST python-gentoo-patches-3.8.13.tar.xz 16004 BLAKE2B 5c0c6c9263570a467391e60c324d1dbc1e50ffda9cad1e204df124441b593146f18e5f1529eb7d385b35c5f4b9e597807971b6b66f7f8eef156ad87c9ad32743 SHA512 4ceb831e2d62bd73909b53a3b553b2cd73d08bcf2a1c92b47eaeb1221d40daabcaed14977265bcb265df00b6bf363dbebbd61a62dca4bf6ef40c6b911e980597 |
26 |
DIST python-gentoo-patches-3.8.13_p2.tar.xz 18816 BLAKE2B 8612ca33e5569319c5d1a5a3fb1a81e860bd515bfde656b79f087ccf7020923fbd06b315178bef8630e4c36bb22c27299fe439aadc6a161f1ec93be8778314ee SHA512 be5668a0a4be0a03e61466436973125a3be4f33a61524e4a5c8d86745727cfcae59e5048477887c9f6bfc09727f3aef3652ad47a13a6bf0f1452d3172f1c34dc |
27 |
DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b SHA512 07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91 |
28 |
|
29 |
diff --git a/dev-lang/python/python-3.11.0_beta3_p1.ebuild b/dev-lang/python/python-3.11.0_beta3_p1.ebuild |
30 |
new file mode 100644 |
31 |
index 000000000000..495c081c3261 |
32 |
--- /dev/null |
33 |
+++ b/dev-lang/python/python-3.11.0_beta3_p1.ebuild |
34 |
@@ -0,0 +1,469 @@ |
35 |
+# Copyright 1999-2022 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI="7" |
39 |
+WANT_LIBTOOL="none" |
40 |
+ |
41 |
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ |
42 |
+ python-utils-r1 toolchain-funcs verify-sig |
43 |
+ |
44 |
+MY_PV=${PV/_beta/b} |
45 |
+MY_P="Python-${MY_PV%_p*}" |
46 |
+PYVER=$(ver_cut 1-2) |
47 |
+PATCHSET="python-gentoo-patches-${MY_PV}" |
48 |
+ |
49 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
50 |
+HOMEPAGE=" |
51 |
+ https://www.python.org/ |
52 |
+ https://github.com/python/cpython/ |
53 |
+" |
54 |
+SRC_URI=" |
55 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz |
56 |
+ https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz |
57 |
+ verify-sig? ( |
58 |
+ https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc |
59 |
+ ) |
60 |
+" |
61 |
+S="${WORKDIR}/${MY_P}" |
62 |
+ |
63 |
+LICENSE="PSF-2" |
64 |
+SLOT="${PYVER}" |
65 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
66 |
+IUSE="bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst" |
67 |
+RESTRICT="!test? ( test )" |
68 |
+ |
69 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
70 |
+# If you need to apply a patch which requires python for bootstrapping, please |
71 |
+# run the bootstrap code on your dev box and include the results in the |
72 |
+# patchset. See bug 447752. |
73 |
+ |
74 |
+RDEPEND=" |
75 |
+ app-arch/bzip2:= |
76 |
+ app-arch/xz-utils:= |
77 |
+ app-crypt/libb2 |
78 |
+ >=dev-libs/expat-2.1:= |
79 |
+ dev-libs/libffi:= |
80 |
+ 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? ( |
87 |
+ !libedit? ( >=sys-libs/readline-4.1:= ) |
88 |
+ libedit? ( dev-libs/libedit:= ) |
89 |
+ ) |
90 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
91 |
+ ssl? ( >=dev-libs/openssl-1.1.1:= ) |
92 |
+ tk? ( |
93 |
+ >=dev-lang/tcl-8.0:= |
94 |
+ >=dev-lang/tk-8.0:= |
95 |
+ dev-tcltk/blt:= |
96 |
+ dev-tcltk/tix |
97 |
+ ) |
98 |
+ !!<sys-apps/sandbox-2.21 |
99 |
+" |
100 |
+# bluetooth requires headers from bluez |
101 |
+DEPEND=" |
102 |
+ ${RDEPEND} |
103 |
+ bluetooth? ( net-wireless/bluez ) |
104 |
+ test? ( app-arch/xz-utils[extra-filters(+)] ) |
105 |
+" |
106 |
+# autoconf-archive needed to eautoreconf |
107 |
+BDEPEND=" |
108 |
+ sys-devel/autoconf-archive |
109 |
+ virtual/awk |
110 |
+ virtual/pkgconfig |
111 |
+ verify-sig? ( sec-keys/openpgp-keys-python ) |
112 |
+ !sys-devel/gcc[libffi(-)] |
113 |
+" |
114 |
+RDEPEND+=" |
115 |
+ !build? ( app-misc/mime-types ) |
116 |
+" |
117 |
+if [[ ${PV} != *_alpha* ]]; then |
118 |
+ RDEPEND+=" |
119 |
+ dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] |
120 |
+ " |
121 |
+fi |
122 |
+ |
123 |
+VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc |
124 |
+ |
125 |
+# large file tests involve a 2.5G file being copied (duplicated) |
126 |
+CHECKREQS_DISK_BUILD=5500M |
127 |
+ |
128 |
+QA_PKGCONFIG_VERSION=${PYVER} |
129 |
+ |
130 |
+pkg_pretend() { |
131 |
+ use test && check-reqs_pkg_pretend |
132 |
+} |
133 |
+ |
134 |
+pkg_setup() { |
135 |
+ use test && check-reqs_pkg_setup |
136 |
+} |
137 |
+ |
138 |
+src_unpack() { |
139 |
+ if use verify-sig; then |
140 |
+ verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} |
141 |
+ fi |
142 |
+ default |
143 |
+} |
144 |
+ |
145 |
+src_prepare() { |
146 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
147 |
+ rm -fr Modules/expat || die |
148 |
+ rm -fr Modules/_ctypes/libffi* || die |
149 |
+ rm -fr Modules/zlib || die |
150 |
+ |
151 |
+ local PATCHES=( |
152 |
+ "${WORKDIR}/${PATCHSET}" |
153 |
+ ) |
154 |
+ |
155 |
+ default |
156 |
+ |
157 |
+ # force correct number of jobs |
158 |
+ # https://bugs.gentoo.org/737660 |
159 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
160 |
+ sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die |
161 |
+ sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die |
162 |
+ |
163 |
+ eautoreconf |
164 |
+} |
165 |
+ |
166 |
+src_configure() { |
167 |
+ local disable |
168 |
+ # disable automagic bluetooth headers detection |
169 |
+ use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no |
170 |
+ |
171 |
+ append-flags -fwrapv |
172 |
+ |
173 |
+ filter-flags -malign-double |
174 |
+ |
175 |
+ # https://bugs.gentoo.org/700012 |
176 |
+ if is-flagq -flto || is-flagq '-flto=*'; then |
177 |
+ append-cflags $(test-flags-CC -ffat-lto-objects) |
178 |
+ fi |
179 |
+ |
180 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
181 |
+ # PKG_CONFIG needed for cross. |
182 |
+ tc-export CXX PKG_CONFIG |
183 |
+ |
184 |
+ # Fix implicit declarations on cross and prefix builds. Bug #674070. |
185 |
+ use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw |
186 |
+ |
187 |
+ local dbmliborder |
188 |
+ if use gdbm; then |
189 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
190 |
+ fi |
191 |
+ |
192 |
+ if use pgo; then |
193 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
194 |
+ export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network" |
195 |
+ |
196 |
+ # All of these seem to occasionally hang for PGO inconsistently |
197 |
+ # They'll even hang here but be fine in src_test sometimes. |
198 |
+ # bug #828535 (and related: bug #788022) |
199 |
+ PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc" |
200 |
+ |
201 |
+ if has_version "app-arch/rpm" ; then |
202 |
+ # Avoid sandbox failure (attempts to write to /var/lib/rpm) |
203 |
+ PROFILE_TASK+=" -x test_distutils" |
204 |
+ fi |
205 |
+ fi |
206 |
+ |
207 |
+ local myeconfargs=( |
208 |
+ # glibc-2.30 removes it; since we can't cleanly force-rebuild |
209 |
+ # Python on glibc upgrade, remove it proactively to give |
210 |
+ # a chance for users rebuilding python before glibc |
211 |
+ ac_cv_header_stropts_h=no |
212 |
+ |
213 |
+ --enable-shared |
214 |
+ --without-static-libpython |
215 |
+ --enable-ipv6 |
216 |
+ --infodir='${prefix}/share/info' |
217 |
+ --mandir='${prefix}/share/man' |
218 |
+ --with-computed-gotos |
219 |
+ --with-dbmliborder="${dbmliborder}" |
220 |
+ --with-libc= |
221 |
+ --enable-loadable-sqlite-extensions |
222 |
+ --without-ensurepip |
223 |
+ --with-system-expat |
224 |
+ --with-system-ffi |
225 |
+ --with-platlibdir=lib |
226 |
+ --with-pkg-config=yes |
227 |
+ |
228 |
+ $(use_with lto) |
229 |
+ $(use_enable pgo optimizations) |
230 |
+ $(use_with readline readline "$(usex libedit editline readline)") |
231 |
+ ) |
232 |
+ |
233 |
+ # disable implicit optimization/debugging flags |
234 |
+ local -x OPT= |
235 |
+ # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get |
236 |
+ # propagated to sysconfig for built extensions |
237 |
+ local -x CFLAGS_NODIST=${CFLAGS} |
238 |
+ local -x LDFLAGS_NODIST=${LDFLAGS} |
239 |
+ local -x CFLAGS= LDFLAGS= |
240 |
+ |
241 |
+ if tc-is-cross-compiler ; then |
242 |
+ # We need to build our own Python on CBUILD first, and feed it in. |
243 |
+ # bug #847910 |
244 |
+ local myeconfargs_cbuild=( |
245 |
+ "${myeconfargs[@]}" |
246 |
+ |
247 |
+ # As minimal as possible for the mini CBUILD Python |
248 |
+ # we build just for cross to satisfy --with-build-python. |
249 |
+ --without-lto |
250 |
+ --without-readline |
251 |
+ --disable-optimizations |
252 |
+ ) |
253 |
+ |
254 |
+ myeconfargs+=( |
255 |
+ # Point the imminent CHOST build to the Python we just |
256 |
+ # built for CBUILD. |
257 |
+ --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python |
258 |
+ ) |
259 |
+ |
260 |
+ mkdir "${WORKDIR}"/${P}-${CBUILD} || die |
261 |
+ pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die |
262 |
+ ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" |
263 |
+ |
264 |
+ # Avoid as many dependencies as possible for the cross build. |
265 |
+ cat >> Makefile <<-EOF || die |
266 |
+ MODULE_NIS=disabled |
267 |
+ MODULE__DBM=disabled |
268 |
+ MODULE__GDBM=disabled |
269 |
+ MODULE__DBM=disabled |
270 |
+ MODULE__SQLITE3=disabled |
271 |
+ MODULE__HASHLIB=disabled |
272 |
+ MODULE__SSL=disabled |
273 |
+ MODULE__CURSES=disabled |
274 |
+ MODULE__CURSES_PANEL=disabled |
275 |
+ MODULE_READLINE=disabled |
276 |
+ MODULE__TKINTER=disabled |
277 |
+ MODULE_PYEXPAT=disabled |
278 |
+ MODULE_ZLIB=disabled |
279 |
+ EOF |
280 |
+ |
281 |
+ # Unfortunately, we do have to build this immediately, and |
282 |
+ # not in src_compile, because CHOST configure for Python |
283 |
+ # will check the existence of the --with-build-python value |
284 |
+ # immediately. |
285 |
+ emake |
286 |
+ popd &> /dev/null || die |
287 |
+ fi |
288 |
+ |
289 |
+ econf "${myeconfargs[@]}" |
290 |
+ |
291 |
+ if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
292 |
+ eerror "configure has detected that the sem_open function is broken." |
293 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
294 |
+ die "Broken sem_open function (bug 496328)" |
295 |
+ fi |
296 |
+ |
297 |
+ # force-disable modules we don't want built |
298 |
+ local disable_modules=( |
299 |
+ NIS |
300 |
+ ) |
301 |
+ use gdbm || disable_modules+=( _GDBM _DBM ) |
302 |
+ use sqlite || disable_modules+=( _SQLITE3 ) |
303 |
+ use ssl || disable_modules+=( _HASHLIB _SSL ) |
304 |
+ use ncurses || disable_modules+=( _CURSES _CURSES_PANEL ) |
305 |
+ use readline || disable_modules+=( READLINE ) |
306 |
+ use tk || disable_modules+=( _TKINTER ) |
307 |
+ |
308 |
+ local mod |
309 |
+ for mod in "${disable_modules[@]}"; do |
310 |
+ echo "MODULE_${mod}=disabled" |
311 |
+ done >> Makefile || die |
312 |
+} |
313 |
+ |
314 |
+src_compile() { |
315 |
+ # Ensure sed works as expected |
316 |
+ # https://bugs.gentoo.org/594768 |
317 |
+ local -x LC_ALL=C |
318 |
+ # Prevent using distutils bundled by setuptools. |
319 |
+ # https://bugs.gentoo.org/823728 |
320 |
+ export SETUPTOOLS_USE_DISTUTILS=stdlib |
321 |
+ export PYTHONSTRICTEXTENSIONBUILD=1 |
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.11/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 |
+ # Expects to find skipped tests and fails |
372 |
+ mv "${S}"/Lib/test/test_tools/test_freeze.py "${T}" || die |
373 |
+ |
374 |
+ # bug 660358 |
375 |
+ local -x COLUMNS=80 |
376 |
+ local -x PYTHONDONTWRITEBYTECODE= |
377 |
+ # workaround https://bugs.gentoo.org/775416 |
378 |
+ addwrite /usr/lib/python3.11/site-packages |
379 |
+ |
380 |
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") |
381 |
+ |
382 |
+ emake test EXTRATESTOPTS="-u-network -j${jobs}" \ |
383 |
+ CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
384 |
+ local result=$? |
385 |
+ |
386 |
+ for test in ${skipped_tests}; do |
387 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
388 |
+ done |
389 |
+ |
390 |
+ mv "${T}"/test_freeze.py "${S}"/Lib/test/test_tools/test_freeze.py || die |
391 |
+ |
392 |
+ elog "The following tests have been skipped:" |
393 |
+ for test in ${skipped_tests}; do |
394 |
+ elog "test_${test}.py" |
395 |
+ done |
396 |
+ |
397 |
+ elog "If you would like to run them, you may:" |
398 |
+ elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" |
399 |
+ elog "and run the tests separately." |
400 |
+ |
401 |
+ if [[ ${result} -ne 0 ]]; then |
402 |
+ die "emake test failed" |
403 |
+ fi |
404 |
+} |
405 |
+ |
406 |
+src_install() { |
407 |
+ local libdir=${ED}/usr/lib/python${PYVER} |
408 |
+ |
409 |
+ # -j1 hack for now for bug #843458 |
410 |
+ emake -j1 DESTDIR="${D}" altinstall |
411 |
+ |
412 |
+ # Fix collisions between different slots of Python. |
413 |
+ rm "${ED}/usr/$(get_libdir)/libpython3.so" || die |
414 |
+ |
415 |
+ # Cheap hack to get version with ABIFLAGS |
416 |
+ local abiver=$(cd "${ED}/usr/include"; echo python*) |
417 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
418 |
+ # Replace python3.X with a symlink to python3.Xm |
419 |
+ rm "${ED}/usr/bin/python${PYVER}" || die |
420 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
421 |
+ # Create python3.X-config symlink |
422 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
423 |
+ # Create python-3.5m.pc symlink |
424 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
425 |
+ fi |
426 |
+ |
427 |
+ # python seems to get rebuilt in src_install (bug 569908) |
428 |
+ # Work around it for now. |
429 |
+ if has_version dev-libs/libffi[pax-kernel]; then |
430 |
+ pax-mark E "${ED}/usr/bin/${abiver}" |
431 |
+ else |
432 |
+ pax-mark m "${ED}/usr/bin/${abiver}" |
433 |
+ fi |
434 |
+ |
435 |
+ use sqlite || rm -r "${libdir}/"sqlite3 || die |
436 |
+ use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
437 |
+ |
438 |
+ dodoc Misc/{ACKS,HISTORY,NEWS} |
439 |
+ |
440 |
+ if use examples; then |
441 |
+ docinto examples |
442 |
+ find Tools -name __pycache__ -exec rm -fr {} + || die |
443 |
+ dodoc -r Tools |
444 |
+ fi |
445 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
446 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
447 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
448 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
449 |
+ |
450 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
451 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
452 |
+ sed \ |
453 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
454 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
455 |
+ -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ |
456 |
+ "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" |
457 |
+ |
458 |
+ local -x EPYTHON=python${PYVER} |
459 |
+ # if not using a cross-compiler, use the fresh binary |
460 |
+ if ! tc-is-cross-compiler; then |
461 |
+ cat > python.wrap <<-EOF || die |
462 |
+ #!/bin/sh |
463 |
+ export LD_LIBRARY_PATH=\${PWD}\${LD_LIBRARY_PATH+:\${LD_LIBRARY_PATH}} |
464 |
+ exec ./python "\${@}" |
465 |
+ EOF |
466 |
+ chmod +x python.wrap || die |
467 |
+ local -x PYTHON=./python.wrap |
468 |
+ else |
469 |
+ local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} |
470 |
+ fi |
471 |
+ |
472 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
473 |
+ python_domodule epython.py |
474 |
+ |
475 |
+ # python-exec wrapping support |
476 |
+ local pymajor=${PYVER%.*} |
477 |
+ local scriptdir=${D}$(python_get_scriptdir) |
478 |
+ mkdir -p "${scriptdir}" || die |
479 |
+ # python and pythonX |
480 |
+ ln -s "../../../bin/${abiver}" \ |
481 |
+ "${scriptdir}/python${pymajor}" || die |
482 |
+ ln -s "python${pymajor}" "${scriptdir}/python" || die |
483 |
+ # python-config and pythonX-config |
484 |
+ # note: we need to create a wrapper rather than symlinking it due |
485 |
+ # to some random dirname(argv[0]) magic performed by python-config |
486 |
+ cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die |
487 |
+ #!/bin/sh |
488 |
+ exec "${abiver}-config" "\${@}" |
489 |
+ EOF |
490 |
+ chmod +x "${scriptdir}/python${pymajor}-config" || die |
491 |
+ ln -s "python${pymajor}-config" \ |
492 |
+ "${scriptdir}/python-config" || die |
493 |
+ # 2to3, pydoc |
494 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
495 |
+ "${scriptdir}/2to3" || die |
496 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
497 |
+ "${scriptdir}/pydoc" || die |
498 |
+ # idle |
499 |
+ if use tk; then |
500 |
+ ln -s "../../../bin/idle${PYVER}" \ |
501 |
+ "${scriptdir}/idle" || die |
502 |
+ fi |
503 |
+} |