1 |
commit: 56760ce3a29757b6cf00b585a9a1d480fdaf312f |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Nov 11 16:07:33 2017 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Nov 11 16:07:46 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56760ce3 |
7 |
|
8 |
dev-lang/python: disable the nis module |
9 |
|
10 |
This fails to build with glibc-2.26. |
11 |
|
12 |
Bug: https://bugs.gentoo.org/631488 |
13 |
Package-Manager: Portage-2.3.13_p1, Repoman-2.3.3_p81 |
14 |
|
15 |
dev-lang/python/files/2.7-disable-nis.patch | 21 ++ |
16 |
dev-lang/python/files/3.6-disable-nis.patch | 21 ++ |
17 |
dev-lang/python/python-2.7.14-r1.ebuild | 366 ++++++++++++++++++++++++++++ |
18 |
dev-lang/python/python-3.4.6-r1.ebuild | 358 +++++++++++++++++++++++++++ |
19 |
dev-lang/python/python-3.5.4-r1.ebuild | 363 +++++++++++++++++++++++++++ |
20 |
dev-lang/python/python-3.6.3-r1.ebuild | 343 ++++++++++++++++++++++++++ |
21 |
6 files changed, 1472 insertions(+) |
22 |
|
23 |
diff --git a/dev-lang/python/files/2.7-disable-nis.patch b/dev-lang/python/files/2.7-disable-nis.patch |
24 |
new file mode 100644 |
25 |
index 00000000000..5a6cb3e403f |
26 |
--- /dev/null |
27 |
+++ b/dev-lang/python/files/2.7-disable-nis.patch |
28 |
@@ -0,0 +1,21 @@ |
29 |
+--- a/setup.py |
30 |
++++ b/setup.py |
31 |
+@@ -1346,17 +1346,7 @@ class PyBuildExt(build_ext): |
32 |
+ else: |
33 |
+ missing.append('resource') |
34 |
+ |
35 |
+- # Sun yellow pages. Some systems have the functions in libc. |
36 |
+- if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and |
37 |
+- find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): |
38 |
+- if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
39 |
+- libs = ['nsl'] |
40 |
+- else: |
41 |
+- libs = [] |
42 |
+- exts.append( Extension('nis', ['nismodule.c'], |
43 |
+- libraries = libs) ) |
44 |
+- else: |
45 |
+- missing.append('nis') |
46 |
++ missing.append('nis') |
47 |
+ else: |
48 |
+ missing.extend(['nis', 'resource', 'termios']) |
49 |
+ |
50 |
|
51 |
diff --git a/dev-lang/python/files/3.6-disable-nis.patch b/dev-lang/python/files/3.6-disable-nis.patch |
52 |
new file mode 100644 |
53 |
index 00000000000..4e81847b507 |
54 |
--- /dev/null |
55 |
+++ b/dev-lang/python/files/3.6-disable-nis.patch |
56 |
@@ -0,0 +1,21 @@ |
57 |
+--- a/setup.py |
58 |
++++ b/setup.py |
59 |
+@@ -1332,17 +1332,7 @@ class PyBuildExt(build_ext): |
60 |
+ # Jeremy Hylton's rlimit interface |
61 |
+ exts.append( Extension('resource', ['resource.c']) ) |
62 |
+ |
63 |
+- # Sun yellow pages. Some systems have the functions in libc. |
64 |
+- if (host_platform not in ['cygwin', 'qnx6'] and |
65 |
+- find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): |
66 |
+- if (self.compiler.find_library_file(lib_dirs, 'nsl')): |
67 |
+- libs = ['nsl'] |
68 |
+- else: |
69 |
+- libs = [] |
70 |
+- exts.append( Extension('nis', ['nismodule.c'], |
71 |
+- libraries = libs) ) |
72 |
+- else: |
73 |
+- missing.append('nis') |
74 |
++ missing.append('nis') |
75 |
+ else: |
76 |
+ missing.extend(['nis', 'resource', 'termios']) |
77 |
+ |
78 |
|
79 |
diff --git a/dev-lang/python/python-2.7.14-r1.ebuild b/dev-lang/python/python-2.7.14-r1.ebuild |
80 |
new file mode 100644 |
81 |
index 00000000000..25ce47e2271 |
82 |
--- /dev/null |
83 |
+++ b/dev-lang/python/python-2.7.14-r1.ebuild |
84 |
@@ -0,0 +1,366 @@ |
85 |
+# Copyright 1999-2017 Gentoo Foundation |
86 |
+# Distributed under the terms of the GNU General Public License v2 |
87 |
+ |
88 |
+EAPI="5" |
89 |
+WANT_LIBTOOL="none" |
90 |
+ |
91 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing |
92 |
+ |
93 |
+MY_P="Python-${PV}" |
94 |
+PATCHSET_VERSION="2.7.14-0" |
95 |
+ |
96 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
97 |
+HOMEPAGE="https://www.python.org/" |
98 |
+SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz |
99 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
100 |
+ |
101 |
+LICENSE="PSF-2" |
102 |
+SLOT="2.7" |
103 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
104 |
+IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" |
105 |
+ |
106 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
107 |
+# If you need to apply a patch which requires python for bootstrapping, please |
108 |
+# run the bootstrap code on your dev box and include the results in the |
109 |
+# patchset. See bug 447752. |
110 |
+ |
111 |
+RDEPEND="app-arch/bzip2:0= |
112 |
+ >=sys-libs/zlib-1.1.3:0= |
113 |
+ virtual/libffi |
114 |
+ virtual/libintl |
115 |
+ berkdb? ( || ( |
116 |
+ sys-libs/db:5.3 |
117 |
+ sys-libs/db:5.2 |
118 |
+ sys-libs/db:5.1 |
119 |
+ sys-libs/db:5.0 |
120 |
+ sys-libs/db:4.8 |
121 |
+ sys-libs/db:4.7 |
122 |
+ sys-libs/db:4.6 |
123 |
+ sys-libs/db:4.5 |
124 |
+ sys-libs/db:4.4 |
125 |
+ sys-libs/db:4.3 |
126 |
+ sys-libs/db:4.2 |
127 |
+ ) ) |
128 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
129 |
+ ncurses? ( |
130 |
+ >=sys-libs/ncurses-5.2:0= |
131 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
132 |
+ ) |
133 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
134 |
+ ssl? ( |
135 |
+ !libressl? ( dev-libs/openssl:0= ) |
136 |
+ libressl? ( dev-libs/libressl:= ) |
137 |
+ ) |
138 |
+ tk? ( |
139 |
+ >=dev-lang/tcl-8.0:0= |
140 |
+ >=dev-lang/tk-8.0:0= |
141 |
+ dev-tcltk/blt:0= |
142 |
+ dev-tcltk/tix |
143 |
+ ) |
144 |
+ xml? ( >=dev-libs/expat-2.1 ) |
145 |
+ !!<sys-apps/portage-2.1.9" |
146 |
+DEPEND="${RDEPEND} |
147 |
+ virtual/pkgconfig |
148 |
+ >=sys-devel/autoconf-2.65 |
149 |
+ !sys-devel/gcc[libffi(-)]" |
150 |
+RDEPEND+=" !build? ( app-misc/mime-types ) |
151 |
+ doc? ( dev-python/python-docs:${SLOT} )" |
152 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
153 |
+ |
154 |
+S="${WORKDIR}/${MY_P}" |
155 |
+ |
156 |
+pkg_setup() { |
157 |
+ if use berkdb; then |
158 |
+ ewarn "'bsddb' module is out-of-date and no longer maintained inside" |
159 |
+ ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally" |
160 |
+ ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module" |
161 |
+ ewarn "is provided by dev-python/bsddb3." |
162 |
+ else |
163 |
+ if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then |
164 |
+ ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]" |
165 |
+ ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." |
166 |
+ ewarn "You might need to migrate your databases." |
167 |
+ fi |
168 |
+ fi |
169 |
+} |
170 |
+ |
171 |
+src_prepare() { |
172 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
173 |
+ rm -r Modules/expat || die |
174 |
+ rm -r Modules/_ctypes/libffi* || die |
175 |
+ rm -r Modules/zlib || die |
176 |
+ |
177 |
+ if tc-is-cross-compiler; then |
178 |
+ local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
179 |
+ fi |
180 |
+ |
181 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
182 |
+ |
183 |
+ # Fix for cross-compiling. |
184 |
+ epatch "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch" |
185 |
+ epatch "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch" |
186 |
+ epatch "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch" |
187 |
+ epatch "${FILESDIR}/python-2.7.10-system-libffi.patch" |
188 |
+ epatch "${FILESDIR}/2.7-disable-nis.patch" |
189 |
+ |
190 |
+ epatch_user |
191 |
+ |
192 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
193 |
+ Lib/distutils/command/install.py \ |
194 |
+ Lib/distutils/sysconfig.py \ |
195 |
+ Lib/site.py \ |
196 |
+ Lib/sysconfig.py \ |
197 |
+ Lib/test/test_site.py \ |
198 |
+ Makefile.pre.in \ |
199 |
+ Modules/Setup.dist \ |
200 |
+ Modules/getpath.c \ |
201 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
202 |
+ |
203 |
+ eautoreconf |
204 |
+} |
205 |
+ |
206 |
+src_configure() { |
207 |
+ # dbm module can be linked against berkdb or gdbm. |
208 |
+ # Defaults to gdbm when both are enabled, #204343. |
209 |
+ local disable |
210 |
+ use berkdb || use gdbm || disable+=" dbm" |
211 |
+ use berkdb || disable+=" _bsddb" |
212 |
+ use gdbm || disable+=" gdbm" |
213 |
+ use ncurses || disable+=" _curses _curses_panel" |
214 |
+ use readline || disable+=" readline" |
215 |
+ use sqlite || disable+=" _sqlite3" |
216 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
217 |
+ use tk || disable+=" _tkinter" |
218 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
219 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
220 |
+ |
221 |
+ if ! use xml; then |
222 |
+ ewarn "You have configured Python without XML support." |
223 |
+ ewarn "This is NOT a recommended configuration as you" |
224 |
+ ewarn "may face problems parsing any XML documents." |
225 |
+ fi |
226 |
+ |
227 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
228 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
229 |
+ fi |
230 |
+ |
231 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
232 |
+ append-flags -fwrapv |
233 |
+ fi |
234 |
+ |
235 |
+ filter-flags -malign-double |
236 |
+ |
237 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
238 |
+ if is-flagq -O3; then |
239 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
240 |
+ use hardened && replace-flags -O3 -O2 |
241 |
+ fi |
242 |
+ |
243 |
+ if tc-is-cross-compiler; then |
244 |
+ # Force some tests that try to poke fs paths. |
245 |
+ export ac_cv_file__dev_ptc=no |
246 |
+ export ac_cv_file__dev_ptmx=yes |
247 |
+ fi |
248 |
+ |
249 |
+ # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. |
250 |
+ tc-export CXX |
251 |
+ # The configure script fails to use pkg-config correctly. |
252 |
+ # http://bugs.python.org/issue15506 |
253 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
254 |
+ |
255 |
+ # Set LDFLAGS so we link modules with -lpython2.7 correctly. |
256 |
+ # Needed on FreeBSD unless Python 2.7 is already installed. |
257 |
+ # Please query BSD team before removing this! |
258 |
+ append-ldflags "-L." |
259 |
+ |
260 |
+ local dbmliborder |
261 |
+ if use gdbm; then |
262 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
263 |
+ fi |
264 |
+ if use berkdb; then |
265 |
+ dbmliborder+="${dbmliborder:+:}bdb" |
266 |
+ fi |
267 |
+ |
268 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
269 |
+ mkdir -p "${BUILD_DIR}" || die |
270 |
+ cd "${BUILD_DIR}" || die |
271 |
+ |
272 |
+ ECONF_SOURCE="${S}" OPT="" \ |
273 |
+ econf \ |
274 |
+ --with-fpectl \ |
275 |
+ --enable-shared \ |
276 |
+ $(use_enable ipv6) \ |
277 |
+ $(use_with threads) \ |
278 |
+ $(use wide-unicode && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ |
279 |
+ --infodir='${prefix}/share/info' \ |
280 |
+ --mandir='${prefix}/share/man' \ |
281 |
+ --with-computed-gotos \ |
282 |
+ --with-dbmliborder="${dbmliborder}" \ |
283 |
+ --with-libc="" \ |
284 |
+ --enable-loadable-sqlite-extensions \ |
285 |
+ --with-system-expat \ |
286 |
+ --with-system-ffi \ |
287 |
+ --without-ensurepip |
288 |
+ |
289 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
290 |
+ eerror "configure has detected that the sem_open function is broken." |
291 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
292 |
+ die "Broken sem_open function (bug 496328)" |
293 |
+ fi |
294 |
+} |
295 |
+ |
296 |
+src_compile() { |
297 |
+ # Avoid invoking pgen for cross-compiles. |
298 |
+ touch Include/graminit.h Python/graminit.c |
299 |
+ |
300 |
+ cd "${BUILD_DIR}" || die |
301 |
+ emake |
302 |
+ |
303 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
304 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
305 |
+ pax-mark E python |
306 |
+ else |
307 |
+ pax-mark m python |
308 |
+ fi |
309 |
+} |
310 |
+ |
311 |
+src_test() { |
312 |
+ # Tests will not work when cross compiling. |
313 |
+ if tc-is-cross-compiler; then |
314 |
+ elog "Disabling tests due to crosscompiling." |
315 |
+ return |
316 |
+ fi |
317 |
+ |
318 |
+ cd "${BUILD_DIR}" || die |
319 |
+ |
320 |
+ # Skip failing tests. |
321 |
+ local skipped_tests="distutils gdb" |
322 |
+ |
323 |
+ for test in ${skipped_tests}; do |
324 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
325 |
+ done |
326 |
+ |
327 |
+ # Daylight saving time problem |
328 |
+ # https://bugs.python.org/issue22067 |
329 |
+ # https://bugs.gentoo.org/610628 |
330 |
+ local -x TZ=UTC |
331 |
+ |
332 |
+ # Rerun failed tests in verbose mode (regrtest -w). |
333 |
+ emake test EXTRATESTOPTS="-w" < /dev/tty |
334 |
+ local result="$?" |
335 |
+ |
336 |
+ for test in ${skipped_tests}; do |
337 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
338 |
+ done |
339 |
+ |
340 |
+ elog "The following tests have been skipped:" |
341 |
+ for test in ${skipped_tests}; do |
342 |
+ elog "test_${test}.py" |
343 |
+ done |
344 |
+ |
345 |
+ elog "If you would like to run them, you may:" |
346 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'" |
347 |
+ elog "and run the tests separately." |
348 |
+ |
349 |
+ if [[ "${result}" -ne 0 ]]; then |
350 |
+ die "emake test failed" |
351 |
+ fi |
352 |
+} |
353 |
+ |
354 |
+src_install() { |
355 |
+ local libdir=${ED}/usr/$(get_libdir)/python${SLOT} |
356 |
+ |
357 |
+ cd "${BUILD_DIR}" || die |
358 |
+ emake DESTDIR="${D}" altinstall |
359 |
+ |
360 |
+ sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed" |
361 |
+ |
362 |
+ # Fix collisions between different slots of Python. |
363 |
+ mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" |
364 |
+ mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" |
365 |
+ mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" |
366 |
+ rm -f "${ED}usr/bin/smtpd.py" |
367 |
+ |
368 |
+ use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die |
369 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
370 |
+ use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die |
371 |
+ use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test} |
372 |
+ |
373 |
+ use threads || rm -r "${libdir}/multiprocessing" || die |
374 |
+ use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die |
375 |
+ |
376 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
377 |
+ |
378 |
+ if use examples; then |
379 |
+ insinto /usr/share/doc/${PF}/examples |
380 |
+ doins -r "${S}"/Tools |
381 |
+ fi |
382 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
383 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
384 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
385 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
386 |
+ |
387 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} |
388 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} |
389 |
+ sed \ |
390 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ |
391 |
+ -e "s:@PYDOC@:pydoc${SLOT}:" \ |
392 |
+ -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" |
393 |
+ |
394 |
+ # for python-exec |
395 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
396 |
+ |
397 |
+ # if not using a cross-compiler, use the fresh binary |
398 |
+ if ! tc-is-cross-compiler; then |
399 |
+ local -x PYTHON=./python |
400 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
401 |
+ else |
402 |
+ vars=( PYTHON "${vars[@]}" ) |
403 |
+ fi |
404 |
+ |
405 |
+ python_export "python${SLOT}" "${vars[@]}" |
406 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
407 |
+ python_domodule epython.py |
408 |
+ |
409 |
+ # python-exec wrapping support |
410 |
+ local pymajor=${SLOT%.*} |
411 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
412 |
+ # python and pythonX |
413 |
+ ln -s "../../../bin/python${SLOT}" \ |
414 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
415 |
+ ln -s "python${pymajor}" \ |
416 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
417 |
+ # python-config and pythonX-config |
418 |
+ ln -s "../../../bin/python${SLOT}-config" \ |
419 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
420 |
+ ln -s "python${pymajor}-config" \ |
421 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
422 |
+ # 2to3, pydoc, pyvenv |
423 |
+ ln -s "../../../bin/2to3-${SLOT}" \ |
424 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
425 |
+ ln -s "../../../bin/pydoc${SLOT}" \ |
426 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
427 |
+ # idle |
428 |
+ if use tk; then |
429 |
+ ln -s "../../../bin/idle${SLOT}" \ |
430 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
431 |
+ fi |
432 |
+} |
433 |
+ |
434 |
+eselect_python_update() { |
435 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
436 |
+ eselect python update |
437 |
+ fi |
438 |
+ |
439 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
440 |
+ eselect python update --python${PV%%.*} |
441 |
+ fi |
442 |
+} |
443 |
+ |
444 |
+pkg_postinst() { |
445 |
+ eselect_python_update |
446 |
+} |
447 |
+ |
448 |
+pkg_postrm() { |
449 |
+ eselect_python_update |
450 |
+} |
451 |
|
452 |
diff --git a/dev-lang/python/python-3.4.6-r1.ebuild b/dev-lang/python/python-3.4.6-r1.ebuild |
453 |
new file mode 100644 |
454 |
index 00000000000..fe9d1282ecc |
455 |
--- /dev/null |
456 |
+++ b/dev-lang/python/python-3.4.6-r1.ebuild |
457 |
@@ -0,0 +1,358 @@ |
458 |
+# Copyright 1999-2017 Gentoo Foundation |
459 |
+# Distributed under the terms of the GNU General Public License v2 |
460 |
+ |
461 |
+EAPI="5" |
462 |
+WANT_LIBTOOL="none" |
463 |
+ |
464 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing |
465 |
+ |
466 |
+MY_P="Python-${PV/_/}" |
467 |
+PATCHSET_VERSION="3.4.6-0" |
468 |
+ |
469 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
470 |
+HOMEPAGE="https://www.python.org/" |
471 |
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
472 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
473 |
+ |
474 |
+LICENSE="PSF-2" |
475 |
+SLOT="3.4/3.4m" |
476 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
477 |
+IUSE="build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
478 |
+ |
479 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
480 |
+# If you need to apply a patch which requires python for bootstrapping, please |
481 |
+# run the bootstrap code on your dev box and include the results in the |
482 |
+# patchset. See bug 447752. |
483 |
+ |
484 |
+RDEPEND="app-arch/bzip2:0= |
485 |
+ app-arch/xz-utils:0= |
486 |
+ >=sys-libs/zlib-1.1.3:0= |
487 |
+ virtual/libffi |
488 |
+ virtual/libintl |
489 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
490 |
+ ncurses? ( |
491 |
+ >=sys-libs/ncurses-5.2:0= |
492 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
493 |
+ ) |
494 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
495 |
+ ssl? ( |
496 |
+ !libressl? ( dev-libs/openssl:0= ) |
497 |
+ libressl? ( dev-libs/libressl:= ) |
498 |
+ ) |
499 |
+ tk? ( |
500 |
+ >=dev-lang/tcl-8.0:0= |
501 |
+ >=dev-lang/tk-8.0:0= |
502 |
+ dev-tcltk/blt:0= |
503 |
+ dev-tcltk/tix |
504 |
+ ) |
505 |
+ xml? ( >=dev-libs/expat-2.1:0= ) |
506 |
+ !!<sys-apps/sandbox-2.6-r1" |
507 |
+DEPEND="${RDEPEND} |
508 |
+ virtual/pkgconfig |
509 |
+ >=sys-devel/autoconf-2.65 |
510 |
+ !sys-devel/gcc[libffi(-)]" |
511 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
512 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
513 |
+ |
514 |
+S="${WORKDIR}/${MY_P}" |
515 |
+ |
516 |
+PYVER=${SLOT%/*} |
517 |
+ |
518 |
+src_prepare() { |
519 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
520 |
+ rm -fr Modules/expat |
521 |
+ rm -fr Modules/_ctypes/libffi* |
522 |
+ rm -fr Modules/zlib |
523 |
+ |
524 |
+ if tc-is-cross-compiler; then |
525 |
+ # Invokes BUILDPYTHON, which is built for the host arch |
526 |
+ local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
527 |
+ fi |
528 |
+ |
529 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
530 |
+ epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
531 |
+ epatch "${FILESDIR}/${PN}-3.4.5-cross.patch" |
532 |
+ epatch "${FILESDIR}/3.4-getentropy-linux.patch" |
533 |
+ epatch "${FILESDIR}/3.6-disable-nis.patch" |
534 |
+ |
535 |
+ epatch_user |
536 |
+ |
537 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
538 |
+ configure.ac \ |
539 |
+ Lib/distutils/command/install.py \ |
540 |
+ Lib/distutils/sysconfig.py \ |
541 |
+ Lib/site.py \ |
542 |
+ Lib/sysconfig.py \ |
543 |
+ Lib/test/test_site.py \ |
544 |
+ Makefile.pre.in \ |
545 |
+ Modules/Setup.dist \ |
546 |
+ Modules/getpath.c \ |
547 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
548 |
+ |
549 |
+ eautoreconf |
550 |
+} |
551 |
+ |
552 |
+src_configure() { |
553 |
+ local disable |
554 |
+ use gdbm || disable+=" gdbm" |
555 |
+ use ncurses || disable+=" _curses _curses_panel" |
556 |
+ use readline || disable+=" readline" |
557 |
+ use sqlite || disable+=" _sqlite3" |
558 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
559 |
+ use tk || disable+=" _tkinter" |
560 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
561 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
562 |
+ |
563 |
+ if ! use xml; then |
564 |
+ ewarn "You have configured Python without XML support." |
565 |
+ ewarn "This is NOT a recommended configuration as you" |
566 |
+ ewarn "may face problems parsing any XML documents." |
567 |
+ fi |
568 |
+ |
569 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
570 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
571 |
+ fi |
572 |
+ |
573 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
574 |
+ append-flags -fwrapv |
575 |
+ fi |
576 |
+ |
577 |
+ filter-flags -malign-double |
578 |
+ |
579 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
580 |
+ if is-flagq -O3; then |
581 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
582 |
+ use hardened && replace-flags -O3 -O2 |
583 |
+ fi |
584 |
+ |
585 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
586 |
+ tc-export CXX |
587 |
+ |
588 |
+ # The configure script fails to use pkg-config correctly. |
589 |
+ # http://bugs.python.org/issue15506 |
590 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
591 |
+ |
592 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
593 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
594 |
+ # Please query BSD team before removing this! |
595 |
+ append-ldflags "-L." |
596 |
+ |
597 |
+ local dbmliborder |
598 |
+ if use gdbm; then |
599 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
600 |
+ fi |
601 |
+ |
602 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
603 |
+ mkdir -p "${BUILD_DIR}" || die |
604 |
+ cd "${BUILD_DIR}" || die |
605 |
+ |
606 |
+ ECONF_SOURCE="${S}" OPT="" \ |
607 |
+ econf \ |
608 |
+ --with-fpectl \ |
609 |
+ --enable-shared \ |
610 |
+ $(use_enable ipv6) \ |
611 |
+ $(use_with threads) \ |
612 |
+ --infodir='${prefix}/share/info' \ |
613 |
+ --mandir='${prefix}/share/man' \ |
614 |
+ --with-computed-gotos \ |
615 |
+ --with-dbmliborder="${dbmliborder}" \ |
616 |
+ --with-libc="" \ |
617 |
+ --enable-loadable-sqlite-extensions \ |
618 |
+ --with-system-expat \ |
619 |
+ --with-system-ffi \ |
620 |
+ --without-ensurepip |
621 |
+ |
622 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
623 |
+ eerror "configure has detected that the sem_open function is broken." |
624 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
625 |
+ die "Broken sem_open function (bug 496328)" |
626 |
+ fi |
627 |
+} |
628 |
+ |
629 |
+src_compile() { |
630 |
+ # Ensure sed works as expected |
631 |
+ # https://bugs.gentoo.org/594768 |
632 |
+ local -x LC_ALL=C |
633 |
+ |
634 |
+ # Avoid invoking pgen for cross-compiles. |
635 |
+ touch Include/graminit.h Python/graminit.c || die |
636 |
+ |
637 |
+ cd "${BUILD_DIR}" || die |
638 |
+ |
639 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
640 |
+ |
641 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
642 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
643 |
+ pax-mark E python |
644 |
+ else |
645 |
+ pax-mark m python |
646 |
+ fi |
647 |
+} |
648 |
+ |
649 |
+src_test() { |
650 |
+ # Tests will not work when cross compiling. |
651 |
+ if tc-is-cross-compiler; then |
652 |
+ elog "Disabling tests due to crosscompiling." |
653 |
+ return |
654 |
+ fi |
655 |
+ |
656 |
+ cd "${BUILD_DIR}" || die |
657 |
+ |
658 |
+ # Skip failing tests. |
659 |
+ local skipped_tests="gdb" |
660 |
+ |
661 |
+ for test in ${skipped_tests}; do |
662 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
663 |
+ done |
664 |
+ |
665 |
+ local -x PYTHONDONTWRITEBYTECODE= |
666 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
667 |
+ local result=$? |
668 |
+ |
669 |
+ for test in ${skipped_tests}; do |
670 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
671 |
+ done |
672 |
+ |
673 |
+ elog "The following tests have been skipped:" |
674 |
+ for test in ${skipped_tests}; do |
675 |
+ elog "test_${test}.py" |
676 |
+ done |
677 |
+ |
678 |
+ elog "If you would like to run them, you may:" |
679 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
680 |
+ elog "and run the tests separately." |
681 |
+ |
682 |
+ if [[ ${result} -ne 0 ]]; then |
683 |
+ die "emake test failed" |
684 |
+ fi |
685 |
+} |
686 |
+ |
687 |
+src_install() { |
688 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
689 |
+ |
690 |
+ cd "${BUILD_DIR}" || die |
691 |
+ |
692 |
+ emake DESTDIR="${D}" altinstall |
693 |
+ |
694 |
+ sed \ |
695 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
696 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
697 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
698 |
+ |
699 |
+ # Fix collisions between different slots of Python. |
700 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
701 |
+ |
702 |
+ # Cheap hack to get version with ABIFLAGS |
703 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
704 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
705 |
+ # Replace python3.X with a symlink to python3.Xm |
706 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
707 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
708 |
+ # Create python3.X-config symlink |
709 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
710 |
+ # Create python-3.5m.pc symlink |
711 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
712 |
+ fi |
713 |
+ |
714 |
+ use elibc_uclibc && rm -fr "${libdir}/test" |
715 |
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
716 |
+ use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
717 |
+ |
718 |
+ use threads || rm -fr "${libdir}/multiprocessing" |
719 |
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
720 |
+ |
721 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
722 |
+ |
723 |
+ if use examples; then |
724 |
+ insinto /usr/share/doc/${PF}/examples |
725 |
+ find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
726 |
+ doins -r "${S}"/Tools |
727 |
+ fi |
728 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
729 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
730 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
731 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
732 |
+ |
733 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
734 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
735 |
+ sed \ |
736 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
737 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
738 |
+ -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
739 |
+ |
740 |
+ # for python-exec |
741 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
742 |
+ |
743 |
+ # if not using a cross-compiler, use the fresh binary |
744 |
+ if ! tc-is-cross-compiler; then |
745 |
+ local -x PYTHON=./python |
746 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
747 |
+ else |
748 |
+ vars=( PYTHON "${vars[@]}" ) |
749 |
+ fi |
750 |
+ |
751 |
+ python_export "python${PYVER}" "${vars[@]}" |
752 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
753 |
+ python_domodule epython.py |
754 |
+ |
755 |
+ # python-exec wrapping support |
756 |
+ local pymajor=${PYVER%.*} |
757 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
758 |
+ # python and pythonX |
759 |
+ ln -s "../../../bin/${abiver}" \ |
760 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
761 |
+ ln -s "python${pymajor}" \ |
762 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
763 |
+ # python-config and pythonX-config |
764 |
+ # note: we need to create a wrapper rather than symlinking it due |
765 |
+ # to some random dirname(argv[0]) magic performed by python-config |
766 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
767 |
+ #!/bin/sh |
768 |
+ exec "${abiver}-config" "\${@}" |
769 |
+ EOF |
770 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
771 |
+ ln -s "python${pymajor}-config" \ |
772 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
773 |
+ # 2to3, pydoc, pyvenv |
774 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
775 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
776 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
777 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
778 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
779 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
780 |
+ # idle |
781 |
+ if use tk; then |
782 |
+ ln -s "../../../bin/idle${PYVER}" \ |
783 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
784 |
+ fi |
785 |
+} |
786 |
+ |
787 |
+pkg_preinst() { |
788 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
789 |
+ python_updater_warning="1" |
790 |
+ fi |
791 |
+} |
792 |
+ |
793 |
+eselect_python_update() { |
794 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
795 |
+ eselect python update |
796 |
+ fi |
797 |
+ |
798 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
799 |
+ eselect python update --python${PV%%.*} |
800 |
+ fi |
801 |
+} |
802 |
+ |
803 |
+pkg_postinst() { |
804 |
+ eselect_python_update |
805 |
+ |
806 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
807 |
+ ewarn "You have just upgraded from an older version of Python." |
808 |
+ ewarn |
809 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
810 |
+ fi |
811 |
+} |
812 |
+ |
813 |
+pkg_postrm() { |
814 |
+ eselect_python_update |
815 |
+} |
816 |
|
817 |
diff --git a/dev-lang/python/python-3.5.4-r1.ebuild b/dev-lang/python/python-3.5.4-r1.ebuild |
818 |
new file mode 100644 |
819 |
index 00000000000..cfe1949d274 |
820 |
--- /dev/null |
821 |
+++ b/dev-lang/python/python-3.5.4-r1.ebuild |
822 |
@@ -0,0 +1,363 @@ |
823 |
+# Copyright 1999-2017 Gentoo Foundation |
824 |
+# Distributed under the terms of the GNU General Public License v2 |
825 |
+ |
826 |
+EAPI="5" |
827 |
+WANT_LIBTOOL="none" |
828 |
+ |
829 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs |
830 |
+ |
831 |
+MY_P="Python-${PV/_/}" |
832 |
+PATCHSET_VERSION="3.5.4-0" |
833 |
+ |
834 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
835 |
+HOMEPAGE="https://www.python.org/" |
836 |
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz |
837 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
838 |
+ |
839 |
+LICENSE="PSF-2" |
840 |
+SLOT="3.5/3.5m" |
841 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
842 |
+IUSE="build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
843 |
+ |
844 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
845 |
+# If you need to apply a patch which requires python for bootstrapping, please |
846 |
+# run the bootstrap code on your dev box and include the results in the |
847 |
+# patchset. See bug 447752. |
848 |
+ |
849 |
+RDEPEND="app-arch/bzip2:0= |
850 |
+ app-arch/xz-utils:0= |
851 |
+ >=sys-libs/zlib-1.1.3:0= |
852 |
+ virtual/libffi |
853 |
+ virtual/libintl |
854 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
855 |
+ ncurses? ( |
856 |
+ >=sys-libs/ncurses-5.2:0= |
857 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
858 |
+ ) |
859 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
860 |
+ ssl? ( |
861 |
+ !libressl? ( dev-libs/openssl:0= ) |
862 |
+ libressl? ( dev-libs/libressl:= ) |
863 |
+ ) |
864 |
+ tk? ( |
865 |
+ >=dev-lang/tcl-8.0:0= |
866 |
+ >=dev-lang/tk-8.0:0= |
867 |
+ dev-tcltk/blt:0= |
868 |
+ dev-tcltk/tix |
869 |
+ ) |
870 |
+ xml? ( >=dev-libs/expat-2.1:0= ) |
871 |
+ !!<sys-apps/sandbox-2.6-r1" |
872 |
+DEPEND="${RDEPEND} |
873 |
+ virtual/pkgconfig |
874 |
+ !sys-devel/gcc[libffi(-)]" |
875 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
876 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
877 |
+ |
878 |
+S="${WORKDIR}/${MY_P}" |
879 |
+ |
880 |
+PYVER=${SLOT%/*} |
881 |
+ |
882 |
+src_prepare() { |
883 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
884 |
+ rm -fr Modules/expat |
885 |
+ rm -fr Modules/_ctypes/libffi* |
886 |
+ rm -fr Modules/zlib |
887 |
+ |
888 |
+ if tc-is-cross-compiler; then |
889 |
+ # Invokes BUILDPYTHON, which is built for the host arch |
890 |
+ local EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch" |
891 |
+ fi |
892 |
+ |
893 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
894 |
+ epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch" |
895 |
+ epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch" |
896 |
+ epatch "${FILESDIR}/3.6-disable-nis.patch" |
897 |
+ |
898 |
+ epatch_user |
899 |
+ |
900 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
901 |
+ configure.ac \ |
902 |
+ Lib/distutils/command/install.py \ |
903 |
+ Lib/distutils/sysconfig.py \ |
904 |
+ Lib/site.py \ |
905 |
+ Lib/sysconfig.py \ |
906 |
+ Lib/test/test_site.py \ |
907 |
+ Makefile.pre.in \ |
908 |
+ Modules/getpath.c \ |
909 |
+ Modules/Setup.dist \ |
910 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
911 |
+ |
912 |
+ eautoreconf |
913 |
+} |
914 |
+ |
915 |
+src_configure() { |
916 |
+ local disable |
917 |
+ use gdbm || disable+=" gdbm" |
918 |
+ use ncurses || disable+=" _curses _curses_panel" |
919 |
+ use readline || disable+=" readline" |
920 |
+ use sqlite || disable+=" _sqlite3" |
921 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
922 |
+ use tk || disable+=" _tkinter" |
923 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
924 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
925 |
+ |
926 |
+ if ! use xml; then |
927 |
+ ewarn "You have configured Python without XML support." |
928 |
+ ewarn "This is NOT a recommended configuration as you" |
929 |
+ ewarn "may face problems parsing any XML documents." |
930 |
+ fi |
931 |
+ |
932 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
933 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
934 |
+ fi |
935 |
+ |
936 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
937 |
+ append-flags -fwrapv |
938 |
+ fi |
939 |
+ |
940 |
+ filter-flags -malign-double |
941 |
+ |
942 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
943 |
+ if is-flagq -O3; then |
944 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
945 |
+ use hardened && replace-flags -O3 -O2 |
946 |
+ fi |
947 |
+ |
948 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
949 |
+ tc-export CXX |
950 |
+ |
951 |
+ # The configure script fails to use pkg-config correctly. |
952 |
+ # http://bugs.python.org/issue15506 |
953 |
+ export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) |
954 |
+ |
955 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
956 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
957 |
+ # Please query BSD team before removing this! |
958 |
+ append-ldflags "-L." |
959 |
+ |
960 |
+ local dbmliborder |
961 |
+ if use gdbm; then |
962 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
963 |
+ fi |
964 |
+ |
965 |
+ BUILD_DIR="${WORKDIR}/${CHOST}" |
966 |
+ mkdir -p "${BUILD_DIR}" || die |
967 |
+ cd "${BUILD_DIR}" || die |
968 |
+ |
969 |
+ local myeconfargs=( |
970 |
+ --with-fpectl |
971 |
+ --enable-shared |
972 |
+ $(use_enable ipv6) |
973 |
+ $(use_with threads) |
974 |
+ --infodir='${prefix}/share/info' |
975 |
+ --mandir='${prefix}/share/man' |
976 |
+ --with-computed-gotos |
977 |
+ --with-dbmliborder="${dbmliborder}" |
978 |
+ --with-libc= |
979 |
+ --enable-loadable-sqlite-extensions |
980 |
+ --without-ensurepip |
981 |
+ --with-system-expat |
982 |
+ --with-system-ffi |
983 |
+ ) |
984 |
+ |
985 |
+ ECONF_SOURCE="${S}" OPT="" econf "${myeconfargs[@]}" |
986 |
+ |
987 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
988 |
+ eerror "configure has detected that the sem_open function is broken." |
989 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
990 |
+ die "Broken sem_open function (bug 496328)" |
991 |
+ fi |
992 |
+} |
993 |
+ |
994 |
+src_compile() { |
995 |
+ # Ensure sed works as expected |
996 |
+ # https://bugs.gentoo.org/594768 |
997 |
+ local -x LC_ALL=C |
998 |
+ |
999 |
+ cd "${BUILD_DIR}" || die |
1000 |
+ |
1001 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
1002 |
+ |
1003 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
1004 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
1005 |
+ pax-mark E python |
1006 |
+ else |
1007 |
+ pax-mark m python |
1008 |
+ fi |
1009 |
+} |
1010 |
+ |
1011 |
+src_test() { |
1012 |
+ # Tests will not work when cross compiling. |
1013 |
+ if tc-is-cross-compiler; then |
1014 |
+ elog "Disabling tests due to crosscompiling." |
1015 |
+ return |
1016 |
+ fi |
1017 |
+ |
1018 |
+ cd "${BUILD_DIR}" || die |
1019 |
+ |
1020 |
+ # Skip failing tests. |
1021 |
+ local skipped_tests="gdb" |
1022 |
+ |
1023 |
+ for test in ${skipped_tests}; do |
1024 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
1025 |
+ done |
1026 |
+ |
1027 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1028 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
1029 |
+ local result=$? |
1030 |
+ |
1031 |
+ for test in ${skipped_tests}; do |
1032 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
1033 |
+ done |
1034 |
+ |
1035 |
+ elog "The following tests have been skipped:" |
1036 |
+ for test in ${skipped_tests}; do |
1037 |
+ elog "test_${test}.py" |
1038 |
+ done |
1039 |
+ |
1040 |
+ elog "If you would like to run them, you may:" |
1041 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
1042 |
+ elog "and run the tests separately." |
1043 |
+ |
1044 |
+ if [[ ${result} -ne 0 ]]; then |
1045 |
+ die "emake test failed" |
1046 |
+ fi |
1047 |
+} |
1048 |
+ |
1049 |
+src_install() { |
1050 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
1051 |
+ |
1052 |
+ cd "${BUILD_DIR}" || die |
1053 |
+ |
1054 |
+ emake DESTDIR="${D}" altinstall |
1055 |
+ |
1056 |
+ sed \ |
1057 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
1058 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
1059 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
1060 |
+ |
1061 |
+ # Fix collisions between different slots of Python. |
1062 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
1063 |
+ |
1064 |
+ # Cheap hack to get version with ABIFLAGS |
1065 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
1066 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
1067 |
+ # Replace python3.X with a symlink to python3.Xm |
1068 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
1069 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
1070 |
+ # Create python3.X-config symlink |
1071 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1072 |
+ # Create python-3.5m.pc symlink |
1073 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1074 |
+ fi |
1075 |
+ |
1076 |
+ # python seems to get rebuilt in src_install (bug 569908) |
1077 |
+ # Work around it for now. |
1078 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
1079 |
+ pax-mark E "${ED}usr/bin/${abiver}" |
1080 |
+ else |
1081 |
+ pax-mark m "${ED}usr/bin/${abiver}" |
1082 |
+ fi |
1083 |
+ |
1084 |
+ use elibc_uclibc && rm -fr "${libdir}/test" |
1085 |
+ use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*} |
1086 |
+ use tk || rm -fr "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} |
1087 |
+ |
1088 |
+ use threads || rm -fr "${libdir}/multiprocessing" |
1089 |
+ use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe |
1090 |
+ |
1091 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
1092 |
+ |
1093 |
+ if use examples; then |
1094 |
+ insinto /usr/share/doc/${PF}/examples |
1095 |
+ find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
1096 |
+ doins -r "${S}"/Tools |
1097 |
+ fi |
1098 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1099 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
1100 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
1101 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
1102 |
+ |
1103 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
1104 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
1105 |
+ sed \ |
1106 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1107 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
1108 |
+ -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1109 |
+ |
1110 |
+ # for python-exec |
1111 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
1112 |
+ |
1113 |
+ # if not using a cross-compiler, use the fresh binary |
1114 |
+ if ! tc-is-cross-compiler; then |
1115 |
+ local -x PYTHON=./python |
1116 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
1117 |
+ else |
1118 |
+ vars=( PYTHON "${vars[@]}" ) |
1119 |
+ fi |
1120 |
+ |
1121 |
+ python_export "python${PYVER}" "${vars[@]}" |
1122 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
1123 |
+ python_domodule epython.py |
1124 |
+ |
1125 |
+ # python-exec wrapping support |
1126 |
+ local pymajor=${PYVER%.*} |
1127 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
1128 |
+ # python and pythonX |
1129 |
+ ln -s "../../../bin/${abiver}" \ |
1130 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
1131 |
+ ln -s "python${pymajor}" \ |
1132 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
1133 |
+ # python-config and pythonX-config |
1134 |
+ # note: we need to create a wrapper rather than symlinking it due |
1135 |
+ # to some random dirname(argv[0]) magic performed by python-config |
1136 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
1137 |
+ #!/bin/sh |
1138 |
+ exec "${abiver}-config" "\${@}" |
1139 |
+ EOF |
1140 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
1141 |
+ ln -s "python${pymajor}-config" \ |
1142 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
1143 |
+ # 2to3, pydoc, pyvenv |
1144 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
1145 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
1146 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
1147 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
1148 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
1149 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
1150 |
+ # idle |
1151 |
+ if use tk; then |
1152 |
+ ln -s "../../../bin/idle${PYVER}" \ |
1153 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
1154 |
+ fi |
1155 |
+} |
1156 |
+ |
1157 |
+pkg_preinst() { |
1158 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
1159 |
+ python_updater_warning="1" |
1160 |
+ fi |
1161 |
+} |
1162 |
+ |
1163 |
+eselect_python_update() { |
1164 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
1165 |
+ eselect python update |
1166 |
+ fi |
1167 |
+ |
1168 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
1169 |
+ eselect python update --python${PV%%.*} |
1170 |
+ fi |
1171 |
+} |
1172 |
+ |
1173 |
+pkg_postinst() { |
1174 |
+ eselect_python_update |
1175 |
+ |
1176 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
1177 |
+ ewarn "You have just upgraded from an older version of Python." |
1178 |
+ ewarn |
1179 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
1180 |
+ fi |
1181 |
+} |
1182 |
+ |
1183 |
+pkg_postrm() { |
1184 |
+ eselect_python_update |
1185 |
+} |
1186 |
|
1187 |
diff --git a/dev-lang/python/python-3.6.3-r1.ebuild b/dev-lang/python/python-3.6.3-r1.ebuild |
1188 |
new file mode 100644 |
1189 |
index 00000000000..dec37dbbd15 |
1190 |
--- /dev/null |
1191 |
+++ b/dev-lang/python/python-3.6.3-r1.ebuild |
1192 |
@@ -0,0 +1,343 @@ |
1193 |
+# Copyright 1999-2017 Gentoo Foundation |
1194 |
+# Distributed under the terms of the GNU General Public License v2 |
1195 |
+ |
1196 |
+EAPI="5" |
1197 |
+WANT_LIBTOOL="none" |
1198 |
+ |
1199 |
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs |
1200 |
+ |
1201 |
+MY_P="Python-${PV}" |
1202 |
+PATCHSET_VERSION="3.6.2-0" |
1203 |
+ |
1204 |
+DESCRIPTION="An interpreted, interactive, object-oriented programming language" |
1205 |
+HOMEPAGE="https://www.python.org/" |
1206 |
+SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz |
1207 |
+ https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" |
1208 |
+ |
1209 |
+LICENSE="PSF-2" |
1210 |
+SLOT="3.6/3.6m" |
1211 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" |
1212 |
+IUSE="build examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk wininst +xml" |
1213 |
+ |
1214 |
+# Do not add a dependency on dev-lang/python to this ebuild. |
1215 |
+# If you need to apply a patch which requires python for bootstrapping, please |
1216 |
+# run the bootstrap code on your dev box and include the results in the |
1217 |
+# patchset. See bug 447752. |
1218 |
+ |
1219 |
+RDEPEND="app-arch/bzip2:0= |
1220 |
+ app-arch/xz-utils:0= |
1221 |
+ >=sys-libs/zlib-1.1.3:0= |
1222 |
+ virtual/libffi |
1223 |
+ virtual/libintl |
1224 |
+ gdbm? ( sys-libs/gdbm:0=[berkdb] ) |
1225 |
+ ncurses? ( |
1226 |
+ >=sys-libs/ncurses-5.2:0= |
1227 |
+ readline? ( >=sys-libs/readline-4.1:0= ) |
1228 |
+ ) |
1229 |
+ sqlite? ( >=dev-db/sqlite-3.3.8:3= ) |
1230 |
+ ssl? ( |
1231 |
+ !libressl? ( dev-libs/openssl:0= ) |
1232 |
+ libressl? ( dev-libs/libressl:= ) |
1233 |
+ ) |
1234 |
+ tk? ( |
1235 |
+ >=dev-lang/tcl-8.0:0= |
1236 |
+ >=dev-lang/tk-8.0:0= |
1237 |
+ dev-tcltk/blt:0= |
1238 |
+ dev-tcltk/tix |
1239 |
+ ) |
1240 |
+ xml? ( >=dev-libs/expat-2.1:0= ) |
1241 |
+ !!<sys-apps/sandbox-2.6-r1" |
1242 |
+DEPEND="${RDEPEND} |
1243 |
+ virtual/pkgconfig |
1244 |
+ !sys-devel/gcc[libffi(-)]" |
1245 |
+RDEPEND+=" !build? ( app-misc/mime-types )" |
1246 |
+PDEPEND=">=app-eselect/eselect-python-20140125-r1" |
1247 |
+ |
1248 |
+S="${WORKDIR}/${MY_P}" |
1249 |
+PYVER=${SLOT%/*} |
1250 |
+ |
1251 |
+src_prepare() { |
1252 |
+ # Ensure that internal copies of expat, libffi and zlib are not used. |
1253 |
+ rm -fr Modules/expat |
1254 |
+ rm -fr Modules/_ctypes/libffi* |
1255 |
+ rm -fr Modules/zlib |
1256 |
+ |
1257 |
+ EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches" |
1258 |
+ epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch" |
1259 |
+ epatch "${FILESDIR}/3.6-blake2.patch" |
1260 |
+ epatch "${FILESDIR}/3.6-disable-nis.patch" |
1261 |
+ |
1262 |
+ epatch_user |
1263 |
+ |
1264 |
+ sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ |
1265 |
+ Lib/distutils/command/install.py \ |
1266 |
+ Lib/distutils/sysconfig.py \ |
1267 |
+ Lib/site.py \ |
1268 |
+ Lib/sysconfig.py \ |
1269 |
+ Lib/test/test_site.py \ |
1270 |
+ Makefile.pre.in \ |
1271 |
+ Modules/Setup.dist \ |
1272 |
+ Modules/getpath.c \ |
1273 |
+ configure.ac \ |
1274 |
+ setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" |
1275 |
+ |
1276 |
+ eautoreconf |
1277 |
+} |
1278 |
+ |
1279 |
+src_configure() { |
1280 |
+ local disable |
1281 |
+ use gdbm || disable+=" gdbm" |
1282 |
+ use ncurses || disable+=" _curses _curses_panel" |
1283 |
+ use readline || disable+=" readline" |
1284 |
+ use sqlite || disable+=" _sqlite3" |
1285 |
+ use ssl || export PYTHON_DISABLE_SSL="1" |
1286 |
+ use tk || disable+=" _tkinter" |
1287 |
+ use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. |
1288 |
+ export PYTHON_DISABLE_MODULES="${disable}" |
1289 |
+ |
1290 |
+ if ! use xml; then |
1291 |
+ ewarn "You have configured Python without XML support." |
1292 |
+ ewarn "This is NOT a recommended configuration as you" |
1293 |
+ ewarn "may face problems parsing any XML documents." |
1294 |
+ fi |
1295 |
+ |
1296 |
+ if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then |
1297 |
+ einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" |
1298 |
+ fi |
1299 |
+ |
1300 |
+ if [[ "$(gcc-major-version)" -ge 4 ]]; then |
1301 |
+ append-flags -fwrapv |
1302 |
+ fi |
1303 |
+ |
1304 |
+ filter-flags -malign-double |
1305 |
+ |
1306 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=50309 |
1307 |
+ if is-flagq -O3; then |
1308 |
+ is-flagq -fstack-protector-all && replace-flags -O3 -O2 |
1309 |
+ use hardened && replace-flags -O3 -O2 |
1310 |
+ fi |
1311 |
+ |
1312 |
+ # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. |
1313 |
+ tc-export CXX |
1314 |
+ |
1315 |
+ # Set LDFLAGS so we link modules with -lpython3.2 correctly. |
1316 |
+ # Needed on FreeBSD unless Python 3.2 is already installed. |
1317 |
+ # Please query BSD team before removing this! |
1318 |
+ append-ldflags "-L." |
1319 |
+ |
1320 |
+ local dbmliborder |
1321 |
+ if use gdbm; then |
1322 |
+ dbmliborder+="${dbmliborder:+:}gdbm" |
1323 |
+ fi |
1324 |
+ |
1325 |
+ local myeconfargs=( |
1326 |
+ --with-fpectl |
1327 |
+ --enable-shared |
1328 |
+ $(use_enable ipv6) |
1329 |
+ $(use_with threads) |
1330 |
+ --infodir='${prefix}/share/info' |
1331 |
+ --mandir='${prefix}/share/man' |
1332 |
+ --with-computed-gotos |
1333 |
+ --with-dbmliborder="${dbmliborder}" |
1334 |
+ --with-libc= |
1335 |
+ --enable-loadable-sqlite-extensions |
1336 |
+ --without-ensurepip |
1337 |
+ --with-system-expat |
1338 |
+ --with-system-ffi |
1339 |
+ ) |
1340 |
+ |
1341 |
+ OPT="" econf "${myeconfargs[@]}" |
1342 |
+ |
1343 |
+ if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then |
1344 |
+ eerror "configure has detected that the sem_open function is broken." |
1345 |
+ eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." |
1346 |
+ die "Broken sem_open function (bug 496328)" |
1347 |
+ fi |
1348 |
+} |
1349 |
+ |
1350 |
+src_compile() { |
1351 |
+ # Ensure sed works as expected |
1352 |
+ # https://bugs.gentoo.org/594768 |
1353 |
+ local -x LC_ALL=C |
1354 |
+ |
1355 |
+ emake CPPFLAGS= CFLAGS= LDFLAGS= |
1356 |
+ |
1357 |
+ # Work around bug 329499. See also bug 413751 and 457194. |
1358 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
1359 |
+ pax-mark E python |
1360 |
+ else |
1361 |
+ pax-mark m python |
1362 |
+ fi |
1363 |
+} |
1364 |
+ |
1365 |
+src_test() { |
1366 |
+ # Tests will not work when cross compiling. |
1367 |
+ if tc-is-cross-compiler; then |
1368 |
+ elog "Disabling tests due to crosscompiling." |
1369 |
+ return |
1370 |
+ fi |
1371 |
+ |
1372 |
+ # Skip failing tests. |
1373 |
+ local skipped_tests="gdb" |
1374 |
+ |
1375 |
+ for test in ${skipped_tests}; do |
1376 |
+ mv "${S}"/Lib/test/test_${test}.py "${T}" |
1377 |
+ done |
1378 |
+ |
1379 |
+ local -x PYTHONDONTWRITEBYTECODE= |
1380 |
+ |
1381 |
+ emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty |
1382 |
+ local result=$? |
1383 |
+ |
1384 |
+ for test in ${skipped_tests}; do |
1385 |
+ mv "${T}/test_${test}.py" "${S}"/Lib/test |
1386 |
+ done |
1387 |
+ |
1388 |
+ elog "The following tests have been skipped:" |
1389 |
+ for test in ${skipped_tests}; do |
1390 |
+ elog "test_${test}.py" |
1391 |
+ done |
1392 |
+ |
1393 |
+ elog "If you would like to run them, you may:" |
1394 |
+ elog "cd '${EPREFIX}/usr/$(get_libdir)/python${PYVER}/test'" |
1395 |
+ elog "and run the tests separately." |
1396 |
+ |
1397 |
+ if [[ ${result} -ne 0 ]]; then |
1398 |
+ die "emake test failed" |
1399 |
+ fi |
1400 |
+} |
1401 |
+ |
1402 |
+src_install() { |
1403 |
+ local libdir=${ED}/usr/$(get_libdir)/python${PYVER} |
1404 |
+ |
1405 |
+ emake DESTDIR="${D}" altinstall |
1406 |
+ |
1407 |
+ sed \ |
1408 |
+ -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \ |
1409 |
+ -e "s/\(PY_LDFLAGS=\).*/\1/" \ |
1410 |
+ -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed" |
1411 |
+ |
1412 |
+ # Fix collisions between different slots of Python. |
1413 |
+ rm -f "${ED}usr/$(get_libdir)/libpython3.so" |
1414 |
+ |
1415 |
+ # Cheap hack to get version with ABIFLAGS |
1416 |
+ local abiver=$(cd "${ED}usr/include"; echo python*) |
1417 |
+ if [[ ${abiver} != python${PYVER} ]]; then |
1418 |
+ # Replace python3.X with a symlink to python3.Xm |
1419 |
+ rm "${ED}usr/bin/python${PYVER}" || die |
1420 |
+ dosym "${abiver}" "/usr/bin/python${PYVER}" |
1421 |
+ # Create python3.X-config symlink |
1422 |
+ dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" |
1423 |
+ # Create python-3.5m.pc symlink |
1424 |
+ dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" |
1425 |
+ fi |
1426 |
+ |
1427 |
+ # python seems to get rebuilt in src_install (bug 569908) |
1428 |
+ # Work around it for now. |
1429 |
+ if has_version dev-libs/libffi[pax_kernel]; then |
1430 |
+ pax-mark E "${ED}usr/bin/${abiver}" |
1431 |
+ else |
1432 |
+ pax-mark m "${ED}usr/bin/${abiver}" |
1433 |
+ fi |
1434 |
+ |
1435 |
+ use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die |
1436 |
+ use tk || rm -r "${ED}usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die |
1437 |
+ |
1438 |
+ use threads || rm -r "${libdir}/multiprocessing" || die |
1439 |
+ use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die |
1440 |
+ |
1441 |
+ dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} |
1442 |
+ |
1443 |
+ if use examples; then |
1444 |
+ insinto /usr/share/doc/${PF}/examples |
1445 |
+ find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr |
1446 |
+ doins -r "${S}"/Tools |
1447 |
+ fi |
1448 |
+ insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 |
1449 |
+ local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ |
1450 |
+ emake --no-print-directory -s -f - 2>/dev/null) |
1451 |
+ newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py |
1452 |
+ |
1453 |
+ newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} |
1454 |
+ newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} |
1455 |
+ sed \ |
1456 |
+ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ |
1457 |
+ -e "s:@PYDOC@:pydoc${PYVER}:" \ |
1458 |
+ -i "${ED}etc/conf.d/pydoc-${PYVER}" "${ED}etc/init.d/pydoc-${PYVER}" || die "sed failed" |
1459 |
+ |
1460 |
+ # for python-exec |
1461 |
+ local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) |
1462 |
+ |
1463 |
+ # if not using a cross-compiler, use the fresh binary |
1464 |
+ if ! tc-is-cross-compiler; then |
1465 |
+ local -x PYTHON=./python |
1466 |
+ local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} |
1467 |
+ else |
1468 |
+ vars=( PYTHON "${vars[@]}" ) |
1469 |
+ fi |
1470 |
+ |
1471 |
+ python_export "python${PYVER}" "${vars[@]}" |
1472 |
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die |
1473 |
+ python_domodule epython.py |
1474 |
+ |
1475 |
+ # python-exec wrapping support |
1476 |
+ local pymajor=${PYVER%.*} |
1477 |
+ mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die |
1478 |
+ # python and pythonX |
1479 |
+ ln -s "../../../bin/${abiver}" \ |
1480 |
+ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die |
1481 |
+ ln -s "python${pymajor}" \ |
1482 |
+ "${D}${PYTHON_SCRIPTDIR}/python" || die |
1483 |
+ # python-config and pythonX-config |
1484 |
+ # note: we need to create a wrapper rather than symlinking it due |
1485 |
+ # to some random dirname(argv[0]) magic performed by python-config |
1486 |
+ cat > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die |
1487 |
+ #!/bin/sh |
1488 |
+ exec "${abiver}-config" "\${@}" |
1489 |
+ EOF |
1490 |
+ chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die |
1491 |
+ ln -s "python${pymajor}-config" \ |
1492 |
+ "${D}${PYTHON_SCRIPTDIR}/python-config" || die |
1493 |
+ # 2to3, pydoc, pyvenv |
1494 |
+ ln -s "../../../bin/2to3-${PYVER}" \ |
1495 |
+ "${D}${PYTHON_SCRIPTDIR}/2to3" || die |
1496 |
+ ln -s "../../../bin/pydoc${PYVER}" \ |
1497 |
+ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die |
1498 |
+ ln -s "../../../bin/pyvenv-${PYVER}" \ |
1499 |
+ "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die |
1500 |
+ # idle |
1501 |
+ if use tk; then |
1502 |
+ ln -s "../../../bin/idle${PYVER}" \ |
1503 |
+ "${D}${PYTHON_SCRIPTDIR}/idle" || die |
1504 |
+ fi |
1505 |
+} |
1506 |
+ |
1507 |
+pkg_preinst() { |
1508 |
+ if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version ">=${CATEGORY}/${PN}-${PYVER}_alpha"; then |
1509 |
+ python_updater_warning="1" |
1510 |
+ fi |
1511 |
+} |
1512 |
+ |
1513 |
+eselect_python_update() { |
1514 |
+ if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then |
1515 |
+ eselect python update |
1516 |
+ fi |
1517 |
+ |
1518 |
+ if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then |
1519 |
+ eselect python update --python${PV%%.*} |
1520 |
+ fi |
1521 |
+} |
1522 |
+ |
1523 |
+pkg_postinst() { |
1524 |
+ eselect_python_update |
1525 |
+ |
1526 |
+ if [[ "${python_updater_warning}" == "1" ]]; then |
1527 |
+ ewarn "You have just upgraded from an older version of Python." |
1528 |
+ ewarn |
1529 |
+ ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." |
1530 |
+ fi |
1531 |
+} |
1532 |
+ |
1533 |
+pkg_postrm() { |
1534 |
+ eselect_python_update |
1535 |
+} |