commit:     5ff1db16d154f92d0021af65d23d5b3b3790ba71
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 29 09:48:16 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Dec 29 10:11:04 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ff1db16

dev-lang/python: Bump 2.7.17 to EAPI 7, unify

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-lang/python/Manifest                           |   1 +
 ...ython-3.6.10.ebuild => python-2.7.17-r1.ebuild} | 153 +++++++++++----------
 dev-lang/python/python-3.6.10.ebuild               |   6 +-
 3 files changed, 88 insertions(+), 72 deletions(-)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index 7165b0d55c1..c974616a85a 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -10,6 +10,7 @@ DIST Python-3.8.1.tar.xz 17828408 BLAKE2B 
db1841625de89b812cadcd538a990401a4e49d
 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.10.tar.xz 10964 BLAKE2B 
e32c8cb3050c7324ee234f585be7fc40cfacc6ad87759eaa300e57289e6dc6cbaed3913f33ad632b8754638e8d71983d8364ceeaad8ef325cfa6d4d2dfb56df0
 SHA512 
71fea7306c876c63888c4547eaf14dc2e0413dec343609d748cd1b5888e4605d47888758ebc5120a287ce833b69dd538073f91989460da7c40462b53eefca7ce
 DIST python-gentoo-patches-3.6.8.tar.xz 11224 BLAKE2B 
5fe38282bcf28df18e0bd37756c880ae191ea738dc92f1cf83f682cfdc52525b9c44287dc99191a73d75c90672ab501b56adf49515b35ff1fdee88c8dc07b175
 SHA512 
89e700663db25d6d78eee1d4bfdab686c5341a794062f3a63df3485ac0b58deb4b4885d24701f3ae138d06ca783be92e310e1100c6d633910c33732f3cb0d7df
 DIST python-gentoo-patches-3.7.4-1.tar.xz 10100 BLAKE2B 
63e8fada89b64b59ba083745626a1e8a07bec0cf93b7b6ab405c33a0f2932cbe497a331c52895a07f10434b230c438f27c9582efecdd57f3bad15d9aa604d157
 SHA512 
11b0e811a9890a1235c85426061b35f9964eba64cac0536f4c9e0498b1cc66eb005f14aed34eead735b43e91c2b5babced60e3310f5329231a1706871b95b547
 DIST python-gentoo-patches-3.7.6.tar.xz 10084 BLAKE2B 
220869e85bdaf9c21b1b05e13803bdb6ecc22ac0f69da77e57fd7c1cd93ef45ec43401b62732842e1bb3467feb6d65c8204120e2741e9eb6f4cab673fd3a8d62
 SHA512 
4c04b0cf7da55fa7973ab178e3ac2c59bc2142924bdced5954c058053280b6c663d7c39912286d10fe0e82ca30af6a0dd6a56fa85433f836217ca3dcbb284def

diff --git a/dev-lang/python/python-3.6.10.ebuild 
b/dev-lang/python/python-2.7.17-r1.ebuild
similarity index 70%
copy from dev-lang/python/python-3.6.10.ebuild
copy to dev-lang/python/python-2.7.17-r1.ebuild
index c0c1738557f..424cdec1208 100644
--- a/dev-lang/python/python-3.6.10.ebuild
+++ b/dev-lang/python/python-2.7.17-r1.ebuild
@@ -8,19 +8,18 @@ inherit autotools flag-o-matic pax-utils python-utils-r1 
toolchain-funcs
 
 MY_P="Python-${PV}"
 PYVER=$(ver_cut 1-2)
-PATCHSET_VERSION="3.6.8"
+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/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz";
+       
https://dev.gentoo.org/~mgorny/dist/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz";
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="PSF-2"
-SLOT="${PYVER}/${PYVER}m"
+SLOT="${PYVER}"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86"
-IUSE="bluetooth build examples gdbm hardened ipv6 libressl +ncurses +readline 
sqlite +ssl test +threads tk wininst +xml"
-RESTRICT="!test? ( test )"
+IUSE="-berkdb bluetooth build 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
@@ -28,10 +27,20 @@ RESTRICT="!test? ( test )"
 # patchset. See bug 447752.
 
 RDEPEND="app-arch/bzip2:=
