commit:     3ccc04682f887968270a82fc3d7fe3e0093dc66d
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 22 10:38:10 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Mar 22 10:38:10 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=3ccc0468

dev-lang/python: version bump v3.5.x

Package-Manager: Portage-2.3.62-prefix, Repoman-2.3.12
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 dev-lang/python/Manifest            |   2 +
 dev-lang/python/python-3.5.7.ebuild | 439 ++++++++++++++++++++++++++++++++++++
 2 files changed, 441 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index a521fd1324..9cba836686 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -3,6 +3,7 @@ DIST Python-2.7.16.tar.xz 12752104 BLAKE2B 
7d6b5b853f9974d44e04dd35ecdffaab87511
 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.5.7.tar.xz 15324736 BLAKE2B 
0f1dd80584385b7f859652c85dc6b51bf71cd9f1d53fcf1716c54e8ffc3d2a36ef9969956e4429ac1ba878dad1e9acbb5f82ddb6a9923886bf3c84b3327dfecb
 SHA512 
83f57451e1d7082bf19e4e49a0902e9257e381836d9a04154a6b276135fa49e5c96b6869eed9ec4475e06b76556c1ae89f5cca111b762eb8b2dee6f65373e0f4
 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
@@ -15,6 +16,7 @@ DIST python-prefix-2.7.14-gentoo-patches-r0.tar.xz 14736 
BLAKE2B 75422fc7390f559
 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.5.7-gentoo-patches-r0.tar.xz 12716 BLAKE2B 
162244df0abf05bc7da984cc0078bfd6cd9194e0ccbe81b75e85bbb5a9f8498838d729461ce36e230f05d8a02d5caef954686a52ff7789bae6ddda02f980b7f1
 SHA512 
361cb2274ca2721d903171d5f8f4ed5d4d9f67a48a738084a53bf607b9393e3b6cbc7e574e15fc423ca2478cf03ffd5b71bb70ffb28f4a2d4de3109e0037c1bb
 DIST python-prefix-3.6.5-gentoo-patches-r0.tar.xz 12728 BLAKE2B 
8193b5eb59aaa923be299e1a68c62a2341be6d2367eb34a8e03436248a0c180012ba60e738ded7ca7f58849cde070b364761922518a5cdc425602172291aa2b0
 SHA512 
3bb1a97885112fb853b9ad061f21ba1f661e397d5585d932ddebe3107267be512799f966aef92e599ce2c97a4d51ec48bb214aa999b370b8d5a594e6f92182b6
 DIST python2-cygwinports-7be648659ef46f33db6913ca0ca5a809219d5629.zip 9199 
BLAKE2B 
85803bc1677bd16650cb5fc4a2c54fdac0228326f25cfba4fcd098ac9d689312d3e0dde6fca57f720d5235361d6462461cf018325c23fda9139e0f1683055aff
 SHA512 
cabc21d2d7379daf1f4bafe7ab00b70e5b4f707d3102496b96ff0dfdced26347097ad771c69e0b9488b7c54b1ef36f9bc019bee72f1ffcbb55dcd0e71095edfe
 DIST python34-cygwinports-8ee84829be03c2a1aa74f0f095c994c1f43f4688.zip 14277 
BLAKE2B 
c3bf9cde3b81851711622cf77df07cb3e767d9740e7b9f7bf9ed3220ef33b1bd653ba90ce43c52a010b9457f17a9a7bef1df6ef28d0327f6a9bd955a0133df86
 SHA512 
95d517f4b2df04c192eb4a3e227c1ad6e19e756a2aaff13dd3c8aa92ff618723f7895231f04a9b5bae84b150a0fada2a4ff24f06729815ca465e6d1e5be07c70

