commit:     1011886766fec1b47e28f9f84361b4c1bb7b03a5
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 07:00:44 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 07:08:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10118867

dev-lang/python: Bump to 3.11.0_beta4

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

 dev-lang/python/Manifest                   |   3 +
 dev-lang/python/python-3.11.0_beta4.ebuild | 472 +++++++++++++++++++++++++++++
 2 files changed, 475 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index 270976498d16..3a11d13c6e4b 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -6,6 +6,8 @@ DIST Python-3.10.5.tar.xz 19361320 BLAKE2B 
7f3629f8a16faeb0311947b7d5162bc45d9ed
 DIST Python-3.10.5.tar.xz.asc 833 BLAKE2B 
36da2d557a5c38cfc473b2138412f9bc011d19c8538475e623bf41d81eb2c8f8e977945a3065a48c5b234d2b2c7d0dd5e83112c948591628cec344651dc9055c
 SHA512 
72d0ab09900e2a10b85ccac804efd5536251152798e7347576e0e28bff4ab4a84b08d646329b225f9949047586686f9f4e7f05652526657a0948951b739c14e0
 DIST Python-3.11.0b3.tar.xz 19532936 BLAKE2B 
b7edaecb57b99a76662dd22d28678108b3448a3acf09ffe2676d849e564da6e887184a82451095d98bbc33d0610d6ad72f961c545912480277b7fabfffb9bc55
 SHA512 
53c379311acc9d8ec645caea44f4b83b29fcbdacb7114eb7aac5a2f0229402eddb245abc8bd6665077e9c82ba0a821cc55ae7494d0667b84675248025e872498
 DIST Python-3.11.0b3.tar.xz.asc 833 BLAKE2B 
a43811360e01532bdec5166dd049b2d3bf9e33739152ffad85a33fcb94e0f81e128c3e3a30097b0c56d71ac908fd88058b894d3ef07e13a3467249839df39fbd
 SHA512 
b51a02e47de73f4998effd15eb99d356ef69cd69521f208f50de1b8acf69d5cf9c8a2f774ec8bc5e0e75534fe59efe019cffcff39bc525aa4641dc9b47efb5ef
+DIST Python-3.11.0b4.tar.xz 19573532 BLAKE2B 
d28b85c4af39ea8c8b1448857698a7018c9d115f0f861ff1649101e4c9d3ebbea14e1f5da8158b1734bf8743d96ed3683a8192e07ff06c0ccd964ec7ddee3832
 SHA512 
1530f4dcba6325ac8e9bb955604fc504a4306e3291b667d1d8490b78e1c50924d81ff8ab50d08c736e70d3e42788aabaa162179a77c03860ee8064f17f93bb09
+DIST Python-3.11.0b4.tar.xz.asc 833 BLAKE2B 
eaedd106d3599c7ee6974ff9eee33899b119fdb45ab5b760f5f02e51e12ba58b3161f6853464a32638385fd596ddd350097c28dde55e3efeacc6719f16275d84
 SHA512 
8f6c633911755767d351fc86e031df6cedd6091ca5ec0ef55331ac65d2ad532c71e568c173513a2bbb2235e5e3fc9dd77e1b7ed230df1f0d8bd6e23da470b1e2
 DIST Python-3.8.13.tar.xz 19023016 BLAKE2B 
d3cb8624496e56d93d34f2aa5082746869a99210197529bc19e6a9d265f4ce246e0e83a3528a7602a28aac8855bf84e6bf6495b85e9202fcf04ef90600cb5e43
 SHA512 
5c732b5d21b189b99a0e9ccd3ae59466bed60a930d5d3f437a262d38f0797b776cecbf12a1852eaebcfb638a6f2e28e471cc2ebf94237cc728144be21842cb81
 DIST Python-3.8.13.tar.xz.asc 833 BLAKE2B 
918894777e1a783f2a7c7958a808610631cb7a6039df84675158e8d2fd66782f29921d44ab9b4625c4ca3821852e0d0e0005163b086c7d0c3d617e3a76cb7033
 SHA512 
6683c4ae6cf20a97a29165f96b9f5dd09d618892583650d803aa677240695968dfe344294fc33db68fd4669c82021afcc29a1f6afe49915be51fae281eeeedbe
 DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 
05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25
 SHA512 
081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97
@@ -18,6 +20,7 @@ DIST python-gentoo-patches-3.10.5.tar.xz 8584 BLAKE2B 
d4a812a33e485b1eae5629e519
 DIST python-gentoo-patches-3.11.0b3.tar.xz 3320 BLAKE2B 
