diff options
author | mirror@stealer.net <mirror@stealer.net> | 2025-07-08 18:00:33 +0000 |
---|---|---|
committer | mirror@stealer.net <mirror@stealer.net> | 2025-07-08 18:00:33 +0000 |
commit | 182f37c5d460f3583ef49c34451b22d0a2a96cd7 (patch) | |
tree | 5d3541cabc36eafc1313b324ba14fd1cc0daaee7 /dev-lang | |
parent | 7a7aee6ee9854c20da60594e1f6c1549f8b78ce5 (diff) |
2025-07-08 17:40:40+00:00
Diffstat (limited to 'dev-lang')
-rw-r--r-- | dev-lang/Manifest.gz | bin | 22495 -> 22498 bytes | |||
-rw-r--r-- | dev-lang/python/Manifest | 5 | ||||
-rw-r--r-- | dev-lang/python/python-0.3.14.0_beta4.ebuild | 634 | ||||
-rw-r--r-- | dev-lang/python/python-3.14.0_beta4.ebuild | 645 |
4 files changed, 1284 insertions, 0 deletions
diff --git a/dev-lang/Manifest.gz b/dev-lang/Manifest.gz Binary files differindex 54d94e2ec365d..0d495915122b2 100644 --- a/dev-lang/Manifest.gz +++ b/dev-lang/Manifest.gz diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 938d6cb3b664b..f3676697eeb02 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -14,6 +14,8 @@ DIST Python-3.13.5.tar.xz 22856016 BLAKE2B 9caacad8745dcd238b208022cb140a6655ae5 DIST Python-3.13.5.tar.xz.asc 963 BLAKE2B 2db0162d18129ec42b48393108a72c28e7f8f8c3fa40b2e231c87fe0bdc3c166fb6ca4a1c1dfb3fffe1aa0c2618c7ccb245513beb7a0919b4aaca5ec7eb23b36 SHA512 07c1a2ec2d6ba2805680b7f1dc262fdc5dc3eec4503780ecdc08cd570ccbb5f1efa736ee03c83d36bdb33ce87db06be5892cf5a6eaf4018d5fe78fff99e615ae DIST Python-3.14.0b3.tar.xz 23626928 BLAKE2B 354a07abfe838688ca2e02a989864bfd3dfc903b62968125bd0e74c76caa57b1488aace8cf96942f07a29decb89d72c7ca52cb21cdef5948ca79b8f2fdd710e6 SHA512 621bcaf2ae4b6f0ba6c95ef74b5ffb78d8a2a0bb10415fb4c5eab1cad26c63098237944713a7f0812ec3e014ff62cd0f9bd5663e87799fcf1856aa4b937be914 DIST Python-3.14.0b3.tar.xz.sigstore 5326 BLAKE2B 61bb9e80c2c2149aa43e7f97f472e14b71af1bbbef0641e891bc440e9ddae7b968d525b0d44e152c911a05e5f04ca0a710483dfbf4675d0894f619f0e7190595 SHA512 80feff3997ff99f053ad3d8b8e488e5b952c6e0cdb1fedfcb31a7a72ca67eff60b99d875767df068c8833ec7d40cec53fdc838ce5bb85d330a86283d3057c567 +DIST Python-3.14.0b4.tar.xz 23641472 BLAKE2B e894c115d50371e2ecfd5c0cf79f37d3bff230338524bbb2352af8e42d256cd8fe17a38c68769d3125ddcae33500fd151ed64b5641d7f35f4b8968fcae9e31b4 SHA512 faaea000a474430a4ee41bdc95f9a77aa6573354698bc987a7617a6d36eae4b8e7f02ac945eb5b97df8dc62a256725ccd59fec08d4af2bd7b6e8a31ef4f92e2a +DIST Python-3.14.0b4.tar.xz.sigstore 5038 BLAKE2B 95bd040d9be4d746b8d1a5a7486d309783248093b032b85ac5e7e7eaf35caa99b43bf3bf7c3ad69635a7b4f14bf6e42a9ba0b54d19986069b5dc075d17a8ddd5 SHA512 3e2a7a73d5cd98e4e8139ef89bf75c1213459db7634bb57ea2de126ff403e7f9244ec6fca525bcb55b9cd5342cbc80d659772709ebf405d330dcd4f14f93a7cc 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.23.tar.xz 19659284 BLAKE2B 17c7c9acec1e2f2e9d146b2c35738ea05cf16609f267dd784668ab43bcce7be93e164c14106f9640a060326ebb2b8bd4ee4e58086bdced4ca611d7f96dbb3699 SHA512 ad2eb2eebff286a16ad631339bc0890b0686cf5e669d28905a98f96e9b1af6673d255f36bf19e146aa4de8d012587dc6b3193e903718f9cdba4b97041318f418 @@ -26,11 +28,13 @@ DIST python-gentoo-patches-3.13.4.tar.xz 8912 BLAKE2B e3d9f2a12f801dc75e09c53017 DIST python-gentoo-patches-3.13.5.tar.xz 8916 BLAKE2B 9d985b12af62b8a917cac1dab9576aac099bc81ad954a5de254a14a3c7d2254edcdcfaadc46314b69a1bb76bd30ca8bed7c866c0de3fc3f89aac0f76af344f32 SHA512 5ac92aa3eef82eae5d707ffcb5085ac98bd9bf64f72fc7ac4aa1b12a0c3aa86c57d0f671ca07f46e2250779f4cf4885916e4d175357ad626eca6e41257a027e7 DIST python-gentoo-patches-3.14.0b1.tar.xz 5680 BLAKE2B 514b3edc3025e5bf675d371b5ada17dea426856edf1fb6095c2ee400eae95bd4265ef81fe593ae9338e801e7d0a25b1d5ba2d05ca563fd9dd020114b13575746 SHA512 74289e42cf532b54bb1b66a283ec19156f8a36ba38764209c133842314c9efb2ce2ebcba5aa9213bcf7fc0c8a5ca9b6e7adbd5dbfa4397233136d7cd55f53ee7 DIST python-gentoo-patches-3.14.0b3.tar.xz 5708 BLAKE2B 14706315eeed5b2e3d13d0479443e7b9153bc4be8510620e54453ac1b81d2baf0156d1ac67fd2927a2b389c7dfe18cc67ce14e7e7d6e01f2cb0ebe255baf462a SHA512 45d1d194efcc08f7e4b4b593604f52abb34b5f6a6b81370540d489d362a61894ddf86ab59c2d5aa67a5293613f081bc50586257060929702914851170f1b37a6 +DIST python-gentoo-patches-3.14.0b4.tar.xz 3780 BLAKE2B ad67e213b21bc039bf33c0a2e6d3a4ce5e06179ce167f89d56561834dfb5c5b5b5d7f43f6fe2597e94e4ea5d544bb0b60d38b847bb0c32277a0151f2084f3618 SHA512 e5e6fa02d2d24e46848fa5a79ba7fd8a6703473e3bee257fee7b5c55d5c82fedb29f0ba6de1117c6ca738df3841bae5bb00962ae0290d553020e3617dc557c6d DIST python-gentoo-patches-3.8.20_p7.tar.xz 54544 BLAKE2B e31fc9fb5e98b62b0f70165670ec58ed4fa932cfc95d5287c249015a3a372fdbf0d1ba08cb98f63c2dc500700edfd6ffea6db670385d2c86a4fdb92ffb991192 SHA512 a9e7e4976be226931a503af2c986da207d060d4ce436af61f5e8427da513639adbed32bb0061963b83fef275a5de91707ab13b7a9abf3a7472ee0e2c5310eda1 DIST python-gentoo-patches-3.9.23.tar.xz 37148 BLAKE2B a7c0514037169b9938b2180ec2dd22063621d532367f6febfa47da43f47534559baab992d9c5257271121af755b8445346d4d92582e7e11b6468a1c359f28bf2 SHA512 73ef00a7aa671016de396c9e1c4bb5f5c1a97dc735739f806d809f987e802ec440370bf4c85468097547284a5d2b476cbffcec3cf219b7cb6fc890d5029eb5bd EBUILD python-0.3.13.4.ebuild 16351 BLAKE2B fe8b885309d8b792c952195474c1e35eb2c9df253b7981698e5cbc04e76fd09a03a31f75d749883bce3ef239fc4f1e9b78ded7a0a478f6d9c39915cc36380764 SHA512 abe7d330406f6dc1ab9412a633cad101fb377de5ccbd20dc29a6e6efcf8a54d8ea32aa4fef9394eaf7b487130797509219076ee9c31245550b979cfcac74ea3a EBUILD python-0.3.13.9999.ebuild 15874 BLAKE2B 687a462d82cb59b53ec2b274e1b7163231ea78b10f61f47b4bd9af930047f4c28f2cfea80497923ffaf9a2b78747ecfc43087fb68f742de2ba8bb8383c9b0d13 SHA512 c087191a1b7d56d8dcb84e2e8242d7d1e32c7957811c963d2a55a0866ecfb4f99e19b6a0c96177c9f575ee5562482778a02ca696a3602f8fda9eefb08c856d14 EBUILD python-0.3.14.0_beta3.ebuild 16678 BLAKE2B 6c2891db9cb54677fdbb2dce33ec3c6ba641ce255439a2aebb187c78ffc00276ca163a8d4ec92dfcb5e5f8ce2d02f98fcdea76dc0653bae8eff249dda4117ded SHA512 2de4a0687fda5665ede9dff4c883a397b98c719143af4370b169bf66c45004dfe61a8296f7afae4dd89c404126c2349630ac2fcf2c44c026a797a2e609574a69 +EBUILD python-0.3.14.0_beta4.ebuild 16678 BLAKE2B 6c2891db9cb54677fdbb2dce33ec3c6ba641ce255439a2aebb187c78ffc00276ca163a8d4ec92dfcb5e5f8ce2d02f98fcdea76dc0653bae8eff249dda4117ded SHA512 2de4a0687fda5665ede9dff4c883a397b98c719143af4370b169bf66c45004dfe61a8296f7afae4dd89c404126c2349630ac2fcf2c44c026a797a2e609574a69 EBUILD python-0.3.14.9999.ebuild 15924 BLAKE2B ad15d8bba4630ef6b4a8d66300b6ffce03984ebcb6d5787a1ea70c773221e8729ed47fb3772ba3bdbf5e9b3e8d3e2aeb540e25e87a61f51579a5fdc8818e2ac2 SHA512 7034d770e8543f0b05fbdc352eccfde58bb8a2d91b6596bec2a9cc09f1881efc0844ab45c97c48ebe18294347c0e4ea304cb725f9d22689372db740ba754b8ca EBUILD python-0.3.15.9999.ebuild 14915 BLAKE2B 0c40487aac31edcf7c8454585e64a3b14409492eb0df5a1c3837d89c611c58b58c62a0e83a9aff3ff1d169b331809a939ff6780ab102d9be712cc2da8f9fd4b2 SHA512 47b430673b2d3b30c4d01b0d058fd9e4d261610823358ab19fec5a6017189828b1ae5802b4b6dd6cdfb9568ef90e0dc3d496f4c1b0610214948d89e22092c397 EBUILD python-2.7.18_p16-r2.ebuild 8481 BLAKE2B cde3a1c2aadf3d56d8c4452f719dae8d2006fda7ebefb788854fcba84799960acc33d6edb404b0c7361cde90366714006290bcaf6e665a4203a59c5cd7cf990a SHA512 61b820f106d53ea8ec2ba0793008ce43b97cac5bca05712866c8a3dc871423e8ff7416b5e121f7ecd38dd8fe38f396de46747a14f9795e309ead09b16370c0aa @@ -43,6 +47,7 @@ EBUILD python-3.12.9999.ebuild 15162 BLAKE2B 11fd8aa59e21d9c68c6c638e3d8115881ff EBUILD python-3.13.5.ebuild 16260 BLAKE2B dbf588547dfe6c3f87a60f5f489c907494343330483567801836973bcff31f45d4e84a4153314eec1584f617ad7a144ab7c0c7591de44bc6851119c3dbeb35bd SHA512 60126d9eb45d3b25016197aff731ad30298c9af1750925f70890efd7005dc3178fb184f564b1775c52b48f490717d50aece3e24a830c9c4f8b0de1063f342199 EBUILD python-3.13.9999.ebuild 15823 BLAKE2B a7e737e88f92b2d0ecdf823a84b6a7629daa23c05429d57f6a8e9c40c413b52742001bf6d1f1f955792cd4e5251fcd777a279f3801883058e42635f10b60a012 SHA512 54c064f7c890fb4b60e5534b5f0dc866a0ed4bd682a95193d48a6aab60b1934493b0df7a81744ec91660a3cc1014a97e221c75c0f31bd17fdb44fdf8f605d1df EBUILD python-3.14.0_beta3.ebuild 16958 BLAKE2B d334906e23669995058a59c679859e232aa7e648e1d1a566dd0d528a89d7cdabe22164b66105a8f4e5d8e6e3f0675b8d9e2968a81529de2d92ea3ebb995a6853 SHA512 32b27d587308d0cd7bb17fbf4f52ab278b2f8543ecb73be64095ecc20d53630456bead3faeb93016eba8eef6fae484d79e584fa857162c95a3ad5583237c4481 +EBUILD python-3.14.0_beta4.ebuild 16958 BLAKE2B d334906e23669995058a59c679859e232aa7e648e1d1a566dd0d528a89d7cdabe22164b66105a8f4e5d8e6e3f0675b8d9e2968a81529de2d92ea3ebb995a6853 SHA512 32b27d587308d0cd7bb17fbf4f52ab278b2f8543ecb73be64095ecc20d53630456bead3faeb93016eba8eef6fae484d79e584fa857162c95a3ad5583237c4481 EBUILD python-3.14.9999.ebuild 15873 BLAKE2B 10faa9f03f8a9a4257d12042e86016fe8d795186ed3439c525f0a07233f1dab7a4e8cd8c4f47028bf403d351914a4251cbcdae1a5bcfc32ace6347aaa78d71c3 SHA512 0b338781cf27d121f01657e241d36d5384af6005360b7292109b0131476c075e8c07e357ef3ac74bfa5c8cea487a3cd8ec3482c597b705039de072e8fb157455 EBUILD python-3.15.9999.ebuild 14866 BLAKE2B e001178b4752116601674001fb7c59d5bdb8a2a38a317b5bd9b75273e51bab204e8e497b481b944c267876ec74bb1d515b0b63f0b4dac85e88e9b3561e0392d7 SHA512 d61eb31848effa7732b53e511996bd45505aa70ff93f635ba0d29925f27ba4b62d3f6f710d72b22ee1756671cf18b5edf6e7fd7e9c3eb766af7c2618e559ce99 EBUILD python-3.8.20_p7-r1.ebuild 13381 BLAKE2B 5d1e1345ada0e0bfe7c2a1050836714c82f59c9898e97c1753fd79c8ee55a89d7a9471f43f00fa9a55f8d148a338032380ab49deae741bd3fd44b2749ef2d6d0 SHA512 7a3e4c1228e80671b7f79e0879310109f1e5dee8643871d101f2cef588cfb1c066f6f50b020e30590544ebab788aa631578042c19305618242c0b78ecd9bc2e3 diff --git a/dev-lang/python/python-0.3.14.0_beta4.ebuild b/dev-lang/python/python-0.3.14.0_beta4.ebuild new file mode 100644 index 0000000000000..26514fc0a6932 --- /dev/null +++ b/dev-lang/python/python-0.3.14.0_beta4.ebuild @@ -0,0 +1,634 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" + +VERIFY_SIG_METHOD=sigstore +WANT_LIBTOOL="none" + +inherit autotools check-reqs eapi9-ver flag-o-matic linux-info +inherit multiprocessing pax-utils python-utils-r1 toolchain-funcs +inherit verify-sig + +REAL_PV=${PV#0.} +MY_PV=${REAL_PV/_beta/b} +MY_P="Python-${MY_PV%_p*}" +PYVER="$(ver_cut 2-3)t" +PATCHSET="python-gentoo-patches-${MY_PV}" + +DESCRIPTION="Freethreading (no-GIL) version of Python programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${REAL_PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${REAL_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 build debug +ensurepip examples gdbm + libedit +ncurses pgo +readline +sqlite +ssl tail-call-interp 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-arch/zstd:= + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-libs/mpdecimal:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-pip ) + 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 +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +# 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 +} + +pkg_setup() { + if [[ ${MERGE_TYPE} != binary ]]; then + 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 + 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=( + # 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 + ) + ;; + arm*) + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + hppa*) + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + mips*) + COMMON_TEST_SKIPS+=( + -x test_ctypes + -x test_external_inspection + -x test_statistics + ) + ;; + powerpc64-*) # big endian + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + 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 + -x test_gdb + # 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 + ) + + 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 + --disable-gil + + $(use_with debug assertions) + $(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 + # Fix collision with GIL-enabled build. + rm "${ED}/usr/bin/python${PYVER%t}" || die + mv "${ED}"/usr/bin/pydoc{${PYVER%t},${PYVER}} || die + mv "${ED}"/usr/share/man/man1/python{${PYVER%t},${PYVER}}.1 || 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 + # rename to avoid collision with dev-lang/python + mv "${ED}"/usr/bin/idle{${PYVER%t},${PYVER}} || die + else + rm -r "${ED}/usr/bin/idle${PYVER%t}" || 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.14t/site-packages" + fi +} diff --git a/dev-lang/python/python-3.14.0_beta4.ebuild b/dev-lang/python/python-3.14.0_beta4.ebuild new file mode 100644 index 0000000000000..96b2eb246539e --- /dev/null +++ b/dev-lang/python/python-3.14.0_beta4.ebuild @@ -0,0 +1,645 @@ +# 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/_beta/b} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.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 build 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:= + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-libs/mpdecimal:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libintl + ensurepip? ( dev-python/ensurepip-pip ) + 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} + ') + ) +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +# 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 + 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=( + # 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 + ) + ;; + arm*) + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + hppa*) + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + mips*) + COMMON_TEST_SKIPS+=( + -x test_ctypes + -x test_external_inspection + -x test_statistics + ) + ;; + powerpc64-*) # big endian + COMMON_TEST_SKIPS+=( + -x test_gdb + ) + ;; + 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 + -x test_gdb + # 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 + ) + + 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 +} |