commit:     821fb1763151912b088e2246b6f7ec278e65437f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  5 05:14:14 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Apr  5 05:14:14 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=821fb176

dev-lang/python: Bump to 3.12.0_alpha7

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

 dev-lang/python/Manifest                    |   3 +
 dev-lang/python/python-3.12.0_alpha7.ebuild | 512 ++++++++++++++++++++++++++++
 2 files changed, 515 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index eafa964caef7..ee5dc4576b1e 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -6,6 +6,8 @@ DIST Python-3.11.2.tar.xz 19893284 BLAKE2B 
0cfb1fefcdd4c4baf5c34f74ab0600ac7cd40
 DIST Python-3.11.2.tar.xz.asc 833 BLAKE2B 
15795836babd269424f1ff511073e27235827353383d15cac6a85406b967787840ca6c0f119faa1971a50ebb6699e6cdf0de095f428b868b57a91eb8dc6d5baa
 SHA512 
9d9d1c6dd6e56a916c6861cd0e7e623a165b0845bafe0acfcae27b4fe10a6b7015844e6b3f8deded26a763c935e32f565b2e12beb20c43fda16c11eba8d282a1
 DIST Python-3.12.0a6.tar.xz 19779564 BLAKE2B 
57928629c3df4baceda524c4968c97b7d531dd4072d0fa94780c42786b58cd9836c856ce024561641037099808557b133e60b74d019202e79c6b464a366b15ed
 SHA512 
f1f4fa5982ff37765fc657a99c0a3277935587b6073c0f6c9e0d1fdbc79c63f3dff9b2e296e72bfa1b6a0ebcbcb13801d6e6599c13230e8c0256c13ac2754488
 DIST Python-3.12.0a6.tar.xz.asc 963 BLAKE2B 
a0c148e4451b1f55bc3fa0cae2940872b6e0cf47d47283e04ab99c997bef4128c349d399675bce6738875ffa0cbcfa16393eb1b7530ca96369c8cea633d48874
 SHA512 
9e72be00a9b99a4d01c60b9b3af718b39ff7a1e68b5a8d5215f5797ac133f84f6382dc7339da5ed2e5be706fa5abaedc54b461b50a679e051e96189987be4cc5
+DIST Python-3.12.0a7.tar.xz 19819836 BLAKE2B 
e899a47228560219b9e2dd1520999a026bd198fa47867ef3da30f6817d85c2ba6fe3956d1da0a038a096d3e70227d43c53fab88329af7c3dd9652d8b30f89bca
 SHA512 
181e73215666a7deb4286a70f506d788adb0d13e3b688f3c4e061819bc59cbcedaf8aca0251d4e58791be8488f43ca0075176335bd1b3ff496b4ea2f14967d8b
+DIST Python-3.12.0a7.tar.xz.asc 963 BLAKE2B 
9e1b223b5b0556f95fb6bacb1ae66cd6115f8b589eb8ad46d1fec7e4d64aa5cc12c993be5b1fc87966b6b1b6964d433c00920dd98de41380bd8a8ee9b4f98490
 SHA512 
07c27bfb649755cfe505a902ff677e146ed1e8e19e7d5801d41c5926359b7d3f2ef73961c26f6cce6dd948355324330d4e9bae79e3661f87079b1adb5bf62355
 DIST Python-3.8.16.tar.xz 19046724 BLAKE2B 
cbdeec7961d39cb9ab4960760b5d4c7ae71675c174156aa9f6fca55ee92a93a937ef39defe86e423237a25e0e24703233ce4b91dc97005b6ffc1f342ddd9e22c
 SHA512 
d206e80806409410c00ef8acd8c3d90e3cc9553f996d0a57faa63802f2415e9d7591542b2e84b5e8e79245f40f6478790b5ba2acf1da98ebbc9495999183f7fd
 DIST Python-3.8.16.tar.xz.asc 833 BLAKE2B 
678dabc558d013b104bf9e65d4319076c4730a67093a66fefc073b429c640d4facb31a0d6b7238deb08b265586a0cfb2c345051fe4df7bf5001d7317e6c06c9b
 SHA512 
