diff options
author | Fabian Groffen <grobian@gentoo.org> | 2022-04-10 09:37:18 +0200 |
---|---|---|
committer | Fabian Groffen <grobian@gentoo.org> | 2022-04-10 09:37:18 +0200 |
commit | c2569fb9d45b3d5b8544cadbeafbd1dd07780b60 (patch) | |
tree | 41c591767fc9b1a84410b2ed5cad6ea842f74a94 /dev-lang | |
parent | bootstrap-prefix.sh: try m4 1.4.19 (for glibc-2.34 fix) (diff) | |
download | prefix-c2569fb9d45b3d5b8544cadbeafbd1dd07780b60.tar.gz prefix-c2569fb9d45b3d5b8544cadbeafbd1dd07780b60.tar.bz2 prefix-c2569fb9d45b3d5b8544cadbeafbd1dd07780b60.zip |
dev-lang/python-3.10.4: version bump, drop 2.7
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/python/Manifest | 8 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.10-cross-compile-warn-test.patch | 24 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.10-system-libffi.patch | 36 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.14-libffi-pkgconfig.patch | 44 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch | 18 | ||||
-rw-r--r-- | dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch | 13 | ||||
-rw-r--r-- | dev-lang/python/files/python-3.4-pyfpe-dll.patch | 24 | ||||
-rw-r--r-- | dev-lang/python/metadata.xml | 8 | ||||
-rw-r--r-- | dev-lang/python/python-2.7.16.ebuild | 612 | ||||
-rw-r--r-- | dev-lang/python/python-3.10.4.ebuild | 480 |
10 files changed, 489 insertions, 778 deletions
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index c5e846887a..f18ad79618 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -1,12 +1,12 @@ -DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 7d6b5b853f9974d44e04dd35ecdffaab87511e183b4b01dd4f8f4ee109c4b4ab208f045708f69717be9d3a706aa078b71438ed482c062c0b89c12730eae074ae SHA512 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0 +DIST Python-3.10.4.tar.xz 19342692 BLAKE2B c430ad9bed71729fda29433af0614b6c0110a85e23f4cb5cff3a9b501febe99b20094367a5428f256fb3aeef97f34d439ef677fc8ae4d596d52da7976b65ebb5 SHA512 6c9aeecddc55c7896b2e8527fca131c7b2b6127d56ce1a001ccedfebf590334e0c0bb7c517ed3cf1da3c1910e002552b56aa7e03eeb672f42ff0bd8150799113 +DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf SHA512 699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d DIST Python-3.8.8.tar.xz 18271736 BLAKE2B af0ff1acd919b365a58278e82678324ff884cc8120bcaf12e0e3afb1bd978e6469e256335df131935f51ff481fb83dda04e4b6f1cd1746611f9ec944db73d692 SHA512 64181db5aa48281284a3230436ebfb8cb91b645a9dec956fd48c0048334498477073fc4e14d6b426d0ef7fbcdcfd5d59cbf01a504e6c9014dc9529494b9309fb DIST Python-3.8.8.tar.xz.asc 833 BLAKE2B a11188f9f68c518259de1a4e271bf56409d7356a7eb3dd8cbea7bbb0b5bc1b43f9aeb85bda4add65bbae906bef65cb20a30bcc77da04c0d383cd5b527821fd85 SHA512 0e6f11a310c1796dd056d9a4b63b5e03aa8dbd290088966e04a590a78c00003887dbfd7a7029a6cf8c5626ecd6ca91c1c16433bb0a41bf1225b02b8db8541b95 DIST Python-3.9.6.tar.xz 19051972 BLAKE2B 0d8586b2935088eeab7138cf2210c1a74f1bf7359359d25750af5f69de55eb39c92f518b887a8b749c772ed7d33e85b912928ae6d878514eb58d85ef210f54f0 SHA512 01c529e3207738d8771caeb5ed6217e10745c21aa39832fe3185e1c87fdb6aedead97ce38dbb11e02d873654028bd8071c3f345c18452769520723284efe9dc1 DIST Python-3.9.6.tar.xz.asc 833 BLAKE2B 41901bfb80a901f2f14e86769e6d08ded8f75656d347201345183162e180e61442da871a1067572a54da579551166a19bf5436e51581bb10cb78afc4d28773fc SHA512 0673c8833f302c829bfde97453c52744f6aa99b4a72520f4cc384d4aa9d6ffd28a1407ceafb0a1ec4462b3aa74b656bf39c67872c4e6a131429ea58c47ad0ecc -DIST python-gentoo-patches-2.7.16.tar.xz 13904 BLAKE2B 218b46f8656f4a792dcd47eabca6d59a1558276b77676544991ee75914cd76dda84c36f43e72e477b850dd4cb52374d289f20dccd244a3b52ae5debaf3363432 SHA512 83f90545231c663a34c6925352a357a2b15997ac0362578a1893304c5070b5251922585ae8bc1bafb68d306bcddd4cdba4b6406648d473bd3e980eef65fe3ecd +DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d SHA512 3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2 DIST python-gentoo-patches-3.8.8_p1.tar.xz 15456 BLAKE2B 7d9f55f951f97ef7e08d0245dddd21f5b8d126735c1c392ba6326ad1c18023b477f62e9b6663d8e5b6f0362e442137d0b6ed3ea13b279cca6734d36dbe6e654f SHA512 7fff74d03a0c4cd4b5c977761179c2b9a0ed472847ee9544f54331cef7549557ac4d6b78e676058bd2b01c96ca59d84f04c55beca8ddc45f16b11ce349210eea DIST python-gentoo-patches-3.9.6_p1.tar.xz 12764 BLAKE2B 927718f1aadb5d5ef67e647a639a10bffdd48474bf01e50bd37ef1242bce57606b7b54c4823c1da3585ee76e737028163e38e9b4e19037585cc53f925e1c5fa7 SHA512 f06fb55786bd942e72e3225ee9ce218724aeee29f301279743588749007e991851a8f29db5b5dfd85435e3d763c00942947909a6fc60581bd0f3e8a6e913bff8 -DIST python-prefix-2.7.16-gentoo-patches-r0.tar.xz 14636 BLAKE2B 54320f5197bb7adeca1e7c97447253e6535a11f380b6d66bc2ce46fa671fe23697aced8fd5619633a00e3ea19ae9dbc3ffe2981173d83dcab6b447d514555c43 SHA512 5380d9b92eb81603ec4d60ff9c940a3a061c06bd6f593d5837e600da5d4417b529d20d98d758aa95cef18fac10bdb5c33f90fa943deb15fdaf048492cf286581 +DIST python-prefix-gentoo-3.10.4-patches-r0.tar.xz 6772 BLAKE2B b807ae02242926d99c3823b73ce33193926d55891d54b5d214b4bdf24d2213b4d7b248030146a01698ceadd255affffef8937d84fc11e6d587ffcc91286e81b2 SHA512 a8f16d12b785a4b9ca884e4235cb298e4155273534a7957e517a679f0c2d4b35dcca08e445bed3fe2a80e3a6441f04004eae955a362eb1091ac1f9e2b9a5448f DIST python-prefix-gentoo-3.8.7-patches-r2.tar.xz 8312 BLAKE2B 268f3cff62dc51d4f91994c3f6b05cea0e29edb1ccf39476ba52485fb94c3cad72b54ed5cd941c227bdad004a7ae0069d60ee6bbde5a30d16115263d0dc2a5c3 SHA512 e43ce1e9e851bebce968ee025f765fc9a558c8edc4ee2d51616043183fd12301ab3d5c7f92915238e53b5cf92f6c00617ab0fcf9859d4cebe0966271e6f64725 DIST python-prefix-gentoo-3.9.6_p1-patches-r0.tar.xz 6984 BLAKE2B 8b032d3000fd2dfcb8e099ac071c1a911ba2a0e30343788f7191043800f9d0088307cd7007b2b3f6cc7d2f315fc22bbac5990fed81f0dd8d60dca0314bd59b88 SHA512 76c56895c99ee203bd266f475766d2572659939abaf478932e7c9c65ddc52cb5e012e23c9455dd0a4bf0281a07c70e23a2fea8337c693b8a4ac8abb534e21982 -DIST python2-cygwinports-7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 BLAKE2B 85803bc1677bd16650cb5fc4a2c54fdac0228326f25cfba4fcd098ac9d689312d3e0dde6fca57f720d5235361d6462461cf018325c23fda9139e0f1683055aff SHA512 cabc21d2d7379daf1f4bafe7ab00b70e5b4f707d3102496b96ff0dfdced26347097ad771c69e0b9488b7c54b1ef36f9bc019bee72f1ffcbb55dcd0e71095edfe diff --git a/dev-lang/python/files/python-2.7.10-cross-compile-warn-test.patch b/dev-lang/python/files/python-2.7.10-cross-compile-warn-test.patch deleted file mode 100644 index 38433de925..0000000000 --- a/dev-lang/python/files/python-2.7.10-cross-compile-warn-test.patch +++ /dev/null @@ -1,24 +0,0 @@ -https://bugs.python.org/issue25397 - -improve the cross-compile tests to be more focused - ---- a/configure.ac -+++ b/configure.ac -@@ -1339,7 +1339,7 @@ if test "$GCC" = "yes" - then - AC_MSG_CHECKING(whether gcc supports ParseTuple __format__) - save_CFLAGS=$CFLAGS -- CFLAGS="$CFLAGS -Werror -Wformat" -+ CFLAGS="$CFLAGS -Werror=format" - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[void f(char*,...)__attribute((format(PyArg_ParseTuple, 1, 2)));]], [[]]) - ],[ -@@ -4458,7 +4458,7 @@ then - [ac_cv_have_long_long_format="cross -- assuming no" - if test x$GCC = xyes; then - save_CFLAGS=$CFLAGS -- CFLAGS="$CFLAGS -Werror -Wformat" -+ CFLAGS="$CFLAGS -Werror=format" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include <stdio.h> - #include <stddef.h> diff --git a/dev-lang/python/files/python-2.7.10-system-libffi.patch b/dev-lang/python/files/python-2.7.10-system-libffi.patch deleted file mode 100644 index 0b49b794bd..0000000000 --- a/dev-lang/python/files/python-2.7.10-system-libffi.patch +++ /dev/null @@ -1,36 +0,0 @@ -make sure we respect the system libffi setting in our build config. -the compiler probing is fragile and can break in some situations. - ---- a/setup.py -+++ b/setup.py -@@ -2069,7 +2069,7 @@ class PyBuildExt(build_ext): - return True - - def detect_ctypes(self, inc_dirs, lib_dirs): -- self.use_system_libffi = False -+ self.use_system_libffi = ('--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS")) - include_dirs = [] - extra_compile_args = [] - extra_link_args = [] -@@ -2113,7 +2113,7 @@ class PyBuildExt(build_ext): - sources=['_ctypes/_ctypes_test.c']) - self.extensions.extend([ext, ext_test]) - -- if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): -+ if not self.use_system_libffi: - return - - if host_platform == 'darwin': -@@ -2141,10 +2141,10 @@ class PyBuildExt(build_ext): - ffi_lib = lib_name - break - -- if ffi_inc and ffi_lib: -+ if ffi_inc: - ext.include_dirs.extend(ffi_inc) -+ if ffi_lib: - ext.libraries.append(ffi_lib) -- self.use_system_libffi = True - - - class PyBuildInstall(install): diff --git a/dev-lang/python/files/python-2.7.14-libffi-pkgconfig.patch b/dev-lang/python/files/python-2.7.14-libffi-pkgconfig.patch deleted file mode 100644 index 85abb1b56b..0000000000 --- a/dev-lang/python/files/python-2.7.14-libffi-pkgconfig.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -u -r Python-2.7.5-orig//configure.ac Python-2.7.5/configure.ac ---- Python-2.7.5-orig//configure.ac 2014-03-06 04:35:31.000000000 +0100 -+++ Python-2.7.5/configure.ac 2014-03-06 04:58:10.000000000 +0100 -@@ -2300,10 +2300,13 @@ - - if test "$with_system_ffi" = "yes" && test -n "$PKG_CONFIG"; then - LIBFFI_INCLUDEDIR="`"$PKG_CONFIG" libffi --cflags-only-I 2>/dev/null | sed -e 's/^-I//;s/ *$//'`" -+ LIBFFI_LIB="`"$PKG_CONFIG" libffi --libs-only-l 2>/dev/null | sed -e 's/^-l//;s/ *$//'`" - else - LIBFFI_INCLUDEDIR="" -+ LIBFFI_LIB="" - fi - AC_SUBST(LIBFFI_INCLUDEDIR) -+AC_SUBST(LIBFFI_LIB) - - AC_MSG_RESULT($with_system_ffi) - -diff -u -r Python-2.7.5-orig//Makefile.pre.in Python-2.7.5/Makefile.pre.in ---- Python-2.7.5-orig//Makefile.pre.in 2014-03-06 04:35:31.000000000 +0100 -+++ Python-2.7.5/Makefile.pre.in 2014-03-06 05:03:59.000000000 +0100 -@@ -224,6 +224,7 @@ - - - LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ -+LIBFFI_LIB= @LIBFFI_LIB@ - - ########################################################################## - # Parser -diff -u -r Python-2.7.5-orig//setup.py Python-2.7.5/setup.py ---- Python-2.7.5-orig//setup.py 2014-03-06 04:35:31.000000000 +0100 -+++ Python-2.7.5/setup.py 2014-03-06 04:56:15.000000000 +0100 -@@ -1893,8 +1893,10 @@ - ffi_inc = None - print('Header file {} does not define LIBFFI_H or ' - 'ffi_wrapper_h'.format(ffi_h)) -- ffi_lib = None -- if ffi_inc is not None: -+ ffi_lib = sysconfig.get_config_var("LIBFFI_LIB") -+ if not ffi_lib or ffi_lib == '': -+ ffi_lib = None -+ if ffi_inc is not None and ffi_lib is None: - for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'): - if (self.compiler.find_library_file(lib_dirs, lib_name)): - ffi_lib = lib_name diff --git a/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch b/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch deleted file mode 100644 index a762dfb108..0000000000 --- a/dev-lang/python/files/python-2.7.5-nonfatal-compileall.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/Makefile.pre.in b/Makefile.pre.in ---- a/Makefile.pre.in -+++ b/Makefile.pre.in -@@ -1000,12 +1000,12 @@ - $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ - $(DESTDIR)$(LIBDEST)/distutils/tests ; \ - fi -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ - $(DESTDIR)$(LIBDEST) -- PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -+ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ - -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ diff --git a/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch b/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch deleted file mode 100644 index 38ce6f78b9..0000000000 --- a/dev-lang/python/files/python-2.7.9-ncurses-pkg-config.patch +++ /dev/null @@ -1,13 +0,0 @@ -do not hardcode /usr/include paths - ---- a/configure.ac -+++ b/configure.ac -@@ -4316,7 +4316,7 @@ fi - - # first curses configure check - ac_save_cppflags="$CPPFLAGS" --CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw" -+CPPFLAGS="$CPPFLAGS `$PKG_CONFIG --cflags ncursesw`" - - AC_CHECK_HEADERS(curses.h ncurses.h) - diff --git a/dev-lang/python/files/python-3.4-pyfpe-dll.patch b/dev-lang/python/files/python-3.4-pyfpe-dll.patch deleted file mode 100644 index 401529d830..0000000000 --- a/dev-lang/python/files/python-3.4-pyfpe-dll.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- Python-3.4.3/Include/pyfpe.h -+++ Python-3.4.3/Include/pyfpe.h -@@ -129,9 +129,9 @@ - #include <signal.h> - #include <setjmp.h> - #include <math.h> --extern jmp_buf PyFPE_jbuf; --extern int PyFPE_counter; --extern double PyFPE_dummy(void *); -+PyAPI_DATA(jmp_buf) PyFPE_jbuf; -+PyAPI_DATA(int) PyFPE_counter; -+PyAPI_FUNC(double) PyFPE_dummy(void *); - - #define PyFPE_START_PROTECT(err_string, leave_stmt) \ - if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ ---- Python-3.4.3/Python/pyfpe.c -+++ Python-3.4.3/Python/pyfpe.c -@@ -1,5 +1,4 @@ --#include "pyconfig.h" --#include "pyfpe.h" -+#include "Python.h" - /* - * The signal handler for SIGFPE is actually declared in an external - * module fpectl, or as preferred by the user. These variable diff --git a/dev-lang/python/metadata.xml b/dev-lang/python/metadata.xml index 6a4ebd8b87..54c2aa9734 100644 --- a/dev-lang/python/metadata.xml +++ b/dev-lang/python/metadata.xml @@ -1,13 +1,15 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <maintainer type="project"> <email>python@gentoo.org</email> <name>Python</name> </maintainer> <use> - <flag name="threads">Enable threading support. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag> - <flag name="wide-unicode">Enable wide Unicode implementation which uses 4-byte Unicode characters. Switching of this USE flag changes ABI of Python and requires reinstallation of many Python modules. (DON'T DISABLE THIS UNLESS YOU KNOW WHAT YOU'RE DOING)</flag> + <flag name="bluetooth">Build Bluetooth protocol support in socket module</flag> + <flag name="libedit">Link readline extension against <pkg>dev-libs/libedit</pkg> instead of <pkg>sys-libs/readline</pkg>.</flag> + <flag name="pgo">Optimize the build using Profile Guided Optimization (PGO)</flag> + <flag name="lto">Optimize the build using Link Time Optimization (LTO)</flag> <flag name="wininst">Install Windows executables required to create an executable installer for MS Windows.</flag> </use> </pkgmetadata> diff --git a/dev-lang/python/python-2.7.16.ebuild b/dev-lang/python/python-2.7.16.ebuild deleted file mode 100644 index 155e466d96..0000000000 --- a/dev-lang/python/python-2.7.16.ebuild +++ /dev/null @@ -1,612 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="6" -WANT_LIBTOOL="none" - -inherit autotools eutils flag-o-matic pax-utils python-utils-r1 toolchain-funcs - -MY_P="Python-${PV}" -PATCHSET_VERSION="2.7.16" -PREFIX_PATCHREV="r0" -CYGWINPORTS_GITREV="7be648659ef46f33db6913ca0ca5a809219d5629" - -DESCRIPTION="An interpreted, interactive, object-oriented programming language" -HOMEPAGE="https://www.python.org/" -SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz - https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz - https://dev.gentoo.org/~grobian/distfiles/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV}.tar.xz" - -[[ -n ${CYGWINPORTS_GITREV} ]] && -SRC_URI+=" elibc_Cygwin? ( - https://github.com/cygwinports/python2/archive/${CYGWINPORTS_GITREV}.zip - -> python2-cygwinports-${CYGWINPORTS_GITREV}.zip )" - -LICENSE="PSF-2" -SLOT="2.7" -KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" -IUSE="aqua -berkdb bluetooth build doc elibc_uclibc examples gdbm hardened ipv6 +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" - -# Do not add a dependency on dev-lang/python to this ebuild. -# If you need to apply a patch which requires python for bootstrapping, please -# run the bootstrap code on your dev box and include the results in the -# patchset. See bug 447752. - -RDEPEND="app-arch/bzip2:0= - >=sys-libs/zlib-1.1.3:0= - virtual/libffi - virtual/libintl - berkdb? ( || ( - sys-libs/db:5.3 - sys-libs/db:5.1 - sys-libs/db:4.8 - sys-libs/db:4.7 - sys-libs/db:4.6 - sys-libs/db:4.5 - sys-libs/db:4.4 - sys-libs/db:4.3 - sys-libs/db:4.2 - ) ) - gdbm? ( sys-libs/gdbm:0=[berkdb] ) - ncurses? ( >=sys-libs/ncurses-5.2:0= ) - readline? ( >=sys-libs/readline-4.1:0= ) - sqlite? ( >=dev-db/sqlite-3.3.8:3= ) - ssl? ( dev-libs/openssl:0= ) - tk? ( - >=dev-lang/tcl-8.0:0= - >=dev-lang/tk-8.0:0=[-aqua] - dev-tcltk/blt:0= - dev-tcltk/tix - ) - xml? ( >=dev-libs/expat-2.1 ) - !!<sys-apps/portage-2.1.9" -# bluetooth requires headers from bluez -DEPEND="${RDEPEND} - bluetooth? ( net-wireless/bluez ) - virtual/pkgconfig - >=sys-devel/autoconf-2.65 - !sys-devel/gcc[libffi(-)]" -RDEPEND+=" !build? ( app-misc/mime-types ) - doc? ( dev-python/python-docs:${SLOT} )" -PDEPEND=">=app-eselect/eselect-python-20140125-r1" - -[[ -n ${CYGWINPORTS_GITREV} ]] && -DEPEND+=" elibc_Cygwin? ( app-arch/unzip )" - -S="${WORKDIR}/${MY_P}" - -pkg_setup() { - if use berkdb; then - ewarn "'bsddb' module is out-of-date and no longer maintained inside" - ewarn "dev-lang/python. 'bsddb' and 'dbhash' modules have been additionally" - ewarn "removed in Python 3. A maintained alternative of 'bsddb3' module" - ewarn "is provided by dev-python/bsddb3." - else - if has_version "=${CATEGORY}/${PN}-${PV%%.*}*[berkdb]"; then - ewarn "You are migrating from =${CATEGORY}/${PN}-${PV%%.*}*[berkdb]" - ewarn "to =${CATEGORY}/${PN}-${PV%%.*}*[-berkdb]." - ewarn "You might need to migrate your databases." - fi - fi -} - -src_prepare() { - # Ensure that internal copies of expat, libffi and zlib are not used. - rm -r Modules/expat || die - rm -r Modules/_ctypes/libffi* || die - rm -r Modules/zlib || die - - if tc-is-cross-compiler; then - rm "${WORKDIR}/patches/0006-Regenerate-platform-specific-modules.patch" || die - fi - - local PATCHES=( - "${WORKDIR}/patches" - # Fix for cross-compiling. - "${FILESDIR}/python-2.7.5-nonfatal-compileall.patch" - "${FILESDIR}/python-2.7.9-ncurses-pkg-config.patch" - "${FILESDIR}/python-2.7.10-cross-compile-warn-test.patch" - "${FILESDIR}/python-2.7.10-system-libffi.patch" - ) - - default - - # Prefix' round of patches - EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \ - epatch "${WORKDIR}"/python-prefix-${PV}-gentoo-patches-${PREFIX_PATCHREV} - epatch "${FILESDIR}/python-3.4-pyfpe-dll.patch" # Cygwin: --with-fpectl - # Make sure python doesn't use the host libffi. - use prefix && epatch "${FILESDIR}/python-2.7.14-libffi-pkgconfig.patch" - - if use aqua ; then - # make sure we don't get a framework reference here - sed -i -e '/-DPREFIX=/s:$(prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \ - -e '/-DEXEC_PREFIX=/s:$(exec_prefix):$(FRAMEWORKUNIXTOOLSPREFIX):' \ - Makefile.pre.in || die - # Python upstream refuses to listen to configure arguments - sed -i -e '/FRAMEWORKINSTALLAPPSPREFIX=/s:="[^"]*":="${prefix}/../Applications":' \ - configure.ac configure || die - # we handle creation of symlinks in src_install - sed -i -e '/ln -fs .*PYTHONFRAMEWORK/d' Makefile.pre.in || die - # build the Python framework without DESTDIR in install_name - sed -i -e '/-install_name/s/$(DESTDIR)//' Makefile.pre.in || die - fi - # don't try to do fancy things on Darwin - sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || die - # fix header standards conflicts on Solaris - if [[ ${CHOST} == *-solaris* ]] ; then - # GCC5 switched the default from gnu89 to gnu11, a standards - # conflict arises from that, which can be solved by upgrading - # _XOPEN_SOURCE from 500 to 600, but since it is compiler - # version specific, just force the old standard onto the - # compiler. Python 3 properly detects this. - CC="$(tc-getCC) -std=gnu89" - fi - - if [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin; then - local p d="${WORKDIR}/python2-${CYGWINPORTS_GITREV}" - for p in $( - eval "$(sed -ne '/PATCH_URI="/,/"/p' < "${d}"/python.cygport)" - echo ${PATCH_URI} - ); do - # dropped by 01_all_prefix-no-patch-invention.patch - [[ ${p} == *-tkinter-* ]] && continue - epatch "${d}/${p}" - done - fi - - sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ - Lib/distutils/command/install.py \ - Lib/distutils/sysconfig.py \ - Lib/site.py \ - Lib/sysconfig.py \ - Lib/test/test_site.py \ - Makefile.pre.in \ - Modules/Setup.dist \ - Modules/getpath.c \ - setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" - - eautoreconf -} - -src_configure() { - # dbm module can be linked against berkdb or gdbm. - # Defaults to gdbm when both are enabled, #204343. - local disable - use berkdb || use gdbm || disable+=" dbm" - use berkdb || disable+=" _bsddb" - # disable automagic bluetooth headers detection - use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no - use gdbm || disable+=" gdbm" - use ncurses || disable+=" _curses _curses_panel" - use readline || disable+=" readline" - use sqlite || disable+=" _sqlite3" - use ssl || export PYTHON_DISABLE_SSL="1" - use tk || disable+=" _tkinter" - use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. - [[ ${CHOST} == *64-apple-darwin* ]] && disable+=" Nav _Qt" # Carbon - [[ ${CHOST} == *-apple-darwin11 ]] && disable+=" _Fm _Qd _Qdoffs" - export PYTHON_DISABLE_MODULES="${disable}" - - if ! use xml; then - ewarn "You have configured Python without XML support." - ewarn "This is NOT a recommended configuration as you" - ewarn "may face problems parsing any XML documents." - fi - - if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then - einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" - fi - - if [[ "$(gcc-major-version)" -ge 4 ]]; then - append-flags -fwrapv - fi - - filter-flags -malign-double - - # https://bugs.gentoo.org/show_bug.cgi?id=50309 - if is-flagq -O3; then - is-flagq -fstack-protector-all && replace-flags -O3 -O2 - use hardened && replace-flags -O3 -O2 - fi - - if tc-is-cross-compiler; then - # Force some tests that try to poke fs paths. - export ac_cv_file__dev_ptc=no - export ac_cv_file__dev_ptmx=yes - fi - - # http://bugs.gentoo.org/show_bug.cgi?id=302137 - if [[ ${CHOST} == powerpc-*-darwin* ]] && \ - ( is-flag "-mtune=*" || is-flag "-mcpu=*" ) || \ - [[ ${CHOST} == powerpc64-*-darwin* ]]; - then - replace-flags -O2 -O3 - replace-flags -Os -O3 # comment #14 - fi - - # Export CC so even AIX will use gcc instead of xlc_r. - # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile. - tc-export CC CXX - # The configure script fails to use pkg-config correctly. - # http://bugs.python.org/issue15506 - export ac_cv_path_PKG_CONFIG=$(tc-getPKG_CONFIG) - - # Set LDFLAGS so we link modules with -lpython2.7 correctly. - # Needed on FreeBSD unless Python 2.7 is already installed. - # Please query BSD team before removing this! - # On AIX this is not needed, but would record '.' as runpath. - append-ldflags "-L." - - if use prefix ; then - # for Python's setup.py not to do false assumptions (only looking in - # host paths) we need to make explicit where Prefix stuff is - append-cppflags -I"${EPREFIX}"/usr/include - append-ldflags -L"${EPREFIX}"/$(get_libdir) - append-ldflags -L"${EPREFIX}"/usr/$(get_libdir) - # fix compilation on some Linux hosts, #381163, #473520 - if use elibc_glibc ; then - for hostlibdir in /usr/lib32 /usr/lib64 /usr/lib /lib32 /lib64; do - [[ -d ${hostlibdir} ]] || continue - append-ldflags -L${hostlibdir} - done - fi - # Have to move $(CPPFLAGS) to before $(CFLAGS) to ensure that - # local include paths - set in $(CPPFLAGS) - are searched first. - sed -i -e "/^PY_CFLAGS[ \\t]*=/s,\\\$(CFLAGS)[ \\t]*\\\$(CPPFLAGS),\$(CPPFLAGS) \$(CFLAGS)," Makefile.pre.in || die - fi - - local dbmliborder - if use gdbm; then - dbmliborder+="${dbmliborder:+:}gdbm" - fi - if use berkdb; then - dbmliborder+="${dbmliborder:+:}bdb" - fi - - # we need this to get pythonw, the GUI version of python - # --enable-framework and --enable-shared are mutually exclusive: - # http://bugs.python.org/issue5809 - local myshared= - use aqua \ - && myshared="--enable-framework=${EPREFIX}/usr/lib" \ - || myshared="--enable-shared" - - # note: for a framework build we need to use ucs2 because macOS - # uses that internally too: - # http://bugs.python.org/issue763708 - local myeconfargs=( - --with-fpectl - ${myshared} - $(use_enable ipv6) - $(use_with threads) - $( (use wide-unicode && use !aqua) && echo "--enable-unicode=ucs4" || echo "--enable-unicode=ucs2") \ - --infodir='${prefix}/share/info' - --mandir='${prefix}/share/man' - --with-computed-gotos - --with-dbmliborder="${dbmliborder}" - --with-libc= - --enable-loadable-sqlite-extensions - --with-system-expat - --with-system-ffi - --without-ensurepip - ) - - # we need to build in a separate dir to avoid problems due to - # case-insensitivity on Darwin - BUILD_DIR="${WORKDIR}/${CHOST}" - mkdir -p "${BUILD_DIR}" || die - cd "${BUILD_DIR}" || die - - ECONF_SOURCE="${S}" OPT= econf "${myeconfargs[@]}" - - if use threads && grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then - eerror "configure has detected that the sem_open function is broken." - eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." - die "Broken sem_open function (bug 496328)" - fi -} - -src_compile() { - # Avoid invoking pgen for cross-compiles. - touch Include/graminit.h Python/graminit.c - - cd "${BUILD_DIR}" || die - emake - - # Work around bug 329499. See also bug 413751 and 457194. - if has_version dev-libs/libffi[pax_kernel]; then - pax-mark E python - else - pax-mark m python - fi -} - -src_test() { - # Tests will not work when cross compiling. - if tc-is-cross-compiler; then - elog "Disabling tests due to crosscompiling." - return - fi - - cd "${BUILD_DIR}" || die - - # Skip failing tests. - local skipped_tests="distutils gdb" - - for test in ${skipped_tests}; do - mv "${S}"/Lib/test/test_${test}.py "${T}" - done - - # bug 660358 - local -x COLUMNS=80 - - # Daylight saving time problem - # https://bugs.python.org/issue22067 - # https://bugs.gentoo.org/610628 - local -x TZ=UTC - - # Rerun failed tests in verbose mode (regrtest -w). - emake test EXTRATESTOPTS="-w" < /dev/tty - local result="$?" - - for test in ${skipped_tests}; do - mv "${T}/test_${test}.py" "${S}"/Lib/test - done - - elog "The following tests have been skipped:" - for test in ${skipped_tests}; do - elog "test_${test}.py" - done - - elog "If you would like to run them, you may:" - elog "cd '${EPREFIX}/usr/$(get_libdir)/python${SLOT}/test'" - elog "and run the tests separately." - - if [[ "${result}" -ne 0 ]]; then - die "emake test failed" - fi -} - -src_install() { - local libdir=${ED}/usr/$(get_libdir)/python${SLOT} - - cd "${BUILD_DIR}" || die - if use aqua ; then - local fwdir="${EPREFIX}"/usr/$(get_libdir)/Python.framework - - # do not make multiple targets in parallel when there are broken - # sharedmods (during bootstrap), would build them twice in parallel. - - # Python_Launcher is kind of a wrapper, and we should fix it for - # Prefix (it uses /usr/bin/pythonw) so useless - # IDLE doesn't run, no idea, but definitely not used - sed -i -e 's/install_\(BuildApplet\|PythonLauncher\|IDLE\)[^:]//g' \ - Mac/Makefile || die - - # let the makefiles do their thing - emake -j1 CC="$(tc-getCC)" DESTDIR="${D}" STRIPFLAG= altinstall - rmdir "${ED}"/Applications/Python* || die - rmdir "${ED}"/Applications || die - - # avoid framework incompatibility, degrade to a normal UNIX lib - mkdir -p "${ED}"/usr/$(get_libdir) - cp "${D}${fwdir}"/Versions/${SLOT}/Python \ - "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib || die - chmod u+w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib - install_name_tool \ - -id "${EPREFIX}"/usr/$(get_libdir)/libpython${SLOT}.dylib \ - "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib - chmod u-w "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib - cp libpython${SLOT}.a "${ED}"/usr/$(get_libdir)/ || die - - # rebuild python executable to be the non-pythonw (python wrapper) - # version so we don't get framework crap - rm "${ED}"/usr/bin/python${SLOT} # drop existing symlink, bug #390861 - $(tc-getCC) "${ED}"/usr/$(get_libdir)/libpython${SLOT}.dylib \ - -o "${ED}"/usr/bin/python${SLOT} \ - Modules/python.o || die - - # don't install the "Current" symlink, will always conflict - rm "${D}${fwdir}"/Versions/Current || die - # update whatever points to it, eselect-python sets them - rm "${D}${fwdir}"/{Headers,Python,Resources} || die - - # remove unversioned files (that are not made versioned below) - pushd "${ED}"/usr/bin > /dev/null - rm -f python python-config python${SLOT}-config - # python${SLOT} was created above - for f in pythonw smtpd${SLOT}.py pydoc idle ; do - rm -f ${f} ${f}${SLOT} - done - # pythonw needs to remain in the framework (that's the whole - # reason we go through this framework hassle) - ln -s ../lib/Python.framework/Versions/${SLOT}/bin/pythonw${SLOT} || die - # copy the scripts to we can fix their shebangs - for f in 2to3 pydoc${SLOT} idle${SLOT} python${SLOT}-config ; do - # for some reason sometimes they already exist, bug #347321 - rm -f ${f} - cp "${D}${fwdir}"/Versions/${SLOT}/bin/${f} . || die - sed -i -e '1c\#!'"${EPREFIX}"'/usr/bin/python'"${SLOT}" \ - ${f} || die - done - # "fix" to have below collision fix not to bail - mv pydoc${SLOT} pydoc || die - mv idle${SLOT} idle || die - popd > /dev/null - - # basically we don't like the framework stuff at all, so just move - # stuff around or add some symlinks to make our life easier - mkdir -p "${ED}"/usr - mv "${D}${fwdir}"/Versions/${SLOT}/share \ - "${ED}"/usr/ || die "can't move share" - # get includes just UNIX style - mkdir -p "${ED}"/usr/include - mv "${D}${fwdir}"/Versions/${SLOT}/include/python${SLOT} \ - "${ED}"/usr/include/ || die "can't move include" - pushd "${D}${fwdir}"/Versions/${SLOT}/include > /dev/null - ln -s ../../../../../include/python${SLOT} || die - popd > /dev/null - rm -f "${ED}"/usr/share/man/man1/python{,2}.1 - - # same for libs - # NOTE: can't symlink the entire dir, because a real dir already exists - # on upgrade (site-packages), however since we h4x0rzed python to - # actually look into the UNIX-style dir, we just switch them around. - mkdir -p "${ED}"/usr/$(get_libdir)/python${SLOT} - mv "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT}/* \ - "${ED}"/usr/$(get_libdir)/python${SLOT}/ \ - || die "can't move python${SLOT}" - rmdir "${D}${fwdir}"/Versions/${SLOT}/lib/python${SLOT} || die - pushd "${D}${fwdir}"/Versions/${SLOT}/lib > /dev/null - ln -s ../../../../python${SLOT} || die - popd > /dev/null - - # fix up Makefile - sed -i \ - -e '/^LINKFORSHARED=/s/-u _PyMac_Error.*$//' \ - -e '/^LDFLAGS=/s/=.*$/=/' \ - -e '/^prefix=/s:=.*$:= '"${EPREFIX}"'/usr:' \ - -e '/^PYTHONFRAMEWORK=/s/=.*$/=/' \ - -e '/^PYTHONFRAMEWORKDIR=/s/=.*$/= no-framework/' \ - -e '/^PYTHONFRAMEWORKPREFIX=/s/=.*$/=/' \ - -e '/^PYTHONFRAMEWORKINSTALLDIR=/s/=.*$/=/' \ - -e '/^LDLIBRARY=/s:=.*$:libpython$(VERSION).dylib:' \ - "${libdir}"/config/Makefile || die - # and sysconfigdata likewise - sed -i \ - -e "/'LINKFORSHARED'/s/-u _PyMac_Error[^']*'/'/" \ - -e "/'LDFLAGS'/s/:.*$/:'',/" \ - -e "/'prefix'/s|:.*$|:'${EPREFIX}/usr',|" \ - -e "/'PYTHONFRAMEWORK'/s/:.*$/:'',/" \ - -e "/'PYTHONFRAMEWORKDIR'/s/:.*$/:'no-framework',/" \ - -e "/'PYTHONFRAMEWORKPREFIX'/s/:.*$/:'',/" \ - -e "/'PYTHONFRAMEWORKINSTALLDIR'/s/:.*$/:'',/" \ - -e "/'LDLIBRARY'/s|:.*$|:'libpython${SLOT}.dylib',|" \ - "${libdir}"/_sysconfigdata.py || die - - # add missing version.plist file - mkdir -p "${D}${fwdir}"/Versions/${SLOT}/Resources - cat > "${D}${fwdir}"/Versions/${SLOT}/Resources/version.plist << EOF -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" -"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>BuildVersion</key> - <string>1</string> - <key>CFBundleShortVersionString</key> - <string>${PV}</string> - <key>CFBundleVersion</key> - <string>${PV}</string> - <key>ProjectName</key> - <string>Python</string> - <key>SourceVersion</key> - <string>${PV}</string> -</dict> -</plist> -EOF - else - emake DESTDIR="${D}" altinstall - fi - - sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die "sed failed" - - # Fix collisions between different slots of Python. - mv "${ED}usr/bin/2to3" "${ED}usr/bin/2to3-${SLOT}" - mv "${ED}usr/bin/pydoc" "${ED}usr/bin/pydoc${SLOT}" - mv "${ED}usr/bin/idle" "${ED}usr/bin/idle${SLOT}" - rm -f "${ED}usr/bin/smtpd.py" - - # http://src.opensolaris.org/source/xref/jds/spec-files/trunk/SUNWPython.spec - # These #defines cause problems when building c99 compliant python modules - # http://bugs.python.org/issue1759169 - [[ ${CHOST} == *-solaris* ]] && sed -i -e \ - 's:^\(^#define \(_POSIX_C_SOURCE\|_XOPEN_SOURCE\|_XOPEN_SOURCE_EXTENDED\).*$\):/* \1 */:' \ - "${ED}"/usr/include/python${SLOT}/pyconfig.h - - use berkdb || rm -r "${libdir}/"{bsddb,dbhash.py*,test/test_bsddb*} || die - use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die - use tk || rm -r "${ED}usr/bin/idle${SLOT}" "${libdir}/"{idlelib,lib-tk} || die - use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test} - - use threads || rm -r "${libdir}/multiprocessing" || die - use wininst || rm -r "${libdir}/distutils/command/"wininst-*.exe || die - - dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS} - - if use examples; then - insinto /usr/share/doc/${PF}/examples - doins -r "${S}"/Tools - fi - insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 - local libname - if use aqua ; then - # we do framework, so the emake trick below returns a pathname - # since that won't work here, use a (cheap) trick instead - libname=libpython${SLOT} - else - libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ - emake --no-print-directory -s -f - 2>/dev/null) - fi - newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py - - newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} - newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} - sed \ - -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ - -e "s:@PYDOC@:pydoc${SLOT}:" \ - -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" - - # for python-exec - local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) - - # if not using a cross-compiler, use the fresh binary - if ! tc-is-cross-compiler; then - local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) - local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} - local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} - local -x DYLD_FRAMEWORK_PATH="${WORKDIR}/${CHOST}" - else - vars=( PYTHON "${vars[@]}" ) - fi - - python_export "python${SLOT}" "${vars[@]}" - echo "EPYTHON='${EPYTHON}'" > epython.py || die - python_domodule epython.py - - # python-exec wrapping support - local pymajor=${SLOT%.*} - mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die - # python and pythonX - ln -s "../../../bin/python${SLOT}" "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die - ln -s "python${pymajor}" "${D}${PYTHON_SCRIPTDIR}/python" || die - # python-config and pythonX-config - ln -s "../../../bin/python${SLOT}-config" "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die - ln -s "python${pymajor}-config" "${D}${PYTHON_SCRIPTDIR}/python-config" || die - # 2to3, pydoc, pyvenv - ln -s "../../../bin/2to3-${SLOT}" "${D}${PYTHON_SCRIPTDIR}/2to3" || die - ln -s "../../../bin/pydoc${SLOT}" "${D}${PYTHON_SCRIPTDIR}/pydoc" || die - # idle - if use tk; then - ln -s "../../../bin/idle${SLOT}" "${D}${PYTHON_SCRIPTDIR}/idle" || die - fi -} - -eselect_python_update() { - if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then - eselect python update - fi - - if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then - eselect python update --python${PV%%.*} - fi -} - -pkg_postinst() { - eselect_python_update -} - -pkg_postrm() { - eselect_python_update -} diff --git a/dev-lang/python/python-3.10.4.ebuild b/dev-lang/python/python-3.10.4.ebuild new file mode 100644 index 0000000000..8e49381d8b --- /dev/null +++ b/dev-lang/python/python-3.10.4.ebuild @@ -0,0 +1,480 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="7" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils \ + python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_rc/rc} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" +PREFIX_PATCHSET="python-prefix-gentoo-${MY_PV}-patches-r0" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE="https://www.python.org/" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + https://dev.gentoo.org/~grobian/distfiles/${PREFIX_PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="aqua bluetooth build examples gdbm hardened libedit lto +ncurses pgo +readline +sqlite +ssl test tk wininst +xml" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + dev-lang/python-exec[python_targets_python3_10(-)] + dev-libs/libffi:= + kernel_linux? ( sys-apps/util-linux:= ) + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + virtual/libintl + gdbm? ( sys-libs/gdbm:=[berkdb] ) + ncurses? ( >=sys-libs/ncurses-5.2:= ) + readline? ( + !libedit? ( >=sys-libs/readline-4.1:= ) + libedit? ( dev-libs/libedit:= ) + ) + sqlite? ( >=dev-db/sqlite-3.3.8:3= ) + ssl? ( >=dev-libs/openssl-1.1.1:= ) + tk? ( + >=dev-lang/tcl-8.0:= + >=dev-lang/tk-8.0:= + dev-tcltk/blt:= + dev-tcltk/tix + ) + xml? ( >=dev-libs/expat-2.1:= ) + !!<sys-apps/sandbox-2.21 +" +# bluetooth requires headers from bluez +DEPEND=" + ${RDEPEND} + bluetooth? ( net-wireless/bluez ) + test? ( app-arch/xz-utils[extra-filters(+)] ) +" +# autoconf-archive needed to eautoreconf +BDEPEND=" + sys-devel/autoconf-archive + virtual/awk + virtual/pkgconfig + verify-sig? ( sec-keys/openpgp-keys-python ) + !sys-devel/gcc[libffi(-)] +" +RDEPEND+=" + build? ( app-misc/mime-types ) +" + +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + # Ensure that internal copies of expat, libffi and zlib are not used. + rm -fr Modules/expat || die + rm -fr Modules/_ctypes/libffi* || die + rm -fr Modules/zlib || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + # Prefix' round of patches + "${WORKDIR}"/${PREFIX_PATCHSET} + ) + + default + + sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \ + setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@" + + # force correct number of jobs + # https://bugs.gentoo.org/737660 + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die + sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die + + # workaround a problem on ppc-macos with >=GCC-8 where dtoa gets + # miscompiled when optimisation is being used + if [[ ${CHOST} == powerpc*-darwin* ]] && \ + tc-is-gcc && [[ $(gcc-major-version) -ge 8 ]] ; + then + sed -i \ + -e '/^CFLAGS_ALIASING=/s/$/ -fno-tree-ter/' Makefile.pre.in || die + fi + + # Darwin 9's kqueue seems to act up (at least at this stage), so + # make Python's selectors resort to poll() or select() + if [[ ${CHOST} == powerpc*-darwin9 ]] ; then + sed -i \ + -e 's/KQUEUE/KQUEUE_DISABLED/' \ + configure.ac configure || die + fi + + if [[ ${CHOST} == *-darwin19 ]] ; then + # HAVE_DYLD_SHARED_CACHE_CONTAINS_PATH is set because + # _dyld_shared_cache_contains_path could be found, yet it cannot + # be resolved when dlopen()ing, so simply pretend it doesn't + # exist here + sed -i \ + -e 's/_dyld_shared_cache_contains_path/disabled&/' \ + configure.ac configure || die + fi + + eautoreconf +} + +src_configure() { + local disable + # disable automagic bluetooth headers detection + use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no + use gdbm || disable+=" gdbm" + use ncurses || disable+=" _curses _curses_panel" + use readline || disable+=" readline" + use sqlite || disable+=" _sqlite3" + use ssl || export PYTHON_DISABLE_SSL="1" + use tk || disable+=" _tkinter" + use xml || disable+=" _elementtree pyexpat" # _elementtree uses pyexpat. + export PYTHON_DISABLE_MODULES="${disable}" + + if ! use xml; then + ewarn "You have configured Python without XML support." + ewarn "This is NOT a recommended configuration as you" + ewarn "may face problems parsing any XML documents." + fi + + if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then + einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}" + fi + + if [[ "$(gcc-major-version)" -ge 4 ]]; then + append-flags -fwrapv + fi + + filter-flags -malign-double + + # https://bugs.gentoo.org/show_bug.cgi?id=50309 + if is-flagq -O3; then + is-flagq -fstack-protector-all && replace-flags -O3 -O2 + use hardened && replace-flags -O3 -O2 + fi + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + tc-export CXX + + # Fix implicit declarations on cross and prefix builds. Bug #674070. + use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw + use prefix && append-ldflags -L"${ESYSROOT}"/lib -L"${ESYSROOT}"/usr/lib + + local dbmliborder + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use pgo; then + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + export PROFILE_TASK="-m test -j${jobs} --pgo-extended -x test_gdb -u-network" + + # All of these seem to occasionally hang for PGO inconsistently + # They'll even hang here but be fine in src_test sometimes. + # bug #828535 (and related: bug #788022) + PROFILE_TASK+=" -x test_socket -x test_asyncio -x test_httpservers -x test_logging -x test_multiprocessing_fork -x test_xmlrpc" + + if has_version "app-arch/rpm" ; then + # Avoid sandbox failure (attempts to write to /var/lib/rpm) + PROFILE_TASK+=" -x test_distutils" + fi + fi + + if use aqua ; then + ECONF_SOURCE="${S}" OPT="" \ + econf \ + --enable-framework="${EPREFIX}" \ + --config-cache + fi + + # flock on 32-bits sparc Solaris is broken + [[ ${CHOST} == sparc-*-solaris* ]] && \ + export ac_cv_flock_decl=no + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + # except on non-glibc systems this breaks the build, so be + # conservative! + $(use elibc_glibc && echo ac_cv_header_stropts_h=no) + + $(use aqua && echo --config-cache) + --enable-shared + --without-static-libpython + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-system-ffi + + $(use_with lto) + $(use_enable pgo optimizations) + $(use_with readline readline "$(usex libedit editline readline)") + ) + + # disable implicit optimization/debugging flags + local -x OPT= + # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get + # propagated to sysconfig for built extensions + local -x CFLAGS_NODIST=${CFLAGS} + local -x LDFLAGS_NODIST=${LDFLAGS} + local -x CFLAGS= LDFLAGS= + + econf "${myeconfargs[@]}" + + if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then + eerror "configure has detected that the sem_open function is broken." + eerror "Please ensure that /dev/shm is mounted as a tmpfs with mode 1777." + die "Broken sem_open function (bug 496328)" + fi +} + +src_compile() { + # Ensure sed works as expected + # https://bugs.gentoo.org/594768 + local -x LC_ALL=C + # Prevent using distutils bundled by setuptools. + # https://bugs.gentoo.org/823728 + export SETUPTOOLS_USE_DISTUTILS=stdlib + + # Save PYTHONDONTWRITEBYTECODE so that 'has_version' doesn't + # end up writing bytecode & violating sandbox. + # bug #831897 + local -x _PYTHONDONTWRITEBYTECODE=${PYTHONDONTWRITEBYTECODE} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict /usr/lib/python3.10/site-packages + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # Skip failing tests. + local skipped_tests="gdb" + + if use sparc ; then + # bug #788022 + skipped_tests+=" multiprocessing_fork" + skipped_tests+=" multiprocessing_forkserver" + fi + + for test in ${skipped_tests}; do + mv "${S}"/Lib/test/test_${test}.py "${T}" + done + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite /usr/lib/python3.10/site-packages + + local jobs=$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)") + + emake test EXTRATESTOPTS="-u-network -j${jobs}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local result=$? + + for test in ${skipped_tests}; do + mv "${T}/test_${test}.py" "${S}"/Lib/test + done + + elog "The following tests have been skipped:" + for test in ${skipped_tests}; do + elog "test_${test}.py" + done + + elog "If you would like to run them, you may:" + elog "cd '${EPREFIX}/usr/lib/python${PYVER}/test'" + elog "and run the tests separately." + + if [[ ${result} -ne 0 ]]; then + die "emake test failed" + fi +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + emake DESTDIR="${D}" altinstall + + if use aqua ; then + # avoid config.status to be triggered + find Mac -name "Makefile" -exec touch \{\} + || die + + # Python_Launcher is kind of a wrapper, and we should fix it for + # Prefix (it uses /usr/bin/pythonw) so useless + # IDLE doesn't run, no idea, but definitely not used + emake DESTDIR="${D}" -C Mac install_Python || die + rmdir "${ED}"/Applications/Python* || die + rmdir "${ED}"/Applications || die + + local fwdir=/Frameworks/Python.framework/Versions/${PYVER} + ln -s "${EPREFIX}"/usr/include/python${PYVER} \ + "${ED}${fwdir}"/Headers || die + ln -s "${EPREFIX}"/usr/lib/libpython${PYVER}.dylib \ + "${ED}${fwdir}"/Python || die + fi + + # Fix collisions between different slots of Python. + rm -f "${ED}/usr/$(get_libdir)/libpython3$(get_libname)" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + use sqlite || rm -r "${libdir}/"{sqlite3,test/test_sqlite*} || die + use tk || rm -r "${ED}/usr/bin/idle${PYVER}" "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + if use aqua ; then + # we do framework, so the emake trick below returns a pathname + # since that won't work here, use a (cheap) trick instead + local libname=libpython${PYVER} + else + local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \ + emake --no-print-directory -s -f - 2>/dev/null) + fi + newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + local -x EPYTHON=python${PYVER} + # if not using a cross-compiler, use the fresh binary + if ! tc-is-cross-compiler; then + local -x PYTHON=./python$(sed -n '/BUILDEXE=/s/^.*=\s\+//p' Makefile) + local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} + local -x DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH+${DYLD_LIBRARY_PATH}:}${PWD} + else + local -x PYTHON=${EPREFIX}/usr/bin/${EPYTHON} + fi + + echo "EPYTHON='${EPYTHON}'" > epython.py || die + python_domodule epython.py + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" \ + "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" \ + "${scriptdir}/python-config" || die + # 2to3, pydoc + ln -s "../../../bin/2to3-${PYVER}" \ + "${scriptdir}/2to3" || die + ln -s "../../../bin/pydoc${PYVER}" \ + "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" \ + "${scriptdir}/idle" || die + fi +} |