commit:     d71629710be524c874f6c7debc2eb7241fe0f0ec
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 12 05:20:42 2026 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 12 05:46:57 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7162971

dev-lang/python: Bump to 3.15.0_alpha6

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

 dev-lang/python/Manifest                    |   3 +
 dev-lang/python/python-3.15.0_alpha6.ebuild | 603 ++++++++++++++++++++++++++++
 2 files changed, 606 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index a39db5ef9521..d18360412086 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -20,6 +20,8 @@ DIST Python-3.14.3.tar.xz 23778568 BLAKE2B 
9312d28b8bd44c642eeb2d608827984610154
 DIST Python-3.14.3.tar.xz.sigstore 5215 BLAKE2B 
bb6b0aae97c9b7312b7a6f6bf3fc200a95432ae28d49e6b8bbf2ff97d6c6c65f3a60d3adad96eee3bf5f18163dda0a46768f22c6cf18b3be83fda536d73ac048
 SHA512 
0eda4ba0e9920ef927882507dc41e5bb35758ada6b5d54d312715ffd258a281edd776695109577f8ec54c915b5d4dcf19c2ba79efc2cb3dc3b3d85c82acf49f0
 DIST Python-3.15.0a5.tar.xz 34829268 BLAKE2B 
adda3409a5b3308da1f39effc0b01b317b21922bda739b65587007bd912f10540bc02637afa48e1a5630d44e23ed9a82df8bbbb6e766547d1ae66d08f43c5123
 SHA512 
c09f004cbd629d676e626ffc707a971d85147f3a03df1a666916473908cc25884237ba1a56edd15c679619ccf044cab9913118a0e67da5610dc406c8e2597b96
 DIST Python-3.15.0a5.tar.xz.sigstore 5311 BLAKE2B 
e214228fe5211d5df51fb7cd85b2c22b616f01f5f9ea75a8312fd08a37dd7e5444935b8ade81c44b1cf92dd8c61e0a15c3a929e9ecd71ee164d38936e76628d6
 SHA512 
b395e2e61a6bc0d406b28583f9aecea731fa13ada39936b7474baa24a6d1674dd3f83f54ab0ca5e38e1cda211ddaded71117e3c733dfd4373a3ba161053060b2
+DIST Python-3.15.0a6.tar.xz 34950024 BLAKE2B 
96fb82a52bb504df886dd89d7a04538eb60285f5ad84a736a3eff8fa19ade1c2026a327c336fd1c249c7016e6a0c5e3d6d7275a499e6b99f72ce386f27a1c4b8
 SHA512 
d941b26a57b292f388b425186af9584843d220ca729b8b4cea1874831496eeb2a6e3432ca81722134fb86f3e7078cd955ff5774e79b44749bf01994e4349624d
+DIST Python-3.15.0a6.tar.xz.sigstore 5171 BLAKE2B 
368f3e18c48b3dd0c1f4281b9bb4a28a9f5e5f7d138990bbccd80637c29f1fad5ca793dd09e49b0c7998fba8c4b9338990910e9bc99b2b71a64114f633727d82
 SHA512 
098b60d659b72f6f06b428619ddc9bb6b1c2ee3d3c6b5860436c507737f8efbe71a76d3758e53e760392df08b103740c5fd6e84f98f8e0e314300ccbc27a641e
 DIST Python-3.8.20.tar.xz 18962788 BLAKE2B 
715c75e0c0a3d3b77af7f07478311bb0554b80aac72915be703aa2d0dd6459a972e5669808e64da14a0b91bb183e00655055c1726f302dc3ccd8721e3b4ae3e6
 SHA512 
3c9341ee1fd33cb687958dcf2b7c0c7700489726c4d530c3e9d9537d46a6ab534541a4b312232d8505bea395a07e4518c42d75fb7571103e6b266f8f44115c61
 DIST Python-3.8.20.tar.xz.asc 833 BLAKE2B 
5c86c15a1090b42e42bb7512565b1a7ad9d2137d59e9fd1ab0f83fdfc37dfcf184389418d6703db809e9c8c04a169af292665a2b58bf5dc61b7724ecbb4132d9
 SHA512 