588762fe2698a814d0cb89f84620d3ca4754347cb9af4f0eb36429a126ca2386b64594f16621a25e88d518986aad5f3ef3a84d9ce746f58b5cc6d112167c41d1
 SHA512 
026cb5cc2f3a1b17829fb088ca1dc9af03764a250bebb1fe518a6f7734f731a3f6cc5d83a13b6ca29dd6fa8ca5f0249a7ef0a641b939cd511d05cdc645b9171f
 DIST python-gentoo-patches-3.11.0b3_p1.tar.xz 10560 BLAKE2B 
4a34de0595490b0e7fcff1761954bfa56f3f82cfdf5a26d739f410e355f9068ccb22a24af0c212543b1288682a9737e4202862c9d4db2f78d08a5a33f80c85e8
 SHA512 
a0e54b3dd16db8802b93b88ad50bb979b90052a53438fcbf8378288747b627133a492a9071600d7c11163cb9a61c4c80f9b1dd1fc843789aa7507488ff2c1337
 DIST python-gentoo-patches-3.11.0b3_p2.tar.xz 11496 BLAKE2B 
c640e64450199e7e1e3d49447dedc63ec3866c32006794d6e6873ec61c617b34b5fc81aa4760a0a0543cb0e1634a2243e02280d5716778a8c132054edbc5430c
 SHA512 
5a0aa3bf54615caf9790f28e779d2d648875d484abe3e1c41ba220ca4fb6d8f6d78dee4ad350b9956de990acc7191b41a8073e0966ec8b99a0a100f8ccde344b
+DIST python-gentoo-patches-3.11.0b4.tar.xz 4388 BLAKE2B 
16b112f1ecdce86022ed64d7c7007fb323b7bd4497b5802a48bb0a86667c282d1a9150d744f44cefbe9321af4916d35941707c1259a0cf175c0161c8e1b17e97
 SHA512 
f9c8c7180da20e839a0862571b9077b2702dbee8a1acd55ebb11329912cf9f81862ba615be484b92d39461c3eb6c38890f8d58bcbce2c4722418a967faedc1f5
 DIST python-gentoo-patches-3.8.13.tar.xz 16004 BLAKE2B 
5c0c6c9263570a467391e60c324d1dbc1e50ffda9cad1e204df124441b593146f18e5f1529eb7d385b35c5f4b9e597807971b6b66f7f8eef156ad87c9ad32743
 SHA512 
4ceb831e2d62bd73909b53a3b553b2cd73d08bcf2a1c92b47eaeb1221d40daabcaed14977265bcb265df00b6bf363dbebbd61a62dca4bf6ef40c6b911e980597
 DIST python-gentoo-patches-3.8.13_p2.tar.xz 18816 BLAKE2B 
8612ca33e5569319c5d1a5a3fb1a81e860bd515bfde656b79f087ccf7020923fbd06b315178bef8630e4c36bb22c27299fe439aadc6a161f1ec93be8778314ee
 SHA512 
be5668a0a4be0a03e61466436973125a3be4f33a61524e4a5c8d86745727cfcae59e5048477887c9f6bfc09727f3aef3652ad47a13a6bf0f1452d3172f1c34dc
 DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 
5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b
 SHA512 
07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91

