Gentoo Archives: gentoo-commits

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