a751ae0407a593d97acac4d5f8a0456580c753efa12a7d960125c219b4897fdb26fc1ffd43d8ea33ad1449162dd3b2904c16b6c51c57561ba73de3ffa62e0eed
 DIST Python-3.9.25.tar.xz 20183236 BLAKE2B 
01c5af78659324e2a596611c11c0fa982f81faf9b401afe1a96399b58321e39c41e46a932e1e4437f3f2bb2d76d8482e852fc66e6f960a4928f7fc99b62dfb7e
 SHA512 
33fd65952cc3ce5df83825aa32a103935815bdd5a016e5fd9896cafb068a3f89b3a6134458a2694e4f0f4f8a9fbe84739b53116264728b32cde0f03ab210cb19
@@ -40,5 +42,6 @@ DIST python-gentoo-patches-3.14.0b1.tar.xz 5680 BLAKE2B 
514b3edc3025e5bf675d371b
 DIST python-gentoo-patches-3.14.2.tar.xz 8008 BLAKE2B 
aa454e26901a36a34dedb1deabfc4f6766ef2ee099443ea2d155061f1d005f883528d4a6984d22af0f3feaaee6fc1acf66f144ae701ce60b1e5b0b225600f42e
 SHA512 
3cee495d3b7d579a75a30ed8747d7ba1fe70c0abc06b868d68b26e64452b014c7c6c51ff9782673702375ece87abf8a3e3f5dbd2ea48257ea14416fa8794ea53
 DIST python-gentoo-patches-3.14.3.tar.xz 8012 BLAKE2B 
a8106360a6c77e0e19ecdf55e924b85cfd6dae65d54b7c306a793b08da5214993631b92b1cff385c2d995799055a4e4ca3a461d4e1e049ada38e97b4eae54a31
 SHA512 
1747a99cdc2ec29b985bc75f53f9f4cbd6f9377bfb06f6576b2970bd30ae8461a39ba870021866cf0f79320e2775047b2f70d53a06c5687ebac23b3ae68c157a
 DIST python-gentoo-patches-3.15.0a5.tar.xz 3392 BLAKE2B 
3016725f3a460c35ce7ef872939449dc4385f19cb88f3047e0cb50d33bf155898933573d25d10490f83d1669a96cb86c9be7e5071a55abc40d439df972a5e468
 SHA512 
f7940891fd2f2e8b691dde7007b59016a04e0557207cf4272d20e72d248dfe48f604fa3abaf0bc4cb085ae5d9bb56781a51e5b6e604ef7f3be1f14519f7fb6ce
+DIST python-gentoo-patches-3.15.0a6.tar.xz 3388 BLAKE2B 
24f1b54aa6010568f925db7d7bd58f253ee7e87c0f12ef2d69faa71fcfca05477596189bc191306d98ffffff5f837167eec00b995aeffdf7c1e992125cc2c6de
 SHA512 
9ecdbf0f44d8f49aa203b5cfeb08104002117f962cff3141f66a577f9ddd9ffefc2a576f498c9c65f7c9487d4eea948e7bead6c5ff220f16b34576f7b84fc4cd
 DIST python-gentoo-patches-3.8.20_p7.tar.xz 54544 BLAKE2B 
e31fc9fb5e98b62b0f70165670ec58ed4fa932cfc95d5287c249015a3a372fdbf0d1ba08cb98f63c2dc500700edfd6ffea6db670385d2c86a4fdb92ffb991192
 SHA512 
a9e7e4976be226931a503af2c986da207d060d4ce436af61f5e8427da513639adbed32bb0061963b83fef275a5de91707ab13b7a9abf3a7472ee0e2c5310eda1
 DIST python-gentoo-patches-3.9.25.tar.xz 36604 BLAKE2B 
11d35dcbc8979fe37e27a00dfef9683f0bf40514415be416d322f0509109edeb58a2e0b9218cfa3b3326654f5923d165511d203504ca2b52971ad136f8a454d1
 SHA512 
234bae116b2a5af00506cb76a0b86dfb8cf1f84ee980a358f3642bb717cff4d6f10388b2a07f12118588a174de4d2fd6ad2e3ab24704f9c85f36cb33d51f0c65