diff --git a/dev-lang/python/python-3.5.7.ebuild 
b/dev-lang/python/python-3.5.7.ebuild
new file mode 100644
index 0000000000..584ebdef79
--- /dev/null
+++ b/dev-lang/python/python-3.5.7.ebuild
@@ -0,0 +1,439 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+WANT_LIBTOOL="none"
+
+inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 
toolchain-funcs
+
+MY_P="Python-${PV/_/}"
+PATCHSET_VERSION="3.5.4-0"
+PREFIX_PATCHREV="${PV}-gentoo-patches-r0"
+
+DESCRIPTION="An interpreted, interactive, object-oriented programming language"
+HOMEPAGE="https://www.python.org/";
+SRC_URI="https://www.python.org/ftp/python/${PV%_rc*}/${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-${PREFIX_PATCHREV}.tar.xz";
+
+LICENSE="PSF-2"
+SLOT="3.5/3.5m"
+KEYWORDS="~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos 
~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="aqua bluetooth build elibc_uclibc examples gdbm hardened ipv6 libressl 
+ncurses +readline sqlite +ssl test +threads 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:0=
+       app-arch/xz-utils:0=
+       >=sys-libs/zlib-1.1.3:0=
+       virtual/libffi:=
+       virtual/libintl
+       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:0= )
+       !!<sys-apps/sandbox-2.6-r1"
+# bluetooth requires headers from bluez
+DEPEND="${RDEPEND}
+       bluetooth? ( net-wireless/bluez )
+       virtual/pkgconfig
+       !sys-devel/gcc[libffi(-)]"
+RDEPEND+=" !build? ( app-misc/mime-types )"
+PDEPEND=">=app-eselect/eselect-python-20140125-r1"
+
+S="${WORKDIR}/${MY_P}"
+
+PYVER=${SLOT%/*}
+
+src_prepare() {
+       # Ensure that internal copies of expat, libffi and zlib are not used.
+       rm -fr Modules/expat
+       rm -fr Modules/_ctypes/libffi*
+       rm -fr Modules/zlib
+
+       if tc-is-cross-compiler; then
+               # Invokes BUILDPYTHON, which is built for the host arch
+               local 
EPATCH_EXCLUDE="*_regenerate_platform-specific_modules.patch"
+       fi
+
+       EPATCH_SUFFIX="patch" epatch "${WORKDIR}/patches"
+       epatch "${FILESDIR}/${PN}-3.4.3-ncurses-pkg-config.patch"
+       epatch "${FILESDIR}/${PN}-3.5-distutils-OO-build.patch"
+       epatch "${FILESDIR}/3.6-disable-nis.patch"
+#      epatch "${FILESDIR}/python-3.5.5-libressl-compatibility.patch"
+       epatch "${FILESDIR}/python-3.5.5-hash-unaligned.patch"
+
+       epatch_user
+
+       # Prefix' round of patches
+       EPATCH_EXCLUDE="${excluded_patches}" EPATCH_SUFFIX="patch" \
+               epatch "${WORKDIR}"/python-prefix-${PREFIX_PATCHREV}
+
+       # https://forums.developer.apple.com/thread/9233, bug #572726
+       sed -i -e '/$(RUNSHARED) .\/regen/s/^/export RUNSHARED=$(RUNSHARED); /' 
\
+               Makefile.pre.in || die
+       sed -i -e '/python$EXE/s/^/env ${RUNSHARED} /' \
+               Lib/plat-darwin/regen || die
+
+       # we provide a fully working readline also on Darwin, so don't force
+       # usage of less functional libedit
+       sed -i -e 's/__APPLE__/__NO_MUCKING_AROUND__/g' Modules/readline.c || 
die
+
+       # We may have wrapped /usr/ccs/bin/nm on AIX for long TMPDIR.
+       sed -i -e "/^NM=.*nm$/s,^.*$,NM=$(tc-getNM)," Modules/makexp_aix || die
+
+       # Make sure python doesn't use the host libffi.
+       use prefix && epatch "${FILESDIR}/python-3.5.4-libffi-pkgconfig.patch"
+
+       sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" \
+               configure.ac \
+               Lib/distutils/command/install.py \
+               Lib/distutils/sysconfig.py \
+               Lib/site.py \
+               Lib/sysconfig.py \
+               Lib/test/test_site.py \
+               Makefile.pre.in \
+               Modules/getpath.c \
+               Modules/Setup.dist \
+               setup.py || die "sed failed to replace @@GENTOO_LIBDIR@@"
+
+       # workaround a development build env problem and muck around
+       # framework install to get the best of both worlds (non-standard)
+       sed -i \
+               -e 
"s:FRAMEWORKINSTALLAPPSPREFIX=\":FRAMEWORKINSTALLAPPSPREFIX=\"${EPREFIX}:" \
+               -e '/RUNSHARED=DYLD_FRAMEWORK_PATH/s/FRAMEWORK/LIBRARY/g' \
+               configure.ac configure || die
+       sed -i -e '/find/s/$/ || true/' Mac/PythonLauncher/Makefile.in || die
+
+       # Disable ABI flags.
+       sed -e "s/ABIFLAGS=\"\${ABIFLAGS}.*\"/:/" -i configure.ac || die "sed 
failed"
+
+       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
+
+       # Export CC so even AIX will use gcc instead of xlc_r.
+       # Export CXX so it ends up in /usr/lib/python3.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 -lpython3.2 correctly.
+       # Needed on FreeBSD unless Python 3.2 is already installed.
+       # Please query BSD team before removing this!
+       append-ldflags "-L."
+
+       # make sure setup.py considers Prefix' paths before system ones
+       use prefix && append-cppflags -I"${EPREFIX}"/usr/include
+       use prefix && append-ldflags -L"${EPREFIX}"/lib -L"${EPREFIX}"/usr/lib
+
+       local dbmliborder
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+
+       BUILD_DIR="${WORKDIR}/${CHOST}"
+       mkdir -p "${BUILD_DIR}" || die
+       cd "${BUILD_DIR}" || die
+
+       if use aqua ; then
+               ECONF_SOURCE="${S}" OPT="" \
+               econf \
+                       --enable-framework="${EPREFIX}"/usr/lib \
+                       --config-cache
+       fi
+
+       local myeconfargs=(
+               $(use aqua && echo --config-cache) \
+               --with-fpectl
+               --enable-shared
+               $(use_enable ipv6)
+               $(use_with threads)
+               --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
+       )
+
+       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() {
+       # Ensure sed works as expected
+       # https://bugs.gentoo.org/594768
+       local -x LC_ALL=C
+
+       cd "${BUILD_DIR}" || die
+
+       emake CPPFLAGS= CFLAGS= LDFLAGS=
+
+       # 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="gdb"
+
+       for test in ${skipped_tests}; do
+               mv "${S}"/Lib/test/test_${test}.py "${T}"
+       done
+
+       local -x PYTHONDONTWRITEBYTECODE=
+       emake test EXTRATESTOPTS="-u-network" 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/$(get_libdir)/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/$(get_libdir)/python${PYVER}
+
+       cd "${BUILD_DIR}" || die
+
+       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=/usr/$(get_libdir)/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
+
+       sed \
+               -e "s/\(CONFIGURE_LDFLAGS=\).*/\1/" \
+               -e "s/\(PY_LDFLAGS=\).*/\1/" \
+               -i "${libdir}/config-${PYVER}"*/Makefile || die "sed failed"
+
+       # Fix collisions between different slots of Python.
+       rm -f "${ED}usr/$(get_libdir)/libpython3.so"
+
+       # 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 elibc_uclibc && rm -fr "${libdir}/test"
+       use sqlite || rm -fr "${libdir}/"{sqlite3,test/test_sqlite*}
+       use tk || rm -fr "${ED}usr/bin/idle${PYVER}" 
"${libdir}/"{idlelib,tkinter,test/test_tk*}
+
+       use threads || rm -fr "${libdir}/multiprocessing"
+       use wininst || rm -f "${libdir}/distutils/command/"wininst-*.exe
+
+       dodoc "${S}"/Misc/{ACKS,HISTORY,NEWS}
+
+       if use examples; then
+               insinto /usr/share/doc/${PF}/examples
+               find "${S}"/Tools -name __pycache__ -print0 | xargs -0 rm -fr
+               doins -r "${S}"/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"
+
+       # 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}
+       else
+               vars=( PYTHON "${vars[@]}" )
+       fi
+
+       python_export "python${PYVER}" "${vars[@]}"
+       echo "EPYTHON='${EPYTHON}'" > epython.py || die
+       python_domodule epython.py
+
+       # python-exec wrapping support
+       local pymajor=${PYVER%.*}
+       mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die
+       # python and pythonX
+       ln -s "../../../bin/${abiver}" \
+               "${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 "python${pymajor}-config" \
+               "${D}${PYTHON_SCRIPTDIR}/python-config" || die
+       # 2to3, pydoc, pyvenv
+       ln -s "../../../bin/2to3-${PYVER}" \
+               "${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}" \
+                       "${D}${PYTHON_SCRIPTDIR}/idle" || die
+       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
+               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
+
+       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() {
+       eselect_python_update
+}

Reply via email to