1 |
commit: ebbb71da187a11bc28ff9cb0f3c9fee566f50a2e |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 1 14:30:59 2016 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 1 14:30:59 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ebbb71da |
7 |
|
8 |
dev-lang/python: sync to python-3.5.1-r3 |
9 |
|
10 |
Package-Manager: portage-2.2.28-prefix |
11 |
|
12 |
dev-lang/python/files/3.5.1-cross-compile.patch | 75 ++++ |
13 |
.../files/python-3.5-distutils-OO-build.patch | 80 ++++ |
14 |
dev-lang/python/python-3.5.1-r3.ebuild | 434 +++++++++++++++++++++ |
15 |
3 files changed, 589 insertions(+) |
16 |
|
17 |
diff --git a/dev-lang/python/files/3.5.1-cross-compile.patch b/dev-lang/python/files/3.5.1-cross-compile.patch |
18 |
new file mode 100644 |
19 |
index 0000000..25a518b |
20 |
--- /dev/null |
21 |
+++ b/dev-lang/python/files/3.5.1-cross-compile.patch |
22 |
@@ -0,0 +1,75 @@ |
23 |
+# HG changeset patch |
24 |
+# User Martin Panter <vadmium+py@×××××.com> |
25 |
+# Date 1461373124 0 |
26 |
+# Node ID 66e40df31faca467937c7b9d5d2e825471f97822 |
27 |
+# Parent a246047734b3496a7dc4ebaf1f0232dadf22eab6 |
28 |
+Issue #22359: Disable running cross-compiled _freeze_importlib and pgen |
29 |
+ |
30 |
+Patch by Xavier de Gaye. |
31 |
+ |
32 |
+diff --git a/Makefile.pre.in b/Makefile.pre.in |
33 |
+--- a/Makefile.pre.in |
34 |
++++ b/Makefile.pre.in |
35 |
+@@ -221,6 +221,7 @@ LIBOBJS= @LIBOBJS@ |
36 |
+ PYTHON= python$(EXE) |
37 |
+ BUILDPYTHON= python$(BUILDEXE) |
38 |
+ |
39 |
++cross_compiling=@cross_compiling@ |
40 |
+ PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ |
41 |
+ _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@ |
42 |
+ BUILD_GNU_TYPE= @build@ |
43 |
+@@ -718,12 +719,16 @@ Programs/_freeze_importlib: Programs/_fr |
44 |
+ $(LINKCC) $(PY_LDFLAGS) -o $@ Programs/_freeze_importlib.o $(LIBRARY_OBJS_OMIT_FROZEN) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) |
45 |
+ |
46 |
+ Python/importlib_external.h: $(srcdir)/Lib/importlib/_bootstrap_external.py Programs/_freeze_importlib |
47 |
+- ./Programs/_freeze_importlib \ |
48 |
+- $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h |
49 |
++ if test "$(cross_compiling)" != "yes"; then \ |
50 |
++ ./Programs/_freeze_importlib \ |
51 |
++ $(srcdir)/Lib/importlib/_bootstrap_external.py Python/importlib_external.h; \ |
52 |
++ fi |
53 |
+ |
54 |
+ Python/importlib.h: $(srcdir)/Lib/importlib/_bootstrap.py Programs/_freeze_importlib |
55 |
+- ./Programs/_freeze_importlib \ |
56 |
+- $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h |
57 |
++ if test "$(cross_compiling)" != "yes"; then \ |
58 |
++ ./Programs/_freeze_importlib \ |
59 |
++ $(srcdir)/Lib/importlib/_bootstrap.py Python/importlib.h; \ |
60 |
++ fi |
61 |
+ |
62 |
+ |
63 |
+ ############################################################################ |
64 |
+@@ -784,10 +789,18 @@ Python/sysmodule.o: $(srcdir)/Python/sys |
65 |
+ $(IO_OBJS): $(IO_H) |
66 |
+ |
67 |
+ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) |
68 |
+- @$(MKDIR_P) Include |
69 |
+- $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) |
70 |
++ @$(MKDIR_P) Include |
71 |
++ if test "$(cross_compiling)" != "yes"; then \ |
72 |
++ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ |
73 |
++ else \ |
74 |
++ cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \ |
75 |
++ fi |
76 |
+ $(GRAMMAR_C): $(GRAMMAR_H) |
77 |
+- touch $(GRAMMAR_C) |
78 |
++ if test "$(cross_compiling)" != "yes"; then \ |
79 |
++ touch $(GRAMMAR_C); \ |
80 |
++ else \ |
81 |
++ cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \ |
82 |
++ fi |
83 |
+ |
84 |
+ $(PGEN): $(PGENOBJS) |
85 |
+ $(CC) $(OPT) $(PY_LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) |
86 |
+diff --git a/configure.ac b/configure.ac |
87 |
+--- a/configure.ac |
88 |
++++ b/configure.ac |
89 |
+@@ -49,6 +49,7 @@ fi |
90 |
+ AC_CONFIG_SRCDIR([Include/object.h]) |
91 |
+ AC_CONFIG_HEADER(pyconfig.h) |
92 |
+ |
93 |
++AC_SUBST(cross_compiling) |
94 |
+ AC_CANONICAL_HOST |
95 |
+ AC_SUBST(build) |
96 |
+ AC_SUBST(host) |
97 |
+ |
98 |
|
99 |
diff --git a/dev-lang/python/files/python-3.5-distutils-OO-build.patch b/dev-lang/python/files/python-3.5-distutils-OO-build.patch |
100 |
new file mode 100644 |
101 |
index 0000000..8af8c30 |
102 |
--- /dev/null |
103 |
+++ b/dev-lang/python/files/python-3.5-distutils-OO-build.patch |
104 |
@@ -0,0 +1,80 @@ |
105 |
+From 90507018442f9adabb586fd3d0a0206b9c2f2f50 Mon Sep 17 00:00:00 2001 |
106 |
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o> |
107 |
+Date: Sun, 5 Jun 2016 08:18:01 +0200 |
108 |
+Subject: [PATCH] distutils: make -OO enable both opt-1 and opt-2 optimization |
109 |
+ |
110 |
+Bug: http://bugs.python.org/issue27226 |
111 |
+Bug: https://bugs.gentoo.org/585060 |
112 |
+--- |
113 |
+ Lib/distutils/command/build_py.py | 8 ++++---- |
114 |
+ Lib/distutils/command/install_lib.py | 12 ++++++------ |
115 |
+ 2 files changed, 10 insertions(+), 10 deletions(-) |
116 |
+ |
117 |
+diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py |
118 |
+index cf0ca57..838d4e4 100644 |
119 |
+--- a/Lib/distutils/command/build_py.py |
120 |
++++ b/Lib/distutils/command/build_py.py |
121 |
+@@ -315,9 +315,9 @@ class build_py (Command): |
122 |
+ if self.compile: |
123 |
+ outputs.append(importlib.util.cache_from_source( |
124 |
+ filename, optimization='')) |
125 |
+- if self.optimize > 0: |
126 |
++ for opt in range(1, self.optimize + 1): |
127 |
+ outputs.append(importlib.util.cache_from_source( |
128 |
+- filename, optimization=self.optimize)) |
129 |
++ filename, optimization=opt)) |
130 |
+ |
131 |
+ outputs += [ |
132 |
+ os.path.join(build_dir, filename) |
133 |
+@@ -387,8 +387,8 @@ class build_py (Command): |
134 |
+ if self.compile: |
135 |
+ byte_compile(files, optimize=0, |
136 |
+ force=self.force, prefix=prefix, dry_run=self.dry_run) |
137 |
+- if self.optimize > 0: |
138 |
+- byte_compile(files, optimize=self.optimize, |
139 |
++ for opt in range(1, self.optimize + 1): |
140 |
++ byte_compile(files, optimize=opt, |
141 |
+ force=self.force, prefix=prefix, dry_run=self.dry_run) |
142 |
+ |
143 |
+ class build_py_2to3(build_py, Mixin2to3): |
144 |
+diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py |
145 |
+index 6154cf0..049b662 100644 |
146 |
+--- a/Lib/distutils/command/install_lib.py |
147 |
++++ b/Lib/distutils/command/install_lib.py |
148 |
+@@ -24,8 +24,8 @@ class install_lib(Command): |
149 |
+ # 2) compile .pyc only (--compile --no-optimize; default) |
150 |
+ # 3) compile .pyc and "opt-1" .pyc (--compile --optimize) |
151 |
+ # 4) compile "opt-1" .pyc only (--no-compile --optimize) |
152 |
+- # 5) compile .pyc and "opt-2" .pyc (--compile --optimize-more) |
153 |
+- # 6) compile "opt-2" .pyc only (--no-compile --optimize-more) |
154 |
++ # 5) compile .pyc, "opt-1" and "opt-2" .pyc (--compile --optimize-more) |
155 |
++ # 6) compile "opt-1" and "opt-2" .pyc (--no-compile --optimize-more) |
156 |
+ # |
157 |
+ # The UI for this is two options, 'compile' and 'optimize'. |
158 |
+ # 'compile' is strictly boolean, and only decides whether to |
159 |
+@@ -132,8 +132,8 @@ class install_lib(Command): |
160 |
+ byte_compile(files, optimize=0, |
161 |
+ force=self.force, prefix=install_root, |
162 |
+ dry_run=self.dry_run) |
163 |
+- if self.optimize > 0: |
164 |
+- byte_compile(files, optimize=self.optimize, |
165 |
++ for opt in range(1, self.optimize + 1): |
166 |
++ byte_compile(files, optimize=opt, |
167 |
+ force=self.force, prefix=install_root, |
168 |
+ verbose=self.verbose, dry_run=self.dry_run) |
169 |
+ |
170 |
+@@ -167,9 +167,9 @@ class install_lib(Command): |
171 |
+ if self.compile: |
172 |
+ bytecode_files.append(importlib.util.cache_from_source( |
173 |
+ py_file, optimization='')) |
174 |
+- if self.optimize > 0: |
175 |
++ for opt in range(1, self.optimize + 1): |
176 |
+ bytecode_files.append(importlib.util.cache_from_source( |
177 |
+- py_file, optimization=self.optimize)) |
178 |
++ py_file, optimization=opt)) |
179 |
+ |
180 |
+ return bytecode_files |
181 |
+ |
182 |
+-- |
183 |
+2.8.3 |
184 |
+ |
185 |
|
186 |
diff --git a/dev-lang/python/python-3.5.1-r3.ebuild b/dev-lang/python/python-3.5.1-r3.ebuild |
187 |
new file mode 100644 |
188 |
index 0000000..5e176fa |
189 |
--- /dev/null |
190 |
+++ b/dev-lang/python/python-3.5.1-r3.ebuild |
191 |
@@ -0,0 +1,434 @@ |
192 |
+# Copyright 1999-2016 Gentoo Foundation |
193 |
+# Distributed under the terms of the GNU General Public License v2 |
194 |
+# $Id$ |
195 |
+ |
196 |
+EAPI="5" |
197 |
+WANT_LIBTOOL="none" |
198 |
+ |
199 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs |
200 |
+ |
201 |
+MY_P="Python-${PV/_/}" |
202 |
+PATCHSET_VERSION="3.5.1-0" |
203 |
+PREFIX_PATCHREV="r1" |
204 |
+ |
205 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
206 |
+HOMEPAGE="http://www.python.org/" |
207 |
+SRC_URI="http://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
208 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz |
209 |
+ https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz" |
210 |
+ |
211 |
+LICENSE="PSF-2" |
212 |
+SLOT="3.5/3.5m" |
213 |
+KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
214 |
+IUSE="aqua build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
215 |
+ |
216 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
217 |
+# If you need to apply a patch which requires python for bootstrapping, please |
218 |
+# run the bootstrap code on your dev box and include the results in the |
219 |
+# patchset. See bug 447752. |
220 |
+ |
221 |
+RDEPEND="app-arch/bzip2:0= |
222 |
+ app-arch/xz-utils:0= |
223 |
+ >=sys-libs/zlib-1.1.3:0= |
224 |
+ virtual/libffi |
225 |
+ virtual/libintl |
226 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
227 |
+ ncurses? ( |
228 |
+ >=sys-libs/ncurses-5.2:0= |
229 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
230 |
+ ) |
231 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
232 |
+ ssl? ( |
233 |
+ !libressl? ( dev-libs/openssl:0= ) |
234 |
+ libressl? ( dev-libs/libressl:= ) |
235 |
+ ) |
236 |
+ tk? ( |
237 |
+ >=dev-lang/tcl-8.0:0= |
238 |
+ >=dev-lang/tk-8.0:0=[-aqua] |
239 |
+ dev-tcltk/blt:0= |
240 |
+ dev-tcltk/tix |
241 |
+ ) |
242 |
+ xml? ( >=dev-libs/expat-2.1:0= ) |
243 |
+ !!<sys-apps/sandbox-2.6-r1" |
244 |
+DEPEND="${RDEPEND} |
245 |
+ virtual/pkgconfig |
246 |
+ !sys-devel/gcc[libffi(-)]" |
247 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
248 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
249 |
+ |
250 |
+S="${WORKDIR}/${MY_P}" |
251 |
+ |
252 |
+PYVER=${SLOT%/*} |
253 |
+ |
254 |
+src_prepare() { |
255 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
256 |
+ rm -fr Modules/expat |
257 |
+ rm -fr Modules/_ctypes/libffi* |
258 |
+ rm -fr Modules/zlib |
259 |
+ |
260 |
+ if tc-is-cross-compiler; then |
261 |
+ # Invokes BUILDPYTHON, which is built for the host arch |
262 |
+ local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
263 |
+ fi |
264 |
+ |
265 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
266 |
+ epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
267 |
+ epatch "${FILESDIR}/3.5.1-cross-compile.patch" |
268 |
+ epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch" |
269 |
+ |
270 |
+ epatch_user |
271 |
+ |
272 |
+ # Prefix' round of patches |
273 |
+ # http://prefix.gentooexperimental.org:8000/python-patches-3_3 |
274 |
+ EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \ |
275 |
+ epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV} |
276 |
+ |
277 |
+ # https://forums.developer.apple.com/thread/9233, bug #572726 |
278 |
+ sed -i -e '/$(RUNSHARED) .\/regen/s/^/export RUNSHARED=$(RUNSHARED); /' \ |
279 |
+ Makefile.pre.in || die |
280 |
+ sed -i -e '/python$EXE/s/^/env ${RUNSHARED} /' \ |
281 |
+ Lib/plat-darwin/regen || die |
282 |
+ |
283 |
+ # we provide a fully working readline also on Darwin, so don't force |
284 |
+ # usage of less functional libedit |
285 |
+ sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die |
286 |
+ |
287 |
+ # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR. |
288 |
+ sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die |
289 |
+ |
290 |
+ # Make sure python doesn't use the host libffi. |
291 |
+ use prefix && epatch "${FILESDIR}/python-3.2-libffi-pkgconfig.patch" |
292 |
+ |
293 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
294 |
+ configure.ac \ |
295 |
+ Lib/distutils/command/install.py \ |
296 |
+ Lib/distutils/sysconfig.py \ |
297 |
+ Lib/site.py \ |
298 |
+ Lib/sysconfig.py \ |
299 |
+ Lib/test/test_site.py \ |
300 |
+ Makefile.pre.in \ |
301 |
+ Modules/getpath.c \ |
302 |
+ Modules/Setup.dist \ |
303 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
304 |
+ |
305 |
+ # workaround a development build env problem and muck around |
306 |
+ # framework install to get the best of both worlds (non-standard) |
307 |
+ sed -i \ |
308 |
+ -e "s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \ |
309 |
+ -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \ |
310 |
+ configure.ac configure || die |
311 |
+ sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die |
312 |
+ |
313 |
+ # Disable ABI flags. |
314 |
+ sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed failed" |
315 |
+ |
316 |
+ eautoreconf |
317 |
+} |
318 |
+ |
319 |
+src_configure() { |
320 |
+ local disable |
321 |
+ use gdbm || disable+=" gdbm" |
322 |
+ use ncurses || disable+=" _curses _curses_panel" |
323 |
+ use readline || disable+=" readline" |
324 |
+ use sqlite || disable+=" _sqlite3" |
325 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
326 |
+ use tk || disable+=" _tkinter" |
327 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
328 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
329 |
+ |
330 |
+ if ! use xml; then |
331 |
+ ewarn "You have configured Python without XML support." |
332 |
+ ewarn "This is NOT a recommended configuration as you" |
333 |
+ ewarn "may face problems parsing any XML documents." |
334 |
+ fi |
335 |
+ |
336 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
337 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
338 |
+ fi |
339 |
+ |
340 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
341 |
+ append-flags -fwrapv |
342 |
+ fi |
343 |
+ |
344 |
+ filter-flags -malign-double |
345 |
+ |
346 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
347 |
+ if is-flagq -O3; then |
348 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
349 |
+ use hardened && replace-flags -O3 -O2 |
350 |
+ fi |
351 |
+ |
352 |
+ # Export CC so even AIX will use gcc instead of xlc_r. |
353 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
354 |
+ tc-export CC CXX |
355 |
+ |
356 |
+ # The configure script fails to use pkg-config correctly. |
357 |
+ # http://bugs.python.org/issue15506 |
358 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
359 |
+ |
360 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
361 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
362 |
+ # Please query BSD team before removing this! |
363 |
+ append-ldflags "-L." |
364 |
+ |
365 |
+ # make sure setup.py considers Prefix' paths before system ones |
366 |
+ use prefix && append-cppflags -I"${EPREFIX}"/usr/include |
367 |
+ use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib |
368 |
+ |
369 |
+ local dbmliborder |
370 |
+ if use gdbm; then |
371 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
372 |
+ fi |
373 |
+ |
374 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
375 |
+ mkdir -p "${BUILD_DIR}" || die |
376 |
+ cd "${BUILD_DIR}" || die |
377 |
+ |
378 |
+ if use aqua ; then |
379 |
+ ECONF_SOURCE="${S}" OPT="" \ |
380 |
+ econf \ |
381 |
+ --enable-framework="${EPREFIX}"/usr/lib \ |
382 |
+ --config-cache |
383 |
+ fi |
384 |
+ |
385 |
+ # pymalloc #452720 |
386 |
+ local myeconfargs=( |
387 |
+ $(use aqua && echo --config-cache) \ |
388 |
+ --with-fpectl |
389 |
+ --enable-shared |
390 |
+ $(use_enable ipv6) |
391 |
+ $(use_with threads) |
392 |
+ --infodir='${prefix}/share/info' |
393 |
+ --mandir='${prefix}/share/man' |
394 |
+ --with-computed-gotos |
395 |
+ --with-dbmliborder="${dbmliborder}" |
396 |
+ --with-libc= |
397 |
+ --enable-loadable-sqlite-extensions |
398 |
+ --without-ensurepip |
399 |
+ --with-system-expat |
400 |
+ --with-system-ffi |
401 |
+ --without-pymalloc |
402 |
+ ) |
403 |
+ |
404 |
+ ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}" |
405 |
+ |
406 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
407 |
+ eerror "configure has detected that the sem_open function is broken." |
408 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
409 |
+ die "Broken sem_open function (bug 496328)" |
410 |
+ fi |
411 |
+} |
412 |
+ |
413 |
+src_compile() { |
414 |
+ cd "${BUILD_DIR}" || die |
415 |
+ |
416 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
417 |
+ |
418 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
419 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
420 |
+ pax-mark E python |
421 |
+ else |
422 |
+ pax-mark m python |
423 |
+ fi |
424 |
+} |
425 |
+ |
426 |
+src_test() { |
427 |
+ # Tests will not work when cross compiling. |
428 |
+ if tc-is-cross-compiler; then |
429 |
+ elog "Disabling tests due to crosscompiling." |
430 |
+ return |
431 |
+ fi |
432 |
+ |
433 |
+ cd "${BUILD_DIR}" || die |
434 |
+ |
435 |
+ # Skip failing tests. |
436 |
+ local skipped_tests="gdb" |
437 |
+ |
438 |
+ for test in ${skipped_tests}; do |
439 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
440 |
+ done |
441 |
+ |
442 |
+ local -x PYTHONDONTWRITEBYTECODE= |
443 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
444 |
+ local result=$? |
445 |
+ |
446 |
+ for test in ${skipped_tests}; do |
447 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
448 |
+ done |
449 |
+ |
450 |
+ elog "The following tests have been skipped:" |
451 |
+ for test in ${skipped_tests}; do |
452 |
+ elog "test_${test}.py" |
453 |
+ done |
454 |
+ |
455 |
+ elog "If you would like to run them, you may:" |
456 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
457 |
+ elog "and run the tests separately." |
458 |
+ |
459 |
+ if [[ ${result} -ne 0 ]]; then |
460 |
+ die "emake test failed" |
461 |
+ fi |
462 |
+} |
463 |
+ |
464 |
+src_install() { |
465 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
466 |
+ |
467 |
+ cd "${BUILD_DIR}" || die |
468 |
+ |
469 |
+ emake DESTDIR="${D}" altinstall |
470 |
+ |
471 |
+ if use aqua ; then |
472 |
+ # avoid config.status to be triggered |
473 |
+ find Mac -name "Makefile" -exec touch \{\} + || die |
474 |
+ |
475 |
+ # Python_Launcher is kind of a wrapper, and we should fix it for |
476 |
+ # Prefix (it uses /usr/bin/pythonw) so useless |
477 |
+ # IDLE doesn't run, no idea, but definitely not used |
478 |
+ emake DESTDIR="${D}" -C Mac install_Python || die |
479 |
+ rmdir "${ED}"/Applications/Python* || die |
480 |
+ rmdir "${ED}"/Applications || die |
481 |
+ |
482 |
+ local fwdir=/usr/$(get_libdir)/Python.framework/Versions/${PYVER} |
483 |
+ ln -s "${EPREFIX}"/usr/include/python${PYVER} \ |
484 |
+ "${ED}${fwdir}"/Headers || die |
485 |
+ ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ |
486 |
+ "${ED}${fwdir}"/Python || die |
487 |
+ fi |
488 |
+ |
489 |
+ sed \ |
490 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
491 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
492 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
493 |
+ |
494 |
+ # Fix collisions between different slots of Python. |
495 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
496 |
+ |
497 |
+ # Cheap hack to get version with ABIFLAGS |
498 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
499 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
500 |
+ # Replace python3.X with a symlink to python3.Xm |
501 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
502 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
503 |
+ # Create python3.X-config symlink |
504 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
505 |
+ # Create python-3.5m.pc symlink |
506 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
507 |
+ fi |
508 |
+ |
509 |
+ # python seems to get rebuilt in src_install (bug 569908) |
510 |
+ # Work around it for now. |
511 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
512 |
+ pax-mark E "${ED}usr/bin/${abiver}" |
513 |
+ else |
514 |
+ pax-mark m "${ED}usr/bin/${abiver}" |
515 |
+ fi |
516 |
+ |
517 |
+ use elibc_uclibc && rm -fr "${libdir}/test" |
518 |
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
519 |
+ use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
520 |
+ |
521 |
+ use threads || rm -fr "${libdir}/multiprocessing" |
522 |
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
523 |
+ |
524 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
525 |
+ |
526 |
+ if use examples; then |
527 |
+ insinto /usr/share/doc/${PF}/examples |
528 |
+ find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
529 |
+ doins -r "${S}"/Tools |
530 |
+ fi |
531 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
532 |
+ if use aqua ; then |
533 |
+ # we do framework, so the emake trick below returns a pathname |
534 |
+ # since that won't work here, use a (cheap) trick instead |
535 |
+ local libname=libpython${PYVER} |
536 |
+ else |
537 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
538 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
539 |
+ fi |
540 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
541 |
+ |
542 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
543 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
544 |
+ sed \ |
545 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
546 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
547 |
+ -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
548 |
+ |
549 |
+ # for python-exec |
550 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
551 |
+ |
552 |
+ # if not using a cross-compiler, use the fresh binary |
553 |
+ if ! tc-is-cross-compiler; then |
554 |
+ local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) |
555 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}. |
556 |
+ local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}. |
557 |
+ else |
558 |
+ vars=( PYTHON "${vars[@]}" ) |
559 |
+ fi |
560 |
+ |
561 |
+ python_export "python${PYVER}" "${vars[@]}" |
562 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
563 |
+ python_domodule epython.py |
564 |
+ |
565 |
+ # python-exec wrapping support |
566 |
+ local pymajor=${PYVER%.*} |
567 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
568 |
+ # python and pythonX |
569 |
+ ln -s "../../../bin/${abiver}" \ |
570 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
571 |
+ ln -s "python${pymajor}" \ |
572 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
573 |
+ # python-config and pythonX-config |
574 |
+ # note: we need to create a wrapper rather than symlinking it due |
575 |
+ # to some random dirname(argv[0]) magic performed by python-config |
576 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
577 |
+ #!/bin/sh |
578 |
+ exec "${abiver}-config" "\${@}" |
579 |
+ EOF |
580 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
581 |
+ ln -s "python${pymajor}-config" \ |
582 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
583 |
+ # 2to3, pydoc, pyvenv |
584 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
585 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
586 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
587 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
588 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
589 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
590 |
+ # idle |
591 |
+ if use tk; then |
592 |
+ ln -s "../../../bin/idle${PYVER}" \ |
593 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
594 |
+ fi |
595 |
+} |
596 |
+ |
597 |
+pkg_preinst() { |
598 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
599 |
+ python_updater_warning="1" |
600 |
+ fi |
601 |
+} |
602 |
+ |
603 |
+eselect_python_update() { |
604 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
605 |
+ eselect python update |
606 |
+ fi |
607 |
+ |
608 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
609 |
+ eselect python update --python${PV%%.*} |
610 |
+ fi |
611 |
+} |
612 |
+ |
613 |
+pkg_postinst() { |
614 |
+ eselect_python_update |
615 |
+ |
616 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
617 |
+ ewarn "You have just upgraded from an older version of Python." |
618 |
+ ewarn |
619 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
620 |
+ fi |
621 |
+} |
622 |
+ |
623 |
+pkg_postrm() { |
624 |
+ eselect_python_update |
625 |
+} |