diff --git a/dev-lang/python/python-3.15.0_alpha6.ebuild 
b/dev-lang/python/python-3.15.0_alpha6.ebuild
new file mode 100644
index 000000000000..89c7211773e5
--- /dev/null
+++ b/dev-lang/python/python-3.15.0_alpha6.ebuild
@@ -0,0 +1,603 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="8"
+
+LLVM_COMPAT=( 19 )
+LLVM_OPTIONAL=1
+VERIFY_SIG_METHOD=sigstore
+WANT_LIBTOOL="none"
+
+inherit autotools check-reqs flag-o-matic linux-info llvm-r1
+inherit multiprocessing pax-utils 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.sigstore
+       )
+"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="PSF-2"
+SLOT="${PYVER}"
+IUSE="
+       bluetooth debug +ensurepip examples gdbm jit libedit +ncurses pgo
+       +readline +sqlite +ssl tail-call-interp test tk valgrind
+"
+REQUIRED_USE="jit? ( ${LLVM_REQUIRED_USE} )"
+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-arch/zstd:=
+       app-misc/mime-types
+       >=dev-libs/expat-2.1:=
+       dev-libs/libffi:=
+       dev-libs/mpdecimal:=
+       dev-python/gentoo-common
+       >=virtual/zlib-1.1.3:=
+       virtual/libintl
+       gdbm? ( sys-libs/gdbm:=[berkdb] )
+       kernel_linux? ( sys-apps/util-linux:= )
+       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
+       )
+"
+# bluetooth requires headers from bluez
+DEPEND="
+       ${RDEPEND}
+       bluetooth? ( net-wireless/bluez )
+       test? (
+               dev-python/ensurepip-pip
+               dev-python/ensurepip-setuptools
+               dev-python/ensurepip-wheel
+       )
+       valgrind? ( dev-debug/valgrind )
+"
+# autoconf-archive needed to eautoreconf
+BDEPEND="
+       dev-build/autoconf-archive
+       app-alternatives/awk
+       virtual/pkgconfig
+       jit? (
+               $(llvm_gen_dep '
+                       llvm-core/clang:${LLVM_SLOT}
+                       llvm-core/llvm:${LLVM_SLOT}
+               ')
+       )
+       tail-call-interp? (
+               || (
+                       >=sys-devel/gcc-16:*
+                       >=llvm-core/clang-19:*
+               )
+       )
+"
+PDEPEND="
+       ensurepip? ( dev-python/ensurepip-pip )
+"
+
+# https://www.python.org/downloads/metadata/sigstore/
[email protected]
+VERIFY_SIG_CERT_OIDC_ISSUER=https://github.com/login/oauth
+
+# large file tests involve a 2.5G file being copied (duplicated)
+CHECKREQS_DISK_BUILD=5500M
+
+QA_PKGCONFIG_VERSION=${PYVER%t}
+# false positives -- functions specific to *BSD
+QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags )
+
+declare -rgA PYTHON_KERNEL_CHECKS=(
+       ["CROSS_MEMORY_ATTACH"]="test_external_inspection" #bug 938589
+       ["DNOTIFY"]="test_fcntl" # bug 938662
+)
+
+pkg_pretend() {
+       if use pgo || use test; then
+               check-reqs_pkg_pretend
+       fi
+
+       if use jit; then
+               ewarn "USE=jit is considered experimental upstream.  Using it"
+               ewarn "could lead to unexpected breakage, including race 
conditions"
+               ewarn "and crashes, respectively.  Please do not file Gentoo 
bugs, unless"
+               ewarn "you can reproduce the problem with 
dev-lang/python[-jit].  Instead,"
+               ewarn "please consider reporting JIT problems upstream."
+       fi
+}
+
+pkg_setup() {
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               use jit && llvm-r1_pkg_setup
+               if use test || use pgo; then
+                       check-reqs_pkg_setup
+
+                       local CONFIG_CHECK
+                       for f in "${!PYTHON_KERNEL_CHECKS[@]}"; do
+                               CONFIG_CHECK+="~${f} "
+                       done
+                       linux-info_pkg_setup
+               fi
+               if use tail-call-interp; then
+                       tc-check-min_ver gcc 16
+                       tc-check-min_ver clang 19
+               fi
+       fi
+}
+
+src_unpack() {
+       if use verify-sig; then
+               verify-sig_verify_detached 
"${DISTDIR}"/${MY_P}.tar.xz{,.sigstore}
+       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
+
+       # breaks tests when using --with-wheel-pkg-dir
+       rm -r Lib/test/wheeldata || die
+
+       eautoreconf
+}
+
+build_cbuild_python() {
+       # 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
+       #
+       # -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD 
Python anyway)
+       local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
+       local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
+       local -x CFLAGS= LDFLAGS=
+       local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
+       local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
+
+       # We need to build our own Python on CBUILD first, and feed it in.
+       # bug #847910
+       local myeconfargs_cbuild=(
+               "${myeconfargs[@]}"
+
+               --prefix="${BROOT}"/usr
+               --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
+       )
+
+       mkdir "${WORKDIR}"/${P}-${CBUILD} || die
+       pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
+
+       # Avoid as many dependencies as possible for the cross build.
+       mkdir Modules || die
+       cat > Modules/Setup.local <<-EOF || die
+               *disabled*
+               nis
+               _dbm _gdbm
+               _sqlite3
+               _hashlib _ssl
+               _curses _curses_panel
+               readline
+               _tkinter
+               pyexpat
+               zlib
+               # We disabled these for CBUILD because Python's setup.py can't 
handle locating
+               # libdir correctly for cross. This should be rechecked for the 
pure Makefile approach,
+               # and uncommented if needed.
+               #_ctypes
+       EOF
+
+       ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
+
+       # 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
+}
+
+src_configure() {
+       # disable automagic bluetooth headers detection
+       if ! use bluetooth; then
+               local -x ac_cv_header_bluetooth_bluetooth_h=no
+       fi
+
+       filter-flags -malign-double
+
+       # 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
+
+       # Set baseline test skip flags.
+       COMMON_TEST_SKIPS=(
+               # running gdb inside an ebuild as non-root, within sandbox,
+               # and possibly within a container is unreliable
+               -x test_gdb
+               # this is actually test_gdb.test_pretty_print
+               -x test_pretty_print
+               # https://bugs.gentoo.org/933840
+               -x test_perf_profiler
+       )
+
+       # Arch-specific skips.  See #931888 for a collection of these.
+       case ${CHOST} in
+               alpha*)
+                       COMMON_TEST_SKIPS+=(
+                               -x test_builtin
+                               -x test_capi
+                               -x test_cmath
+                               -x test_float
+                               # timeout
+                               -x test_free_threading
+                               -x test_math
+                               -x test_numeric_tower
+                               -x test_random
+                               -x test_statistics
+                               # bug 653850
+                               -x test_resource
+                               -x test_strtod
+                       )
+                       ;;
+               mips*)
+                       COMMON_TEST_SKIPS+=(
+                               -x test_ctypes
+                               -x test_external_inspection
+                               -x test_statistics
+                       )
+                       ;;
+               riscv*)
+                       COMMON_TEST_SKIPS+=(
+                               -x test_urllib2
+                       )
+                       ;;
+               sparc*)
+                       COMMON_TEST_SKIPS+=(
+                               # bug 788022
+                               -x test_multiprocessing_fork
+                               -x test_multiprocessing_forkserver
+                               -x test_multiprocessing_spawn
+
+                               -x test_ctypes
+                               # bug 931908
+                               -x test_exceptions
+                       )
+                       ;;
+       esac
+
+       # Kernel-config specific skips
+       for option in "${!PYTHON_KERNEL_CHECKS[@]}"; do
+               if ! linux_config_exists || ! linux_chkconfig_present 
"${option}"
+               then
+                       COMMON_TEST_SKIPS+=( -x 
"${PYTHON_KERNEL_CHECKS[${option}]}" )
+               fi
+       done
+
+       # musl-specific skips
+       use elibc_musl && COMMON_TEST_SKIPS+=(
+               # various musl locale deficiencies
+               -x test__locale
+               -x test_c_locale_coercion
+               -x test_locale
+               -x test_re
+
+               # known issues with find_library on musl
+               # https://bugs.python.org/issue21622
+               -x test_ctypes
+
+               # fpathconf, ttyname errno values
+               -x test_os
+       )
+
+       if use pgo; then
+               local profile_task_flags=(
+                       -m test
+                       "-j$(makeopts_jobs)"
+                       --pgo-extended
+                       --verbose3
+                       -u-network
+
+                       # We use a timeout because of how often we've had hang 
issues
+                       # here. It also matches the default upstream 
PROFILE_TASK.
+                       --timeout 1200
+
+                       "${COMMON_TEST_SKIPS[@]}"
+
+                       -x test_dtrace
+
+                       # 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
+
+                       # Hangs (actually runs indefinitely executing itself w/ 
many cpython builds)
+                       # bug #900429
+                       -x test_tools
+
+                       # Test terminates abruptly which corrupts written 
profile data
+                       # bug #964023
+                       -x test_pyrepl
+               )
+
+               if has_version "app-arch/rpm" ; then
+                       # Avoid sandbox failure (attempts to write to 
/var/lib/rpm)
+                       profile_task_flags+=(
+                               -x test_distutils
+                       )
+               fi
+               # PGO sometimes fails randomly
+               local -x PROFILE_TASK="${profile_task_flags[*]} || true"
+       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-dbmliborder="${dbmliborder}"
+               --with-libc=
+               --enable-loadable-sqlite-extensions
+               --without-ensurepip
+               --without-lto
+               --with-system-expat
+               --with-system-libmpdec
+               --with-platlibdir=lib
+               --with-pkg-config=yes
+               --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
+               --enable-gil
+
+               $(use_with debug assertions)
+               $(use_enable jit experimental-jit)
+               $(use_enable pgo optimizations)
+               $(use_with readline readline "$(usex libedit editline 
readline)")
+               $(use_with tail-call-interp)
+               $(use_with valgrind)
+       )
+
+       if tc-is-lto; then
+               myeconfargs+=(
+                       --with-lto
+               )
+       fi
+
+       # Force-disable modules we don't want built.
+       # See Modules/Setup for docs on how this works. Setup.local contains 
our local deviations.
+       cat > Modules/Setup.local <<-EOF || die
+               *disabled*
+               nis
+               $(usev !gdbm '_gdbm _dbm')
+               $(usev !sqlite '_sqlite3')
+               $(usev !ssl '_hashlib _ssl')
+               $(usev !ncurses '_curses _curses_panel')
+               $(usev !readline 'readline')
+               $(usev !tk '_tkinter')
+       EOF
+
+       # disable implicit optimization/debugging flags
+       local -x OPT=
+
+       if tc-is-cross-compiler ; then
+               build_cbuild_python
+               myeconfargs+=(
+                       # Point the imminent CHOST build to the Python we just
+                       # built for CBUILD.
+                       --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
+               )
+       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
+
+       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
+
+       # 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}
+
+       # Gentoo hack to disable accessing system site-packages
+       export GENTOO_CPYTHON_BUILD=1
+
+       if use pgo ; then
+               # bug 660358
+               local -x COLUMNS=80
+               local -x PYTHONDONTWRITEBYTECODE=
+               local -x TMPDIR=/var/tmp
+       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=(
+               --verbose3
+               -u-network
+               -j "$(makeopts_jobs)"
+               "${COMMON_TEST_SKIPS[@]}"
+       )
+
+       # bug 660358
+       local -x COLUMNS=80
+       local -x PYTHONDONTWRITEBYTECODE=
+       local -x TMPDIR=/var/tmp
+
+       nonfatal emake -Onone test EXTRATESTOPTS="${test_opts[*]}" \
+               CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty
+       local ret=${?}
+
+       [[ ${ret} -eq 0 ]] || die "emake test failed"
+}
+
+src_install() {
+       local libdir=${ED}/usr/lib/python${PYVER}
+
+       # -j1 hack for now for bug #843458
+       emake -j1 DESTDIR="${D}" TEST_MODULES=no 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 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} || 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"
+}

Reply via email to