diff --git a/dev-lang/python/python-3.11.0_beta4.ebuild 
b/dev-lang/python/python-3.11.0_beta4.ebuild
new file mode 100644
index 000000000000..fc2ca3513448
--- /dev/null
+++ b/dev-lang/python/python-3.11.0_beta4.ebuild
@@ -0,0 +1,472 @@
+# 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/_beta/b}
+MY_P="Python-${MY_PV%_p*}"
+PYVER=$(ver_cut 1-2)
+PATCHSET="python-gentoo-patches-${MY_PV}"
+
+DESCRIPTION="An interpreted, interactive, object-oriented programming language"
+HOMEPAGE="
+       https://www.python.org/
+       https://github.com/python/cpython/
+"
+SRC_URI="
+       https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
+       https://dev.gentoo.org/~mgorny/dist/python/${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="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="bluetooth build examples gdbm hardened libedit lto +ncurses pgo 
+readline +sqlite +ssl test tk wininst"
+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:=
+       app-crypt/libb2
+       >=dev-libs/expat-2.1:=
+       dev-libs/libffi:=
+       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
+       )
+       !!<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 )
+"
+if [[ ${PV} != *_alpha* ]]; then
+       RDEPEND+="
+               dev-lang/python-exec[python_targets_python${PYVER/./_}(-)]
+       "
+fi
+
+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
+
+QA_PKGCONFIG_VERSION=${PYVER}
+
+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}"
+       )
+
+       default
+
+       # https://bugs.gentoo.org/850151
+       sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
+
+       # 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
+
+       eautoreconf
+}
+
+src_configure() {
+       local disable
+       # disable automagic bluetooth headers detection
+       use bluetooth || export ac_cv_header_bluetooth_bluetooth_h=no
+
+       append-flags -fwrapv
+
+       filter-flags -malign-double
+
+       # 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.
+       # PKG_CONFIG needed for cross.
+       tc-export CXX PKG_CONFIG
+
+       # Fix implicit declarations on cross and prefix builds. Bug #674070.
+       use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
+
+       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
+
+       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
+               ac_cv_header_stropts_h=no
+
+               --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
+               --with-platlibdir=lib
+               --with-pkg-config=yes
+
+               $(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=
+
+       if tc-is-cross-compiler ; then
+               # We need to build our own Python on CBUILD first, and feed it 
in.
+               # bug #847910
+               local myeconfargs_cbuild=(
+                       "${myeconfargs[@]}"
+
+                       # As minimal as possible for the mini CBUILD Python
+                       # we build just for cross to satisfy 
--with-build-python.
+                       --without-lto
+                       --without-readline
+                       --disable-optimizations
+               )
+
+               myeconfargs+=(
+                       # Point the imminent CHOST build to the Python we just
+                       # built for CBUILD.
+                       --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
+               )
+
+               mkdir "${WORKDIR}"/${P}-${CBUILD} || die
+               pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
+               ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
+
+               # Avoid as many dependencies as possible for the cross build.
+               cat >> Makefile <<-EOF || die
+               MODULE_NIS=disabled
+               MODULE__DBM=disabled
+               MODULE__GDBM=disabled
+               MODULE__DBM=disabled
+               MODULE__SQLITE3=disabled
+               MODULE__HASHLIB=disabled
+               MODULE__SSL=disabled
+               MODULE__CURSES=disabled
+               MODULE__CURSES_PANEL=disabled
+               MODULE_READLINE=disabled
+               MODULE__TKINTER=disabled
+               MODULE_PYEXPAT=disabled
+               MODULE_ZLIB=disabled
+               EOF
+
+               # Unfortunately, we do have to build this immediately, and
+               # not in src_compile, because CHOST configure for Python
+               # will check the existence of the --with-build-python value
+               # immediately.
+               emake
+               popd &> /dev/null || die
+       fi
+
+       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
+
+       # force-disable modules we don't want built
+       local disable_modules=(
+               NIS
+       )
+       use gdbm || disable_modules+=( _GDBM _DBM )
+       use sqlite || disable_modules+=( _SQLITE3 )
+       use ssl || disable_modules+=( _HASHLIB _SSL )
+       use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
+       use readline || disable_modules+=( READLINE )
+       use tk || disable_modules+=( _TKINTER )
+
+       local mod
+       for mod in "${disable_modules[@]}"; do
+               echo "MODULE_${mod}=disabled"
+       done >> Makefile || die
+}
+
+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
+       export PYTHONSTRICTEXTENSIONBUILD=1
+
+       # 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.11/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
+
+       # Expects to find skipped tests and fails
+       mv "${S}"/Lib/test/test_tools/test_freeze.py "${T}" || die
+
+       # bug 660358
+       local -x COLUMNS=80
+       local -x PYTHONDONTWRITEBYTECODE=
+       # workaround https://bugs.gentoo.org/775416
+       addwrite /usr/lib/python3.11/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
+
+       mv "${T}"/test_freeze.py "${S}"/Lib/test/test_tools/test_freeze.py || 
die
+
+       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}
+
+       # -j1 hack for now for bug #843458
+       emake -j1 DESTDIR="${D}" altinstall
+
+       # 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
+
+       use sqlite || rm -r "${libdir}/"sqlite3 || 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
+       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-${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
+               cat > python.wrap <<-EOF || die
+                       #!/bin/sh
+                       export 
LD_LIBRARY_PATH=\${PWD}\${LD_LIBRARY_PATH+:\${LD_LIBRARY_PATH}}
+                       exec ./python "\${@}"
+               EOF
+               chmod +x python.wrap || die
+               local -x PYTHON=./python.wrap
+       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
+}

Reply via email to