-       app-arch/xz-utils:=
        >=sys-libs/zlib-1.1.3:=
        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:=[berkdb] )
        ncurses? ( >=sys-libs/ncurses-5.2:= )
        readline? ( >=sys-libs/readline-4.1:= )
@@ -50,12 +59,26 @@ RDEPEND="app-arch/bzip2:=
 # bluetooth requires headers from bluez
 DEPEND="${RDEPEND}
        bluetooth? ( net-wireless/bluez )
-       test? ( app-arch/xz-utils[extra-filters(+)] )
        virtual/pkgconfig
        !sys-devel/gcc[libffi(-)]"
 RDEPEND+=" !build? ( app-misc/mime-types )"
 PDEPEND=">=app-eselect/eselect-python-20140125-r1"
 
+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 -fr Modules/expat || die
@@ -64,6 +87,11 @@ src_prepare() {
 
        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
@@ -77,14 +105,17 @@ src_prepare() {
                Makefile.pre.in \
                Modules/Setup.dist \
                Modules/getpath.c \
-               configure.ac \
                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"
@@ -118,11 +149,20 @@ src_configure() {
                use hardened && replace-flags -O3 -O2
        fi
 
-       # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile.
+       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 -lpython3.2 correctly.
-       # Needed on FreeBSD unless Python 3.2 is already installed.
+       # 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."
 
@@ -130,21 +170,30 @@ src_configure() {
        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
-               --without-ensurepip
                --with-system-expat
                --with-system-ffi
+               --without-ensurepip
        )
 
        OPT="" econf "${myeconfargs[@]}"
@@ -161,7 +210,10 @@ src_compile() {
        # https://bugs.gentoo.org/594768
        local -x LC_ALL=C
 
-       emake CPPFLAGS= CFLAGS= LDFLAGS=
+       # 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
@@ -179,7 +231,7 @@ src_test() {
        fi
 
        # Skip failing tests.
-       local skipped_tests="gdb"
+       local skipped_tests="distutils gdb"
 
        for test in ${skipped_tests}; do
                mv "${S}"/Lib/test/test_${test}.py "${T}"
@@ -188,10 +240,14 @@ src_test() {
        # bug 660358
        local -x COLUMNS=80
 
-       local -x PYTHONDONTWRITEBYTECODE=
+       # Daylight saving time problem
+       # https://bugs.python.org/issue22067
+       # https://bugs.gentoo.org/610628
+       local -x TZ=UTC
 
-       emake test EXTRATESTOPTS="-u-network" CPPFLAGS= CFLAGS= LDFLAGS= < 
/dev/tty
-       local result=$?
+       # 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
@@ -216,39 +272,18 @@ src_install() {
 
        emake DESTDIR="${D}" altinstall
 
-       # Remove static library
-       rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
-
-       sed \
-               -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
-               -e "s/\(PY_LDFLAGS=\).*/\1/" \
-               -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
+       sed -e "s/\(LDFLAGS=\).*/\1/" -i "${libdir}/config/Makefile" || die
 
        # Fix collisions between different slots of Python.
-       rm "${ED}/usr/$(get_libdir)/libpython3.so" || 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
+       mv "${ED}/usr/bin/2to3" "${ED}/usr/bin/2to3-${PYVER}" || die
+       mv "${ED}/usr/bin/pydoc" "${ED}/usr/bin/pydoc${PYVER}" || die
+       mv "${ED}/usr/bin/idle" "${ED}/usr/bin/idle${PYVER}" || die
+       rm "${ED}/usr/bin/smtpd.py" || die
 
+       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${PYVER}" 
"${libdir}/"{idlelib,tkinter,test/test_tk*} || die
+       use tk || rm -r "${ED}/usr/bin/idle${PYVER}" 
"${libdir}/"{idlelib,lib-tk} || die
+       use elibc_uclibc && rm -fr "${libdir}/"{bsddb/test,test}
 
        use threads || rm -r "${libdir}/multiprocessing" || die
        use wininst || rm "${libdir}/distutils/command/"wininst-*.exe || die
@@ -257,7 +292,6 @@ src_install() {
 
        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
@@ -292,17 +326,12 @@ src_install() {
        local pymajor=${PYVER%.*}
        mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
        # python and pythonX
-       ln -s "../../../bin/${abiver}" \
+       ln -s "../../../bin/python${PYVER}" \
                "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die
        ln -s "python${pymajor}" "${D}${PYTHON_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 > "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" <<-EOF || die
-               #!/bin/sh
-               exec "${abiver}-config" "\${@}"
-       EOF
-       chmod +x "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
+       ln -s "../../../bin/python${PYVER}-config" \
+               "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die
        ln -s "python${pymajor}-config" \
                "${D}${PYTHON_SCRIPTDIR}/python-config" || die
        # 2to3, pydoc, pyvenv
@@ -310,8 +339,6 @@ src_install() {
                "${D}${PYTHON_SCRIPTDIR}/2to3" || die
        ln -s "../../../bin/pydoc${PYVER}" \
                "${D}${PYTHON_SCRIPTDIR}/pydoc" || die
-       ln -s "../../../bin/pyvenv-${PYVER}" \
-               "${D}${PYTHON_SCRIPTDIR}/pyvenv" || die
        # idle
        if use tk; then
                ln -s "../../../bin/idle${PYVER}" \
@@ -319,12 +346,6 @@ src_install() {
        fi
 }
 
-pkg_preinst() {
-       if has_version "<${CATEGORY}/${PN}-${PYVER}" && ! has_version 
">=${CATEGORY}/${PN}-${PYVER}_alpha"; then
-               python_updater_warning="1"
-       fi
-}
-
 eselect_python_update() {
        if [[ -z "$(eselect python show)" || \
                        ! -f "${EROOT}/usr/bin/$(eselect python show)" ]]; then
@@ -340,12 +361,6 @@ eselect_python_update() {
 
 pkg_postinst() {
        eselect_python_update
-
-       if [[ "${python_updater_warning}" == "1" ]]; then
-               ewarn "You have just upgraded from an older version of Python."
-               ewarn
-               ewarn "Please adjust PYTHON_TARGETS (if so desired), and run 
emerge with the --newuse or --changed-use option to rebuild packages installing 
python modules."
-       fi
 }
 
 pkg_postrm() {

diff --git a/dev-lang/python/python-3.6.10.ebuild 
b/dev-lang/python/python-3.6.10.ebuild
index c0c1738557f..43dc80e812f 100644
--- a/dev-lang/python/python-3.6.10.ebuild
+++ b/dev-lang/python/python-3.6.10.ebuild
@@ -8,12 +8,12 @@ inherit autotools flag-o-matic pax-utils python-utils-r1 
toolchain-funcs
 
 MY_P="Python-${PV}"
 PYVER=$(ver_cut 1-2)
-PATCHSET_VERSION="3.6.8"
+PATCHSET="python-gentoo-patches-3.6.10"
 
 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/~mgorny/dist/python/${PATCHSET}.tar.xz";
 S="${WORKDIR}/${MY_P}"
 
 LICENSE="PSF-2"
@@ -63,7 +63,7 @@ src_prepare() {
        rm -fr Modules/zlib || die
 
        local PATCHES=(
-               "${WORKDIR}/patches"
+               "${WORKDIR}/${PATCHSET}"
        )
 
        default

Reply via email to