dev-lang/python: Bump to 2.7.17
authorMichał Górny <mgorny@gentoo.org>
Mon, 11 Nov 2019 16:55:03 +0000 (17:55 +0100)
committerMichał Górny <mgorny@gentoo.org>
Mon, 11 Nov 2019 17:47:11 +0000 (18:47 +0100)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
dev-lang/python/Manifest
dev-lang/python/python-2.7.17.ebuild [new file with mode: 0644]

index 5ef846e590de81aa850b707e58c15577f2c2603d..db2c8ef3c8fcd9726444f0d440339ae73ed97d80 100644 (file)
@@ -1,5 +1,6 @@
 DIST Python-2.7.15.tar.xz 12642436 BLAKE2B d8783a48ea26695e8d4677397a08194c738d7e4bc8ecaddaab609ad1fd5a1ca07701f707fe38d259f6bd44a39171ef95e7530f3df4bcb4d94abc4d21d7e2d489 SHA512 27ea43eb45fc68f3d2469d5f07636e10801dee11635a430ec8ec922ed790bb426b072da94df885e4dfa1ea8b7a24f2f56dd92f9b0f51e162330f161216bd6de6
 DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 7d6b5b853f9974d44e04dd35ecdffaab87511e183b4b01dd4f8f4ee109c4b4ab208f045708f69717be9d3a706aa078b71438ed482c062c0b89c12730eae074ae SHA512 16e814e8dcffc707b595ca2919bd2fa3db0d15794c63d977364652c4a5b92e90e72b8c9e1cc83b5020398bd90a1b397dbdd7cb931c49f1aa4af6ef95414b43e0
+DIST Python-2.7.17.tar.xz 12855568 BLAKE2B 6d09214a51d6595fe5253a279ee556d7510dcb9a0e8ad71e9cf73b4fb00c3abd3680e2429f4f87d9387d1fc16d4887f5f33fc600b24b0ca2c70f36bf34df2157 SHA512 2dc19a0b0d818c71429dae94783e58b2aac0fa31f5faa1e840cac06245a59932ecc4658d913515736601bcf70a78c9ec60367aed75f4567d1e41ff3bb104da9a
 DIST Python-3.5.5.tar.xz 15351440 BLAKE2B 217cb7f51e04d57983ce053ff4276d056e17c8223b6f3d87b69f556453fe2ae3d4dc2c1a6b9c2c6aad033cea9b40cd32264d8208cc81a1ec34ff252379bf95b8 SHA512 c9056baee6a2d1fe7f14b1f310db95b78e8972766d086f8ae10954f38f8182956171580bde01ddadebe897f2545a6fbe47669ca3e4887026ac1fae5ee9197f22
 DIST Python-3.5.7.tar.xz 15324736 BLAKE2B 0f1dd80584385b7f859652c85dc6b51bf71cd9f1d53fcf1716c54e8ffc3d2a36ef9969956e4429ac1ba878dad1e9acbb5f82ddb6a9923886bf3c84b3327dfecb SHA512 83f57451e1d7082bf19e4e49a0902e9257e381836d9a04154a6b276135fa49e5c96b6869eed9ec4475e06b76556c1ae89f5cca111b762eb8b2dee6f65373e0f4
 DIST Python-3.5.9.tar.xz 15388876 BLAKE2B 6086ed2350b6dce3203360f24c2fddf77df65a5815d6da019809796b30c2f43440a9e349c7defd0187cfc3a50a387352dfa63594c2ec513dd6bf585e7c34ec51 SHA512 58127793adef42ed57ae4d56338268866e14c2d084f09f57f26fc6b1c9454e70cc6d3dffc638f8d56f182acc0884021a4dbb578f312dd6fc01995fa85e31377e
