summaryrefslogtreecommitdiff
path: root/dev-lang/python
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-05 11:25:00 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-05 11:25:00 +0100
commitad77dc19e91d2c023f80e11e8974536d80e3a743 (patch)
tree42bb312ab0eb61fd94103e3eddb65b134f6be5a4 /dev-lang/python
parent6de28447d66e6c47ee682740b840cdb67244d4b1 (diff)
gentoo auto-resync : 05:04:2023 - 11:25:00
Diffstat (limited to 'dev-lang/python')
-rw-r--r--dev-lang/python/Manifest4
-rw-r--r--dev-lang/python/python-3.12.0_alpha7.ebuild512
2 files changed, 516 insertions, 0 deletions
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index ec5d6c5cadad..799822be2002 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -8,6 +8,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
@@ -16,12 +18,14 @@ 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
EBUILD python-2.7.18_p16-r1.ebuild 8612 BLAKE2B f6c315dcdc3df5d88b456823a2f18cc5fb9e63d8e7b3686a25a814e6222a0787a0b0e1a9373297b14eea9706aa68b6fa36c49a3a4ecf42d3967bf09ca4ca872a SHA512 8234c63e15aa33327bf9cf86f08621b319ba0d7e0826c1159a53b030eab02cf64cd13f1ddce4c250c291eca7a853e0cc420bb549085fd2d11a4dabc0a9d61543
EBUILD python-3.10.10_p3.ebuild 13761 BLAKE2B 99c069ce2b15751b7fb4be9970b52e34debc555ac638ba8d737c0d3e9a0bd1eaf1c9ebe0aa44b9ee3c19f8978d3df016130d06aba5a21418552078439d651c45 SHA512 a6a096d3013c1609af0c8e9cc692fb98194af4c4e9cd9312ccb2ddca3727ab91296e9a6e87a815fae2ad8f473cfce0985b66d181b2c93525086dc74fad899486
EBUILD python-3.11.2_p2.ebuild 14660 BLAKE2B 895780cc0e023adfbc356c434cc1252bc7b72f9a8f1bb3bbce1ce0558814ceaacd7f69eb87bf80368ac41fd45cbfda3a210a7f4cf7a76b976e9ebd9414e99dd6 SHA512 c874002811e15ddc002fb9ae05a60d5c4036986d97cd14a77cd0914d947d21bcd92ad3f4740c7902aa4ad81a711f9976a8ee5b1ad2ac15476a3ef7a16371f3bf
EBUILD python-3.12.0_alpha6.ebuild 14498 BLAKE2B 022989f5d368207f6de069e6266354e4ed81f2307f742eaee0e0750d02c05cf8d0b0bc7f76ef731e6c2810da678c47c88d64497813d7a23a18ee5785ec7e8199 SHA512 d8f9367e9b08340fb1db1ffec1b8d129852d1e307257932d559fcc657723a0aaaec76de3904c973c40667b17acd6ddb6c7d991511acbf93d844cf094ae4cdb1d
+EBUILD python-3.12.0_alpha7.ebuild 14498 BLAKE2B 022989f5d368207f6de069e6266354e4ed81f2307f742eaee0e0750d02c05cf8d0b0bc7f76ef731e6c2810da678c47c88d64497813d7a23a18ee5785ec7e8199 SHA512 d8f9367e9b08340fb1db1ffec1b8d129852d1e307257932d559fcc657723a0aaaec76de3904c973c40667b17acd6ddb6c7d991511acbf93d844cf094ae4cdb1d
EBUILD python-3.8.16_p4.ebuild 12140 BLAKE2B 769fca32eec47d0d05d15db1d26f2fb0feaf25e0e2cfba8306c627eb3847346102632e59849ebaee1d580bb14a01bf3c1b23490fb56502288ea187b5f69c999e SHA512 30117c5b477795b5ff3295ae14ccb73345217d4baba5e8b9d89b412938e5b6cbcef5a16ee00c615167f5d3cd95fc5fef2355cba2f777abc4e058e4cfb4bf5267
EBUILD python-3.9.16_p3.ebuild 13559 BLAKE2B fc026112db7ab3fd402c6519127c5b8233435910702fb2c0669a9d6871a6a399e0e7cb8a30759faa3762fbb347a6aa8ec62f3474ebc65fce61bbddfcea83f8a7 SHA512 349288948310ce013c14f2c03e1b5cc619438cb3091bc99e3f192e9a78d9fce8149d12c3619d3f030ec97c27422116d963385b5e889b89563865dfa7f0e56b20
MISC metadata.xml 1436 BLAKE2B fd5ebcef153bc74aae02f8930dba67736ce44b1dd23418448e7d5bd22391845f5edf0ba8cdf3f43af9254c68734b95fbac9ee891f09c4584c9272ac4233eede6 SHA512 124a1e743cef7236f7936aa843d3aae739a420b1b6173f02c2ef787745616891142724446320d887aeecb95fac09e3620a9666e8e3e32085d79019fe71ff7da5
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
+}