diff options
| author | Michał Górny <mgorny@gentoo.org> | 2025-12-02 18:27:52 +0100 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2025-12-03 04:27:10 +0100 |
| commit | 3ad948b0a43598f7e6f5fab55ea1df7ad4dfc9d6 (patch) | |
| tree | a5202781a3cec216f49bc21ef0ae6b7b978698fc /dev-lang | |
| parent | ac669b2b65740dc77b0c763dfec0f8aa8cdbaea1 (diff) | |
| download | gentoo-3ad948b0a43598f7e6f5fab55ea1df7ad4dfc9d6.tar.gz gentoo-3ad948b0a43598f7e6f5fab55ea1df7ad4dfc9d6.tar.bz2 gentoo-3ad948b0a43598f7e6f5fab55ea1df7ad4dfc9d6.zip | |
dev-lang/python: Bump to 3.14.1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-lang')
| -rw-r--r-- | dev-lang/python/Manifest | 3 | ||||
| -rw-r--r-- | dev-lang/python/python-3.14.1.ebuild | 646 |
2 files changed, 649 insertions, 0 deletions
diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 2d2647514a0c..83e6d5a8ba9b 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -24,6 +24,8 @@ DIST Python-3.13.9.tar.xz 22681368 BLAKE2B 8fbf9b9e0dcc480a5bac82d5c18d6fdb63076 DIST Python-3.13.9.tar.xz.asc 963 BLAKE2B 7989940e3dfc62c553016f9d2b9aef447e770d63b2508f287e14495ba3e98326279d2bdb3b96bbc65ff2a859253bc43d8ce5387873842f656a66abef8380a3b7 SHA512 c33fba3a6b22dccc08beb7f13bd61a25a30f609a54da7c8dfd3b3b4a3490a7b24c11f9617a835388f22709fb09375d35febc417cf104a18f5bec3b43ec999e82 DIST Python-3.14.0.tar.xz 23595844 BLAKE2B 0fe495d62819c9066240927ceff022dc36920cfd9aa7f80f09fd82a6baf42fe0ef85aed7087418ad9769504e62dc0592cf9c06a542335d83ab65fc6399b5ac76 SHA512 46e9e205c3a084cba68bf7f267ab2fd0862a05430165e0eb713f2d6b3a1a4452f72f563de5de55caea824be9df56f66dd568f4814941667a9bb0954229772c53 DIST Python-3.14.0.tar.xz.sigstore 5374 BLAKE2B 50ed6dada3a7dfcfeb47e0cc55568c0e2ea01a5710f341d6423bb5b0982897b13a7a7c91d8b7c995499f687b17a6cf432fdcd3338b0ac658d19a8ad032438957 SHA512 147bf060a55b9108efb6f6a7f478c0b4dc1e7b1e215b842fb8adfe1b96bbe8d1b49ad352455e047d694638130f8533e3ea1c3a246e9ed0fde0d08e80113a6c44 +DIST Python-3.14.1.tar.xz 23563532 BLAKE2B c75d6048ca6b504217578041a6777b507a783f639736d580e0a2964a7d0411011d025a4562c38f68ffe46ee2f35135426f6c6c5d070c1d9106477421d6f92266 SHA512 b5ec011190536126fedade5c33a4afabc081a133ad5c734f4b872769d376735775219d63a482812d139fdd90c46707927065ab9dc733d0bce2d1ebc59fe705a2 +DIST Python-3.14.1.tar.xz.sigstore 5123 BLAKE2B b20634370ea0915c564c586b7537cfc19b8fb6f032fd6ad5df795fe818eea85e78375a32f3f079afdcd86e9aa4e5c2eae8933a326e0699e5c16ba094c39ddd94 SHA512 5b668deafa301d6eb69a7ffb03627c89d2f5de794be292f34cf44f6a1d81b46778f469282a746147a6ca5767a7b4c093b89d25a3a14fcb8f3b9c3e4f40808b27 DIST Python-3.15.0a1.tar.xz 23646768 BLAKE2B 63ccff58638d59b8c0061bf0a91c437c441bb2c08c6a76f51d38021c9122ea884474d52643389e10cddfa37644da69c3fd4267358c5dcf0bd86d4a3aaf5786a6 SHA512 5b86de5c935403b46b718d3a151f26c18e6ff5e468ee03c4dd09fd49c31b57560523ea24b5cd2e5283bbc0daf5621c7145d0af4ba67a23671b0652ce5cdad483 DIST Python-3.15.0a1.tar.xz.sigstore 5138 BLAKE2B 58268279c2f1db2e0350a3219300c2a96780df8d9f524db1526e3792c8b2ca94d1088ca8dabca8a583eeca7a0f429f90687643b5fe4c8e20414e68a3b138d969 SHA512 3f77187359658235c016dd8a8f42e87b23e1e1f5fd7c693e612267344e00aa8e464995f197ab8b0d44a0cf1c53311ecdf323ae670e6e7ee0375e01c80a7de37a DIST Python-3.15.0a2.tar.xz 23728836 BLAKE2B 56d655bc9ae7bbac97345c156b252667a8e0fcb2c017df6528e87464db7cdfc2731d095362849386eae1013e1468f42918f0cedf6cb59d87c6f97bbe3e5bc3dd SHA512 17187961b8cdcba2971ad1a523d4fc8b6339c19fac0e284e02622fa905c7fce93b1d68bf15c0966e0d6f731e7957291aea056e62f8a64fd36f7fbb9877a4f917 @@ -55,6 +57,7 @@ DIST python-gentoo-patches-3.13.9.tar.xz 8952 BLAKE2B 9941b3dd241adcdde64b38bdc3 DIST python-gentoo-patches-3.14.0.tar.xz 7992 BLAKE2B 8faff97c198abc1549d7c871c82ff649bbdbe18f9cfdad31aa7b6535391fff8e6adc387a120a6298ede8842421bc103cfae27da807e651c9898d4edb192f4fd7 SHA512 7bc425a89d0f3ebbdab4f52ce1300e16512bda4f08968222e8e68f22d3a794fc7d32a00644f4949810ebb41da0ffd4a5a962dcbee86c7660cd4214406ad16b01 DIST python-gentoo-patches-3.14.0_p1.tar.xz 8952 BLAKE2B d53c5a055be72e3f92a63e18cf75d2f6eb1e352a7529f7ce8256aaf0fa5ac92443646fe07bdbc707a28c1ed395c4c2edd29db0b8fc591679c7602aedfc968489 SHA512 ec03a259281d675063ad82dfd9c0fcb08402120663b9c2a56e37de45bb03e678fccd0c3723b6deffc4f5b8ea4ad17492040a98c7434853da2007f31cdb549bdd DIST python-gentoo-patches-3.14.0b1.tar.xz 5680 BLAKE2B 514b3edc3025e5bf675d371b5ada17dea426856edf1fb6095c2ee400eae95bd4265ef81fe593ae9338e801e7d0a25b1d5ba2d05ca563fd9dd020114b13575746 SHA512 74289e42cf532b54bb1b66a283ec19156f8a36ba38764209c133842314c9efb2ce2ebcba5aa9213bcf7fc0c8a5ca9b6e7adbd5dbfa4397233136d7cd55f53ee7 +DIST python-gentoo-patches-3.14.1.tar.xz 8008 BLAKE2B 52b47d49126a9e93ccc8425322fb3055337cacd8b913104cfec320acae267d44140286b8be720fa5a98b146257e4847b8df46a6f9124d8e81368a1ad24194c0e SHA512 28f6a746dd5e06e432a79eef33fc80faa8ac589f1d328e4e86fdd9e6aa5012f248c81e47204c1fe64ed16cc15038eafef27d6fffb947dbbc4705b559d5639b13 DIST python-gentoo-patches-3.15.0a1.tar.xz 3820 BLAKE2B 1ee2ae65f079807d2665b050d4fbd744e71a7db8b14b80f52c32ae0c4593220037f0f7793cb8889fa3cde08b27ca8a2325e578bdf594f0eb1d1fdba90598369c SHA512 ddd00f3d6e22e7757ffe7c55ef7137e8d69377524c4047796594aca73f8d430efef2cb4a6dfe48b6d0fbef3cfae4812ead888ed49270d9b951e872879d2396ab DIST python-gentoo-patches-3.15.0a2.tar.xz 3812 BLAKE2B cef6e13033d90f119e24d560b27849ccc5082b6eb4fe13959bdc01d084c381ea5aa0d179b044b36f457bec9e2cdf794b2e3c0b94dd6dff31eb98edafec00657f SHA512 6858c320c86a4ca65be918a2c579a9cf62af861d5f3f052b5529de0b8e2905f3a80ff39b22c1860305d1682b8cc61d8f09bb3b42eaf309998a6a0f96953ac45e DIST python-gentoo-patches-3.8.20_p7.tar.xz 54544 BLAKE2B e31fc9fb5e98b62b0f70165670ec58ed4fa932cfc95d5287c249015a3a372fdbf0d1ba08cb98f63c2dc500700edfd6ffea6db670385d2c86a4fdb92ffb991192 SHA512 a9e7e4976be226931a503af2c986da207d060d4ce436af61f5e8427da513639adbed32bb0061963b83fef275a5de91707ab13b7a9abf3a7472ee0e2c5310eda1 diff --git a/dev-lang/python/python-3.14.1.ebuild b/dev-lang/python/python-3.14.1.ebuild new file mode 100644 index 000000000000..23b365104478 --- /dev/null +++ b/dev-lang/python/python-3.14.1.ebuild @@ -0,0 +1,646 @@ +# Copyright 1999-2025 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 eapi9-ver flag-o-matic linux-info llvm-r1 +inherit multiprocessing pax-utils python-utils-r1 toolchain-funcs +inherit verify-sig + +MY_PV=${PV/_/} +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}" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +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 + ) + 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-15:* + >=llvm-core/clang-19:* + ) + ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi +PDEPEND=" + ensurepip? ( dev-python/ensurepip-pip ) +" + +# https://www.python.org/downloads/metadata/sigstore/ +VERIFY_SIG_CERT_IDENTITY=hugo@python.org +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 15 + 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" + + # 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 + # pydoc + ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die + # idle + if use tk; then + ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die + fi +} + +pkg_postinst() { + if ver_replacing -lt 3.14.0_beta3; then + ewarn "Python 3.14.0b3 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.14 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.14/site-packages" + fi +} |