@@ -12,6 +13,7 @@ DIST Python-3.7.4.tar.xz 17131432 BLAKE2B e175f750f1fa610a19a40f382ae5e652de12c7
 DIST Python-3.7.5.tar.xz 17236432 BLAKE2B fb49a3bfd9b1944d567a45682f789ef840e63ed610e0dddb5695da7a84a0bcb50a6fa52097722f09b57d6fc15a5f89aeaa46a061125219e597897086f3dffe40 SHA512 f4f3879881f260f58dbb041fb0f2f210d4b70b02a739e41e50e6fea67d31855a7a29ce4ebef66bfde3d0edf54b946a48f78490f986da965357b835d4dbb3f414
 DIST python-gentoo-patches-2.7.15.tar.xz 16208 BLAKE2B 5739c2b3a236d48f8e33f0fe6515bfe7a8f99096f6223b402653988feac2513d37d26b6e40e5e049852f42657358170e468ca60097e0e2294e760787c12ad591 SHA512 687fd008d1d41b1e65ce5417f6f6aba84ffd42f7af44ef97c03a7806b28e6888f8df043a0c15187a8b229cc17642853e6feb25494db97f4d10f8a66f8ebcbcca
 DIST python-gentoo-patches-2.7.16.tar.xz 13904 BLAKE2B 218b46f8656f4a792dcd47eabca6d59a1558276b77676544991ee75914cd76dda84c36f43e72e477b850dd4cb52374d289f20dccd244a3b52ae5debaf3363432 SHA512 83f90545231c663a34c6925352a357a2b15997ac0362578a1893304c5070b5251922585ae8bc1bafb68d306bcddd4cdba4b6406648d473bd3e980eef65fe3ecd
+DIST python-gentoo-patches-2.7.17.tar.xz 13476 BLAKE2B 788688e2941d2d6d4f768168881b2c3639213a97e214557b3a93f8db44d81e2b6d70be847b7462e54e3786660ebee4ee331402081d92167d74ad149279c3f389 SHA512 1641737635d33607a77ed2ee2462854cec603be39737de3f81abb188702aaf46f039d1616f9dcd413da1f4a8040175c66a2883e496132c2e4ebe8f860b36f9f1
 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.8.tar.xz 11224 BLAKE2B 5fe38282bcf28df18e0bd37756c880ae191ea738dc92f1cf83f682cfdc52525b9c44287dc99191a73d75c90672ab501b56adf49515b35ff1fdee88c8dc07b175 SHA512 89e700663db25d6d78eee1d4bfdab686c5341a794062f3a63df3485ac0b58deb4b4885d24701f3ae138d06ca783be92e310e1100c6d633910c33732f3cb0d7df
diff --git a/dev-lang/python/python-2.7.17.ebuild b/dev-lang/python/python-2.7.17.ebuild
new file mode 100644 (file)
index 0000000..2df6351
--- /dev/null
@@ -0,0 +1,361 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+WANT_LIBTOOL="none"
+
+inherit autotools flag-o-matic pax-utils python-utils-r1 toolchain-funcs
+
+MY_P="Python-${PV}"
+PATCHSET_VERSION="2.7.17"
+
+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-gentoo-patches-${PATCHSET_VERSION}.tar.xz"
+
+LICENSE="PSF-2"
+SLOT="2.7"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="-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=
+       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=
+               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"
+
+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
+
+       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.
+               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
+
+       # Export CXX so it ends up in /usr/lib/python2.X/config/Makefile.
+       tc-export 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!
+       append-ldflags "-L."
+
+       local dbmliborder
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+       if use berkdb; then
+               dbmliborder+="${dbmliborder:+:}bdb"
+       fi
+
+       local myeconfargs=(
+               # The check is broken on clang, and gives false positive:
+               # https://bugs.gentoo.org/596798
+               # (upstream dropped this flag in 3.2a4 anyway)
+               ac_cv_opt_olimit_ok=no
+
+               --with-fpectl
+               --enable-shared
+               $(use_enable ipv6)
+               $(use_with threads)
+               $(use wide-unicode && 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}
+
+       emake DESTDIR="${D}" altinstall
+
+       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"
+
+       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
+               docinto examples
+               dodoc -r "${S}"/Tools
+       fi
+       insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
+       local libname=$(printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | \
+               emake --no-print-directory -s -f - 2>/dev/null)
+       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
+               local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD}
+       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
+}