From b8330d80ce605a72596ccfa1bfc087b9ded559b8 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 13 Oct 2023 18:18:15 +0100 Subject: gentoo auto-resync : 13:10:2023 - 18:18:15 --- dev-lang/python/Manifest | 4 + dev-lang/python/python-3.13.0_alpha1.ebuild | 530 ++++++++++++++++++++++++++++ 2 files changed, 534 insertions(+) create mode 100644 dev-lang/python/python-3.13.0_alpha1.ebuild (limited to 'dev-lang/python') diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest index 2bd31c30377d..48fbf09529a9 100644 --- a/dev-lang/python/Manifest +++ b/dev-lang/python/Manifest @@ -18,6 +18,8 @@ DIST Python-3.12.0rc2.tar.xz 20563748 BLAKE2B a6d474cab25fc50878539c214e5f80be59 DIST Python-3.12.0rc2.tar.xz.asc 963 BLAKE2B 6746c9455e292c43d2984a81879145302f3cfe45f447ea586387e5d70f713a2d36fa7055b62f00dbd2ab277ce7f0cc90b66d76a6bcc12df7e56cea67413deffc SHA512 e5cd0952fe20f7b5022be3bc057eb83ae64304640f0761bbf08382be733ed7e6ed75c113b844e827903634c701641644298f26e2d6624857760eda1908382428 DIST Python-3.12.0rc3.tar.xz 20566024 BLAKE2B b5f709eb80ceec58ced5bc7b0a4bd9649668a36e7705ab206946a878c952b15c8209af306aabf0365ff89fb6ad72be1c34848037bee41ca428f57de872d82d74 SHA512 a256147099add2da96f7dc97f965ec342317c0c021f4702ed38718e64d90a28356a266cd2786c10baab6d07bd9dc111f1c1d66ca7dc92e93674e339e990a8a83 DIST Python-3.12.0rc3.tar.xz.asc 963 BLAKE2B 790b5c25ff5058d4d53c0c189ba82ba32b62cdfb100e658ca6171b2ade73bbfa155208a6c3053f498caf664852649d900b8a5173e48928f5c3c90d51a557877b SHA512 224d4402b96d6f5938d0eec83a3e494e25b4d883f9466c653788b86fc4ce5ab26ac8d9891f7aa20a6bd4766a5bc47fbe19afbc27db9148071b6b215bbdcc32f6 +DIST Python-3.13.0a1.tar.xz 20137588 BLAKE2B 62612d22ce652f4b1d7ce93aa30bd5814dbf271dbe98e321b99d003d7da8f74798e55f556db75fc39b676295c1d1f7b31919c444fe3c667d2fbd2ea16799a211 SHA512 456c6c7cb18b92645269ffa6c4db4b18370664aa60f2dbe8f42c87ae4d6d0e34940500fa06c13f0f043c33213f4e3022e233ef01bb65b50fba91454f1db3ed5e +DIST Python-3.13.0a1.tar.xz.asc 963 BLAKE2B b4d765b76bfa13370bb9eb649e009149a292a09ec2739bbc7014be1026b9e6de06d3223cdc404fa86ef022a67c5605513c47050ca14f9d9d8dffd5e505f64328 SHA512 964e9eca1964b43333c755437d923abf0e96c7567a09ae3b9a9aad52fa5063b9699546e7b1f0bc96883b7487f3c44fd3bfda1573147fc1c4384580d77ec0272f DIST Python-3.8.18.tar.xz 20696952 BLAKE2B 45be712aeef8bb3ba04aa2bd7d0282aa5f817327749c620ede18ee307fcb432540db9062a8186b08b49467515c74f01eb6fa739f366cca76dfadedcb22858429 SHA512 0be1d85cafade25e99b8277ba51d7b9b3a3d2dbbcc52fd0d1c633c47982e5dd87fd7a0ca180a78d7801d79a8ecafa79bd9d501d544cd7b6da53ea409daa70adf DIST Python-3.8.18.tar.xz.asc 833 BLAKE2B bc4e989748d53c6be7040e78d9f1852227c6a76f4c63a68824f5139defd51d1ea7988df01f961ff5c77382e156ef45fead2bb97bddbb38b208ddfa9c709e4f34 SHA512 99a0fd74fe19144819fd9522836474e10c1593787eb464694bdc6224b2d4a9331e31d2ecafc35c2bbb9bf67f20186295b28f9374c1fdcd05ac13f5f400219489 DIST Python-3.9.18.tar.xz 19673928 BLAKE2B 97da9bedaf29101e5df82199ac3ee12f1da74d5cc89de21ff1510c3f6d34d7f9194489e79855f1ab3c6f26768738e784cb7231c1a692fa746edd21d35558bc4e SHA512 aab155aca757d298394eddb91ff9a8f239665bd46feb495c6b6f735bbcb7489c05c858cc4cd08f1575c24f293b33492d763e9a140d92f0b2b0cc81a165a677c7 @@ -33,6 +35,7 @@ DIST python-gentoo-patches-3.12.0rc1_p6.tar.xz 349384 BLAKE2B 975aae449a01a31c45 DIST python-gentoo-patches-3.12.0rc2_p1.tar.xz 5168 BLAKE2B 399ad4854c46e0a2bdc7c3028cc5ad1807a1d6566654a1a85bf9a8a1b205aa7b57ab1706d8ae478b93f0938a9c205374b291aaac0c3356c05d99c5955633f541 SHA512 61ac3191e0dabbc9eeef54595e4071523205def60dca9c86fdb58d72971423d6d4b37a0875562b8f1ec8627230062aea765c07b771a9ce002a1026cdaacd507e DIST python-gentoo-patches-3.12.0rc3.tar.xz 5168 BLAKE2B 66f132bb26c5ce36823897a6938c0f7018afd8f3c53cf738656929a944604de2764263c437c6ee4f81b617f02a33ef154d354998d14fcaef358b19b867da2937 SHA512 72fb6371871bb41ba59ddf711444fa17524fc7ac185db0ac762f6664c61cf086c73d13df10c0346094f603ed2d783bae201ee79de8d7d4cc339b74b26bd0a2f6 DIST python-gentoo-patches-3.12.0rc3_p1.tar.xz 9700 BLAKE2B e87bc56dcf82dc0ba598ac68ffda4dbd4dd8dac4b1e9d2bc092f4ef05b9045a41270dffc7b727bcc4e82df302ee923d29dae9c18ebf97494a016c30c2f3073ac SHA512 5d9eb94ab0ffe1fba81362c448dabcd771f89e0a8576a72e7d5748831b9b8bb858942ed6c2eee3306be2a42fe4ed01f971269969c0fd6279c32d390a3a8f7cd8 +DIST python-gentoo-patches-3.13.0a1.tar.xz 4352 BLAKE2B 49f52cee497fbde6ca9628002d367e64455a628d383ce88c89a773b8d566c1601a22b65ccc130ce842bef67d3014ed987d35f86a1b83ac7ba9ad78fb7b0a6144 SHA512 bcfdc102f7c52681263e216fb46b08bcb6fa104d5a70f64eba16ab30bad2c7a9bd64a7031d3dc4f6bda842486ce8edd4bd4c17d0de14e6f2682876a8af396c5f DIST python-gentoo-patches-3.8.18.tar.xz 32424 BLAKE2B 2e0b6e1c8e3df666934ba283214ca1577b01140dea00513f6420b0255650002e4bc4cb142076620227cd430bc2547123fd392883285886e543ef72ca466f8ea6 SHA512 b005f1054b726fc8c82a50b006309de64fb7858fe5c22cc7b160687d059a7859ec9388706b74a0e6c1f42301bed071dc639eb8cfae0d7c5eef2f565c63cc2d29 DIST python-gentoo-patches-3.9.18.tar.xz 25044 BLAKE2B 1d9ace5c5a0f1c15bc23595cc51d64b4c2b416552cdaaa960c3e34360aba3e7029a06e2a077212c68fa7aee4fd20f649a3b0926bd4ebb10e529e8350ab051e63 SHA512 bc180c3346dfae60a7db221d114146ee83409bc42092171eb05c83de528bf5f0e5654d1441f40ba839d0a98e866a5b43452fb7a72047c837497620a12097b8f5 EBUILD python-2.7.18_p16-r1.ebuild 8603 BLAKE2B 13c654aad809e8f999fa36e63f4a4eec5c2804644fab92c6f1a5c8ef75b20bde8509c34358e32350d7ddcbf8a309b9c5c008a9f9ab83c7d208434bd7efab0467 SHA512 88de339a316876a5a71560842cd879ba96b522f7dc4e409e6a22109639a538cb38abdc1a3d6c8ef468476841d1fe6014327197e8e2b0dd2d357ecde34bf8993a @@ -47,6 +50,7 @@ EBUILD python-3.12.0_rc2_p1-r1.ebuild 14681 BLAKE2B 9cdf429936b069e99782907e013f EBUILD python-3.12.0_rc2_p1.ebuild 15064 BLAKE2B 757229ebd88aaae7397a28ae19e2998efb23332aa4155da8b84153ccc12a6f489b1122409661fd765593a56f1e7e3a87320acd018d2697f949b3210110398474 SHA512 a7421e7d9d70f92f5ff84917d79d6eaec046de54d7ddeb671238f29b7743edd071cb5d2d570fafd6f29d3e3961a52546802fe105ade6abb2cb9887d6457e305e EBUILD python-3.12.0_rc3.ebuild 14681 BLAKE2B 9cdf429936b069e99782907e013fe94f4c80253103b30266a42cd1c74a4f0844f83f92cc679cba0199e99c4e5935d866fd9a5e39b90077bb1bf420f1fd8287cb SHA512 d179af9d4244b450177f6f1053c0650998c4d41ebd7b8d99f3d417e1354e4290dfdc0b2e57bf22d3be7e14963408fcaf4a4a34c9aef6652701e1aa6074bb622b EBUILD python-3.12.0_rc3_p1.ebuild 14681 BLAKE2B 9cdf429936b069e99782907e013fe94f4c80253103b30266a42cd1c74a4f0844f83f92cc679cba0199e99c4e5935d866fd9a5e39b90077bb1bf420f1fd8287cb SHA512 d179af9d4244b450177f6f1053c0650998c4d41ebd7b8d99f3d417e1354e4290dfdc0b2e57bf22d3be7e14963408fcaf4a4a34c9aef6652701e1aa6074bb622b +EBUILD python-3.13.0_alpha1.ebuild 14509 BLAKE2B 86bd65a60a3434c1a6ee87eca81486ba133888dbea9e7bf407b3412e48b17f3f5865f588ab70efe3ea541a62ec1f92745a6f14122c174be57e5328a76d66c309 SHA512 adbd0c3ec2ee071a56f856c6f02d64232b0880372bf6310efd56c969991eda406e43beeb4ecaabaaf4ce887ab1ab7f02439df039ed1829611dc5f83dcfadd5db EBUILD python-3.8.18.ebuild 12365 BLAKE2B f186fea669f32e250e044d575690418ba81dc0f9389c9c1c61a91ce09261277028042a80daefdc5b4946d88fbf4ea159d68896d27d1d981502f8a32fb76b010d SHA512 4b7cc3ab54d43c0eebfa72b3e7b41755d391b6d9076fd56a155dd28b18f8e8c5d67a6472d03913e1b766f030152ae158e40edab1dc2a4a6c9f8251d7e44fc8c9 EBUILD python-3.9.18.ebuild 13866 BLAKE2B 06ebd3752ef075f85633b74c8237537bdc551de1e6fa20ffe5a914cedfd5186678b4e9bd3d5e46539607c317e18f3e03e671a19ffb065767a7d32811d9c543fe SHA512 886622cf89cc87ad7490a94775e01d02305953be1caf3de5c771fb7d926db33a69961c1048428f8c07dde7670d1be05dbd81822cc50ad348ad07a5ebfb005deb MISC metadata.xml 1436 BLAKE2B fd5ebcef153bc74aae02f8930dba67736ce44b1dd23418448e7d5bd22391845f5edf0ba8cdf3f43af9254c68734b95fbac9ee891f09c4584c9272ac4233eede6 SHA512 124a1e743cef7236f7936aa843d3aae739a420b1b6173f02c2ef787745616891142724446320d887aeecb95fac09e3620a9666e8e3e32085d79019fe71ff7da5 diff --git a/dev-lang/python/python-3.13.0_alpha1.ebuild b/dev-lang/python/python-3.13.0_alpha1.ebuild new file mode 100644 index 000000000000..2f06bb5630ca --- /dev/null +++ b/dev-lang/python/python-3.13.0_alpha1.ebuild @@ -0,0 +1,530 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI="8" +WANT_LIBTOOL="none" + +inherit autotools check-reqs flag-o-matic multiprocessing pax-utils +inherit python-utils-r1 toolchain-funcs verify-sig + +MY_PV=${PV/_alpha/a} +MY_P="Python-${MY_PV%_p*}" +PYVER=$(ver_cut 1-2) +PATCHSET="python-gentoo-patches-${MY_PV}" + +DESCRIPTION="An interpreted, interactive, object-oriented programming language" +HOMEPAGE=" + https://www.python.org/ + https://github.com/python/cpython/ +" +SRC_URI=" + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz + https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz + verify-sig? ( + https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc + ) +" +S="${WORKDIR}/${MY_P}" + +LICENSE="PSF-2" +SLOT="${PYVER}" +IUSE=" + bluetooth build debug +ensurepip examples gdbm libedit lto + +ncurses pgo +readline +sqlite +ssl test tk valgrind +" +RESTRICT="!test? ( test )" + +# Do not add a dependency on dev-lang/python to this ebuild. +# If you need to apply a patch which requires python for bootstrapping, please +# run the bootstrap code on your dev box and include the results in the +# patchset. See bug 447752. + +RDEPEND=" + app-arch/bzip2:= + app-arch/xz-utils:= + app-crypt/libb2 + >=dev-libs/expat-2.1:= + dev-libs/libffi:= + dev-python/gentoo-common + >=sys-libs/zlib-1.1.3:= + virtual/libcrypt:= + 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? ( + app-arch/xz-utils[extra-filters(+)] + dev-python/ensurepip-pip + dev-python/ensurepip-setuptools + dev-python/ensurepip-wheel + ) + valgrind? ( dev-util/valgrind ) +" +# autoconf-archive needed to eautoreconf +BDEPEND=" + sys-devel/autoconf-archive + app-alternatives/awk + virtual/pkgconfig + verify-sig? ( >=sec-keys/openpgp-keys-python-20221025 ) +" +RDEPEND+=" + !build? ( app-misc/mime-types ) +" +if [[ ${PV} != *_alpha* ]]; then + RDEPEND+=" + dev-lang/python-exec[python_targets_python${PYVER/./_}(-)] + " +fi + +VERIFY_SIG_OPENPGP_KEY_PATH=${BROOT}/usr/share/openpgp-keys/python.org.asc + +# large file tests involve a 2.5G file being copied (duplicated) +CHECKREQS_DISK_BUILD=5500M + +QA_PKGCONFIG_VERSION=${PYVER} +# false positives -- functions specific to *BSD +QA_CONFIG_IMPL_DECL_SKIP=( chflags lchflags ) + +pkg_pretend() { + use test && check-reqs_pkg_pretend +} + +pkg_setup() { + use test && check-reqs_pkg_setup +} + +src_unpack() { + if use verify-sig; then + verify-sig_verify_detached "${DISTDIR}"/${MY_P}.tar.xz{,.asc} + fi + default +} + +src_prepare() { + # Ensure that internal copies of expat and libffi are not used. + # TODO: Makefile has annoying deps on expat headers + #rm -r Modules/expat || die + + local PATCHES=( + "${WORKDIR}/${PATCHSET}" + ) + + default + + # force the correct number of jobs + # https://bugs.gentoo.org/737660 + sed -i -e "s:-j0:-j$(makeopts_jobs):" Makefile.pre.in || die + + eautoreconf +} + +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 _crypt + 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() { + local disable + # disable automagic bluetooth headers detection + if ! use bluetooth; then + local -x ac_cv_header_bluetooth_bluetooth_h=no + fi + + append-flags -fwrapv + filter-flags -malign-double + + # https://bugs.gentoo.org/700012 + if is-flagq -flto || is-flagq '-flto=*'; then + append-cflags $(test-flags-CC -ffat-lto-objects) + fi + + # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. + # PKG_CONFIG needed for cross. + tc-export CXX PKG_CONFIG + + local dbmliborder= + if use gdbm; then + dbmliborder+="${dbmliborder:+:}gdbm" + fi + + if use pgo; then + local profile_task_flags=( + -m test + "-j$(makeopts_jobs)" + --pgo-extended + -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 + + -x test_gdb + -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 + local -x PROFILE_TASK="${profile_task_flags[*]}" + fi + + local myeconfargs=( + # glibc-2.30 removes it; since we can't cleanly force-rebuild + # Python on glibc upgrade, remove it proactively to give + # a chance for users rebuilding python before glibc + ac_cv_header_stropts_h=no + + --enable-shared + --without-static-libpython + --enable-ipv6 + --infodir='${prefix}/share/info' + --mandir='${prefix}/share/man' + --with-computed-gotos + --with-dbmliborder="${dbmliborder}" + --with-libc= + --enable-loadable-sqlite-extensions + --without-ensurepip + --with-system-expat + --with-platlibdir=lib + --with-pkg-config=yes + --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip + + $(use_with debug assertions) + $(use_with lto) + $(use_enable pgo optimizations) + $(use_with readline readline "$(usex libedit editline readline)") + $(use_with valgrind) + ) + # 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} + + if use pgo ; then + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + + addpredict "/usr/lib/python${PYVER}/site-packages" + fi + + # also need to clear the flags explicitly here or they end up + # in _sysconfigdata* + emake CPPFLAGS= CFLAGS= LDFLAGS= + + # Restore saved value from above. + local -x PYTHONDONTWRITEBYTECODE=${_PYTHONDONTWRITEBYTECODE} + + # Work around bug 329499. See also bug 413751 and 457194. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E python + else + pax-mark m python + fi +} + +src_test() { + # Tests will not work when cross compiling. + if tc-is-cross-compiler; then + elog "Disabling tests due to crosscompiling." + return + fi + + # this just happens to skip test_support.test_freeze that is broken + # without bundled expat + # TODO: get a proper skip for it upstream + local -x LOGNAME=buildbot + + local test_opts=( + -u-network + -j "$(makeopts_jobs)" + + # fails + -x test_gdb + ) + + if use sparc ; then + # bug #788022 + test_opts+=( + -x test_multiprocessing_fork + -x test_multiprocessing_forkserver + ) + fi + + # workaround docutils breaking tests + cat > Lib/docutils.py <<-EOF || die + raise ImportError("Thou shalt not import!") + EOF + + # bug 660358 + local -x COLUMNS=80 + local -x PYTHONDONTWRITEBYTECODE= + # workaround https://bugs.gentoo.org/775416 + addwrite "/usr/lib/python${PYVER}/site-packages" + + nonfatal emake test EXTRATESTOPTS="${test_opts[*]}" \ + CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty + local ret=${?} + + rm Lib/docutils.py || die + + [[ ${ret} -eq 0 ]] || die "emake test failed" +} + +src_install() { + local libdir=${ED}/usr/lib/python${PYVER} + + # the Makefile rules are broken + # https://github.com/python/cpython/issues/100221 + mkdir -p "${libdir}"/lib-dynload || die + + # -j1 hack for now for bug #843458 + emake -j1 DESTDIR="${D}" altinstall + + # Fix collisions between different slots of Python. + rm "${ED}/usr/$(get_libdir)/libpython3.so" || die + + # Cheap hack to get version with ABIFLAGS + local abiver=$(cd "${ED}/usr/include"; echo python*) + if [[ ${abiver} != python${PYVER} ]]; then + # Replace python3.X with a symlink to python3.Xm + rm "${ED}/usr/bin/python${PYVER}" || die + dosym "${abiver}" "/usr/bin/python${PYVER}" + # Create python3.X-config symlink + dosym "${abiver}-config" "/usr/bin/python${PYVER}-config" + # Create python-3.5m.pc symlink + dosym "python-${PYVER}.pc" "/usr/$(get_libdir)/pkgconfig/${abiver/${PYVER}/-${PYVER}}.pc" + fi + + # python seems to get rebuilt in src_install (bug 569908) + # Work around it for now. + if has_version dev-libs/libffi[pax-kernel]; then + pax-mark E "${ED}/usr/bin/${abiver}" + else + pax-mark m "${ED}/usr/bin/${abiver}" + fi + + rm -r "${libdir}"/ensurepip/_bundled || die + if ! use ensurepip; then + rm -r "${libdir}"/ensurepip || die + fi + if ! use sqlite; then + rm -r "${libdir}/"sqlite3 || die + fi + if ! use tk; then + rm -r "${ED}/usr/bin/idle${PYVER}" || die + rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die + fi + + ln -s ../python/EXTERNALLY-MANAGED "${libdir}/EXTERNALLY-MANAGED" || die + + dodoc Misc/{ACKS,HISTORY,NEWS} + + if use examples; then + docinto examples + find Tools -name __pycache__ -exec rm -fr {} + || die + dodoc -r Tools + fi + insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510 + local libname=$( + printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' | + emake --no-print-directory -s -f - 2>/dev/null + ) + newins Tools/gdb/libpython.py "${libname}"-gdb.py + + newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER} + newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER} + sed \ + -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \ + -e "s:@PYDOC@:pydoc${PYVER}:" \ + -i "${ED}/etc/conf.d/pydoc-${PYVER}" \ + "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed" + + # python-exec wrapping support + local pymajor=${PYVER%.*} + local EPYTHON=python${PYVER} + local scriptdir=${D}$(python_get_scriptdir) + mkdir -p "${scriptdir}" || die + # python and pythonX + ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die + ln -s "python${pymajor}" "${scriptdir}/python" || die + # python-config and pythonX-config + # note: we need to create a wrapper rather than symlinking it due + # to some random dirname(argv[0]) magic performed by python-config + cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die + #!/bin/sh + exec "${abiver}-config" "\${@}" + EOF + chmod +x "${scriptdir}/python${pymajor}-config" || die + ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die + # 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() { + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3.11.0_beta4-r2; then + ewarn "Python 3.11.0b4 has changed its module ABI. The .pyc files" + ewarn "installed previously are no longer valid and will be regenerated" + ewarn "(or ignored) on the next import. This may cause sandbox failures" + ewarn "when installing some packages and checksum mismatches when removing" + ewarn "old versions. To actively prevent this, rebuild all packages" + ewarn "installing Python 3.11 modules, e.g. using:" + ewarn + ewarn " emerge -1v /usr/lib/python3.11/site-packages" + fi + done +} -- cgit v1.2.3