e93c394c0c5afcaaab625a3bd540dcc8e0ab946803d212343b8d1d6d5e6b89b09b6a20607bab0d858b30389a03305d57e14548605a65277d053c7817f32f4546
 DIST Python-3.9.16.tar.xz 19738796 BLAKE2B 
70dedeb70d9d8f27e4f6db5106623e087c61d451c7a04639cf8d3503ad02d4d43f1b36d0cdf1131aefc9bf6e677e561227dd4baef2c2c3d2dbf6d3e7dc36bd94
 SHA512 
b5fd0afe131c82bbce6ddf887c59eef6945910d6a9a2bc87c0927f4e4a096bf9ca4d25bcb729c40f6ebb8a65fbe8bf7b0b97a7c4a8c9e551240eb4f34b878653
@@ -14,5 +16,6 @@ DIST python-gentoo-patches-2.7.18_p16.tar.xz 35448 BLAKE2B 
0139c0944f62f9cdd236f
 DIST python-gentoo-patches-3.10.10_p3.tar.xz 14700 BLAKE2B 
934462f437ffbf0b65e1cd63719121b7d551698e5ca9e67283a60f24151c6cf62eb0d31b16dad3b6e95da0dd6eac8c84c86332e42195f0f9dd7fbc4db52a3f9e
 SHA512 
72e97a441463fff2760deb5557d2bbee82a5354b3db30e1ea34ea05bf349af0a46e0ff244e5ec212c8d2663ad79e660634733c3737ed853f5270c5c0427c902f
 DIST python-gentoo-patches-3.11.2_p2.tar.xz 8516 BLAKE2B 
52bfdfac533ed53f32b8546c37a10b7019f3f0cd296b7929d3eb83fdc6a5e49c95515bb2ba56487b81e68701c586520db08e323ac1f49ef6f82da56010e21a28
 SHA512 
4388c0ae0bd25a002aed095d1db42076bcf6b7486955aa41c34ac41318e82eec686e8b9aac31ff766eed16edf3fb86fd333c448090240ba79bbc35e458a96dd0
 DIST python-gentoo-patches-3.12.0a6.tar.xz 5160 BLAKE2B 
3149259ac54ee360714e6b24811cafcc25011b14427b24811831ea02aef044b1670b951976e5756938fdba0710e8b9c8465eeb6bcdea0b78a91bb586f8ae212a
 SHA512 
aaeb4b4102e2d9116798b52d98cdb5955226b3e97b3ba7c9e319d4ea98c126faebbfac3c609436fde2eae75254205a3aa9644b1aafad95c44d52b754e72b031e
+DIST python-gentoo-patches-3.12.0a7.tar.xz 5168 BLAKE2B 
bfc249bf634deb3fab283c5d9a1710e35e6e7331f6a4f5c0d6b3795a3419adb7fa017117496966f7b3d7430d7564c66088cfd7cb8a2b8406776f42a5801960a7
 SHA512 
f806aa788f86d516bb23ad255edc24716a9385b3092e06e02e83617ef103b04878bb404081e7dded9c194dd6f2e4362bc2643b61076cb387b6070be3af391651
 DIST python-gentoo-patches-3.8.16_p4.tar.xz 32436 BLAKE2B 
76984bbc04e5cf32d70853891967a33366dd28ca2cd47f3538ed1e9f4d39008d04c90f616d92112f5ec3468c42119089d195ee4d936536f8da4a772164aae221
 SHA512 
ad6d653fec3cce1f73db4b192f7e95b35ae2cf70aa8782d7b69f9d48eee240ef1cc32257a42bbb57f3952720df68b9976164a0b2748e36600332fba488383016
 DIST python-gentoo-patches-3.9.16_p3.tar.xz 27160 BLAKE2B 
5a41a6ff135c3aca02b19cf9a61f554ca224173854274b872ce85e8c71f25c678604e50b87bae40d4b5ac082731c143338fcc6ef47acebad2b59ce0b1d600f5d
 SHA512 
1ace0a9e929769c29082fdec6845a476c07c13fbbff8726a7a592fda09da8b50c996638b4e4e40acccb15630a796074329adbcc9a004c4305952fa5b0dc4146c

