summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-03-22 10:55:12 +0100
committerFabian Groffen <grobian@gentoo.org>2019-03-22 10:55:12 +0100
commit5b59455e7e26ea6338774b5740a39639ad6ceccd (patch)
tree18af4751d68d16e34dbb33162e5ca853dccb0f17 /dev-lang
parentscripts/bootstrap-prefix: bootstrap libressl for wget to use (diff)
downloadprefix-5b59455e7e26ea6338774b5740a39639ad6ceccd.tar.gz
prefix-5b59455e7e26ea6338774b5740a39639ad6ceccd.tar.bz2
prefix-5b59455e7e26ea6338774b5740a39639ad6ceccd.zip
dev-lang/python: version bump v2.7.x
Package-Manager: Portage-2.3.62-prefix, Repoman-2.3.12 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/python/Manifest3
-rw-r--r--dev-lang/python/python-2.7.16.ebuild625
2 files changed, 628 insertions, 0 deletions
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index 91bc0e1dd5..a521fd1324 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -1,15 +1,18 @@
DIST Python-2.7.14.tar.xz 12576112 BLAKE2B e03c4134cfdd88678acc26f383130a598ce4de908ab6bb9ee00e9235de3e0fcb9e653fec86f39db64fb895ef797d33736524655c5b94fab2cde2544b966b2cfb SHA512 78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9
+DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 7d6b5b853f9974d44e04dd35ecdffaab87511e183b4b01dd4f8f4ee109c4b4ab208f045708f69717be9d3a706aa078b71438ed482c062c0b89c12730eae074ae SHA512 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0
DIST Python-3.4.8.tar.xz 14576444 BLAKE2B 262b82fbc0e4852216d2edf05f9e9194bc93be7b14a2d6ef56789b808cff274e58b2fa7134955464fd05ab36181b5861aeca31e2e05b27f0f58ac66d145bd56b SHA512 478552c72efe606cb1993024b81839c51d01f1c949564c007ab2b76016f110e1f7bd418e5de3f4f93b466ce7dbe6583d3c150830d1f28f75e0809625b568a7ec
DIST Python-3.5.4.tar.xz 15332320 BLAKE2B 1fc3ba4eb1ed949062961c13fd1f9851c7f9cbeb4916c06a0389349ee2d4872b2b1c2d30138822e6329b6a715f35a66df704b7a04aa4adeb95b685b8d6e45d61 SHA512 dbbe2740ee1cce5404b7b6436a9b3887e15f415a1006efa22014ec7e5b1e48c43eed0ff98f6f5b365c527b8d2525be4ce72bbe404ce71c0835529fcd6f0267ff
DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22
DIST Python-3.6.5.tar.xz 17049912 BLAKE2B f393e9563a18a46c457afcd2e174d9eacda20fe2b0ae5461e11c582fa4d27b85c01bbe7b602f45511b6b44f635c6330205b12fb3e8325ffd07e87b78a8258889 SHA512 6b26fcd296b9bd8e67861eff10d14db7507711ddba947288d16d6def53135c39326b7f969c04bb2b2993f924d9e7ad3f5c5282a3915760bc0885cf0a8ea5eb51
DIST Python-3.6.6.tar.xz 17156744 BLAKE2B fa4333149f84570cc4a0d1ec76c819610888750a51268b9db7d05df7d9c11e5ed72daff5d81b404015d9c678cb034d8a32034262ce73629ee8f96772853a706c SHA512 c71f87c5906e770322a14cacad228655659f782207db826320449d12bf86091c3662f317e1773158dec52f8b052eaedfb4c03b561cc2a6cfcd381597fd2d2b04
DIST python-gentoo-patches-2.7.14-0.tar.xz 13428 BLAKE2B 0048e48ddaaa4bef08451354fde95a123042880f26dddc9267c7f9a90fd8abb40955e26ee8c9dfc5a1165556bb3e11585b27288e635d42a4000dd3d7654c41ad SHA512 6da5b52065752b54e9215d0f0809c75167dc3690d0e94fa21dd7595626925bc5c1dd065d31b3bd696d7087f3986de145d3a335a29eb7bd77442637a7ec2863c1
+DIST python-gentoo-patches-2.7.16.tar.xz 13904 BLAKE2B 218b46f8656f4a792dcd47eabca6d59a1558276b77676544991ee75914cd76dda84c36f43e72e477b850dd4cb52374d289f20dccd244a3b52ae5debaf3363432 SHA512 83f90545231c663a34c6925352a357a2b15997ac0362578a1893304c5070b5251922585ae8bc1bafb68d306bcddd4cdba4b6406648d473bd3e980eef65fe3ecd
DIST python-gentoo-patches-3.4.6-0.tar.xz 11728 BLAKE2B 2a636f5500f4c7d354f421133f086cba9a25c30d5feaaa2dc25c9c588125d7c9097baecaa11f31548fa598b5dc137ca310ad86222510c0a955fa632a6d0a4b06 SHA512 41c22dc8f1db8800fc0b97eed2b27bf1873e5de1369bd4aecf7a7a91e609a78e45a4b56fc89d575317f33a7704c0c1cad1494e8a993415a198f256e8338f49ab
DIST python-gentoo-patches-3.5.4-0.tar.xz 11704 BLAKE2B 4a7d71feff18c7c8c109bed10748348484d314183c3de3ec950d5ca5ce7048bb322c470f3f5bff2d63eb7f2ed99c0fe75c621df050273d9d118681b28926061d SHA512 d395a87695f700598026038d6929ea5038abd7d494294037a4dfa02d5262203dbbaa6ae258a5a7f35ff5542f6266dcf69cc0b9c3df2a047cd2f6699a87e182ec
DIST python-gentoo-patches-3.6.4.tar.xz 12888 BLAKE2B 7cf49ae22df53e855f2e99df51686b5d4bd0da82ef4c22836e24726ea9ed561808352c0305a5659b052d38b843f1ff61b6466a7bc3673b7e5cfb4d81d22fa4bc SHA512 90a1b685f2539872ffd67f96581f70145b7afaf18af19f4a7f4a61214103d2a10bf0069c1769dac229ae011fceaf8538f041082b33c1671905246d018d184dd7
DIST python-gentoo-patches-3.6.6.tar.xz 13876 BLAKE2B 4be56b54e70c9b83209734097e03a7dbaa8f46ae13e268fc6a7f465ffd052ce03ca9e1fc45f1d432f2de17d4ce16ca8bc684b24344862cd8f52f9d1a90d90b7a SHA512 534b9eaefcbc45908119852a103bf10e400a8628c66aa599812fbceda36810d626d33e6701d1b7866e4df68397f717df6a217cb414049ca6f378eff9f43a27ab
DIST python-prefix-2.7.14-gentoo-patches-r0.tar.xz 14736 BLAKE2B 75422fc7390f559d9864f6e22a0b85982ccbdb07d5f2507db8e528285e56d1f11d4bc0b21a0b78d5340eafd562220d2f1b9d0a78b1f7c811c5689a426a81f9f3 SHA512 bf8e5039fff834d03a5a671269905f1ea10961995f2327ea023f6ad4d9b49bf210ec746ac6f45a01ff7501f1eb616013951d164410f6c64bce04df0e8b9715c8
+DIST python-prefix-2.7.16-gentoo-patches-r0.tar.xz 14636 BLAKE2B 54320f5197bb7adeca1e7c97447253e6535a11f380b6d66bc2ce46fa671fe23697aced8fd5619633a00e3ea19ae9dbc3ffe2981173d83dcab6b447d514555c43 SHA512 5380d9b92eb81603ec4d60ff9c940a3a061c06bd6f593d5837e600da5d4417b529d20d98d758aa95cef18fac10bdb5c33f90fa943deb15fdaf048492cf286581
DIST python-prefix-3.4.8-gentoo-patches-r0.tar.xz 12928 BLAKE2B d270f27485a70b4186c0d509836f66e6ae8218270cbb0a473b4579de7a8d9fa16eb2387d0441979aa62fc88e54a52f863c58d91b3df64dd6a40ad4bc4236cbb2 SHA512 84554d2b320922d7ac6e20012f847a81d6501693a4d9f2146faa8764fca4fbc5e3bf1c0f352853f1ab34ed905ab13097f2e82285ada54c9b4e219e72b39804c2
DIST python-prefix-3.5.4-gentoo-patches-r0.tar.xz 12768 BLAKE2B ab0cbc5430e9588f71cfd7b001a07f9a77097262f17e1f980e3945e39855e1c9437117bf4eb2d424dadf701d37d025e09627d7efdbb9f8867714039f62f261a7 SHA512 334cd8990483f973386cc6bbc962d2843449c493f7d33349fcc8f68120e246c52ea80236c99685555974e439fa877b537b32ef7d181198f58950f5e9b835b1c5
DIST python-prefix-3.6.5-gentoo-patches-r0.tar.xz 12728 BLAKE2B 8193b5eb59aaa923be299e1a68c62a2341be6d2367eb34a8e03436248a0c180012ba60e738ded7ca7f58849cde070b364761922518a5cdc425602172291aa2b0 SHA512 3bb1a97885112fb853b9ad061f21ba1f661e397d5585d932ddebe3107267be512799f966aef92e599ce2c97a4d51ec48bb214aa999b370b8d5a594e6f92182b6
diff --git a/dev-lang/python/python-2.7.16.ebuild b/dev-lang/python/python-2.7.16.ebuild
new file mode 100644
index 0000000000..6d65eb7c60
--- /dev/null
+++ b/dev-lang/python/python-2.7.16.ebuild
@@ -0,0 +1,625 @@
+# Copyright 1999-2019 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="~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="aqua -berkdb bluetooth build doc elibc_uclibc examples gdbm hardened ipv6 libressl +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=
+ !m68k-mint? ( 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? (
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl: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
+ # On AIX, we've wrapped /usr/ccs/bin/nm to work around long TMPDIR.
+ sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || 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.
+ [[ ${CHOST} == *-aix* ]] ||
+ 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
+
+ [[ ${CHOST} == *-mint* ]] && export ac_cv_func_poll=no
+
+ # 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
+ )
+
+ 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
+
+ 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
+
+ # 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}
+
+ [[ ${CHOST} == *-mint* ]] && keepdir /usr/lib/python${SLOT}/lib-dynload/
+ 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 incompatability, 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"
+ if [[ ${CHOST} == *-aix* ]]; then
+ # fix upstream bugs with quite large proposed diffs still to be sorted out:
+ # http://bugs.python.org/issue13493
+ # http://bugs.python.org/issue14150
+ # http://bugs.python.org/issue15590
+ # http://bugs.python.org/issue16189
+ sed -e "/Libs:/s|\$| -Wl,-bE:${EPREFIX}/${libdir#$ED}/config/python.exp -lld|" \
+ -i "${ED}"usr/$(get_libdir)/pkgconfig/python-${SLOT}.pc || die "sed failed"
+ sed -e "s|:Modules/python.exp|:${EPREFIX}/${libdir#$ED}/config/python.exp|" \
+ -e 's| -bI:| -Wl,-bI:|g' \
+ -e '/LINKFORSHARED/s|-bE:|-bI:|g' \
+ -e '/LINKFORSHARED/s| -lld||g' \
+ -i "${libdir}"/{_sysconfigdata.py,config/Makefile} || die "sed failed"
+ fi
+
+ # 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
+}