diff --git a/dev-lang/python/python-3.12.0_alpha7.ebuild 
b/dev-lang/python/python-3.12.0_alpha7.ebuild
new file mode 100644
index 000000000000..abbc74ddf678
--- /dev/null
+++ b/dev-lang/python/python-3.12.0_alpha7.ebuild
@@ -0,0 +1,512 @@
+# Copyright 1999-2023 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
+inherit prefix python-utils-r1 toolchain-funcs verify-sig
+
+MY_PV=${PV/_alpha/a}
+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 +ensurepip examples gdbm hardened libedit lto
+       +ncurses pgo +readline +sqlite +ssl test tk valgrind
+"
+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:=
+       dev-python/gentoo-common
+       sys-apps/util-linux:=
+       >=sys-libs/zlib-1.1.3:=
+       virtual/libcrypt:=
+       virtual/libintl
+       ensurepip? ( dev-python/ensurepip-wheels )
+       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(+)] )
+       valgrind? ( dev-util/valgrind )
+"
+# autoconf-archive needed to eautoreconf
+BDEPEND="
+       sys-devel/autoconf-archive
+       app-alternatives/awk
+       virtual/pkgconfig
+       verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 )
+"
+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}
+# false positives -- functions specific to *BSD
+QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
+
+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 and libffi are not used.
+       # TODO: Makefile has annoying deps on expat headers
+       #rm -r Modules/expat || die
+
+       local PATCHES=(
+               "${WORKDIR}/${PATCHSET}"
+       )
+
+       default
+
+       # force the correct number of jobs
+       # https://bugs.gentoo.org/737660
+       sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die
+
+       eautoreconf
+}
+
+src_configure() {
+       local disable
+       # disable automagic bluetooth headers detection
+       if ! use bluetooth; then
+               local -x ac_cv_header_bluetooth_bluetooth_h=no
+       fi
+
+       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
+
+       local dbmliborder=
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+
+       if use pgo; then
+               local profile_task_flags=(
+                       -m test
+                       "-j$(makeopts_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)
+                       -x test_asyncio
+                       -x test_httpservers
+                       -x test_logging
+                       -x test_multiprocessing_fork
+                       -x test_socket
+                       -x test_xmlrpc
+               )
+
+               if has_version "app-arch/rpm" ; then
+                       # Avoid sandbox failure (attempts to write to 
/var/lib/rpm)
+                       profile_task_flags+=(
+                               -x test_distutils
+                       )
+               fi
+               local -x PROFILE_TASK="${profile_task_flags[*]}"
+       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-platlibdir=lib
+               --with-pkg-config=yes
+               --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
+
+               $(use_with lto)
+               $(use_enable pgo optimizations)
+               $(use_with readline readline "$(usex libedit editline 
readline)")
+               $(use_with valgrind)
+       )
+
+       # disable implicit optimization/debugging flags
+       local -x OPT=
+
+       if tc-is-cross-compiler ; then
+               # Hack to workaround get_libdir not being able to handle 
CBUILD, bug #794181
+               local cbuild_libdir=$(unset PKG_CONFIG_PATH ; 
$(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
+
+               # pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
+               # propagated to sysconfig for built extensions
+               local -x CFLAGS_NODIST=${CFLAGS_FOR_BUILD}
+               local -x LDFLAGS_NODIST=${LDFLAGS_FOR_BUILD}
+               local -x CFLAGS= LDFLAGS=
+
+               # We need to build our own Python on CBUILD first, and feed it 
in.
+               # bug #847910
+               local myeconfargs_cbuild=(
+                       "${myeconfargs[@]}"
+
+                       --libdir="${cbuild_libdir:2}"
+
+                       # Avoid needing to load the right libpython.so.
+                       --disable-shared
+
+                       # 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
+               # We disable _ctypes and _crypt for CBUILD because Python's 
setup.py can't handle locating
+               # libdir correctly for cross.
+               PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes 
_crypt" \
+                       ECONF_SOURCE="${S}" econf_build 
"${myeconfargs_cbuild[@]}"
+
+               # Avoid as many dependencies as possible for the cross build.
+               cat >> Makefile <<-EOF || die
+                       MODULE_NIS_STATE=disabled
+                       MODULE__DBM_STATE=disabled
+                       MODULE__GDBM_STATE=disabled
+                       MODULE__DBM_STATE=disabled
+                       MODULE__SQLITE3_STATE=disabled
+                       MODULE__HASHLIB_STATE=disabled
+                       MODULE__SSL_STATE=disabled
+                       MODULE__CURSES_STATE=disabled
+                       MODULE__CURSES_PANEL_STATE=disabled
+                       MODULE_READLINE_STATE=disabled
+                       MODULE__TKINTER_STATE=disabled
+                       MODULE_PYEXPAT_STATE=disabled
+                       MODULE_ZLIB_STATE=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.
+               PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes 
_crypt" emake
+               popd &> /dev/null || die
+       fi
+
+       # 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=
+
+       # Fix implicit declarations on cross and prefix builds. Bug #674070.
+       if use ncurses; then
+               append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
+       fi
+
+       hprefixify setup.py
+       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}_STATE=disabled"
+       done >> Makefile || die
+
+       # install epython.py as part of stdlib
+       echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
+}
+
+src_compile() {
+       # Ensure sed works as expected
+       # https://bugs.gentoo.org/594768
+       local -x LC_ALL=C
+       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/python${PYVER}/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
+
+       # this just happens to skip test_support.test_freeze that is broken
+       # without bundled expat
+       # TODO: get a proper skip for it upstream
+       local -x LOGNAME=buildbot
+
+       local test_opts=(
+               -u-network
+               -j "$(makeopts_jobs)"
+
+               # fails
+               -x test_gdb
+       )
+
+       if use sparc ; then
+               # bug #788022
+               test_opts+=(
+                       -x test_multiprocessing_fork
+                       -x test_multiprocessing_forkserver
+               )
+       fi
+
+       # workaround docutils breaking tests
+       cat > Lib/docutils.py <<-EOF || die
+               raise ImportError("Thou shalt not import!")
+       EOF
+
+       # bug 660358
+       local -x COLUMNS=80
+       local -x PYTHONDONTWRITEBYTECODE=
+       # workaround https://bugs.gentoo.org/775416
+       addwrite "/usr/lib/python${PYVER}/site-packages"
+
+       nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \
+               CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
+       local ret=${?}
+
+       rm Lib/docutils.py || die
+
+       [[ ${ret} -eq 0 ]] || die "emake test failed"
+}
+
+src_install() {
+       local libdir=${ED}/usr/lib/python${PYVER}
+
+       # the Makefile rules are broken
+       # https://github.com/python/cpython/issues/100221
+       mkdir -p "${libdir}"/lib-dynload || die
+
+       # -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
+
+       rm -r "${libdir}"/ensurepip/_bundled || die
+       if ! use ensurepip; then
+               rm -r "${libdir}"/ensurepip || die
+       fi
+       if ! use sqlite; then
+               rm -r "${libdir}/"sqlite3 || die
+       fi
+       if ! use tk; then
+               rm -r "${ED}/usr/bin/idle${PYVER}" || die
+               rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
+       fi
+
+       ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || 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 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"
+
+       # python-exec wrapping support
+       local pymajor=${PYVER%.*}
+       local EPYTHON=python${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
+}
+
+pkg_postinst() {
+       local v
+       for v in ${REPLACING_VERSIONS}; do
+               if ver_test "${v}" -lt 3.11.0_beta4-r2; then
+                       ewarn "Python 3.11.0b4 has changed its module ABI.  The 
.pyc files"
+                       ewarn "installed previously are no longer valid and 
will be regenerated"
+                       ewarn "(or ignored) on the next import.  This may cause 
sandbox failures"
+                       ewarn "when installing some packages and checksum 
mismatches when removing"
+                       ewarn "old versions.  To actively prevent this, rebuild 
all packages"
+                       ewarn "installing Python 3.11 modules, e.g. using:"
+                       ewarn
+                       ewarn "  emerge -1v /usr/lib/python3.11/site-packages"
+               fi
+       done
+}

Reply via email to