commit:     8e937320a08850523d59d11dfa9d7c38e16ab6f8
Author:     orbea <orbea <AT> riseup <DOT> net>
AuthorDate: Fri Aug 26 14:28:20 2022 +0000
Commit:     Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
CommitDate: Fri Aug 26 20:58:40 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=8e937320

dev-lang/python: Add 3.9.13_p4 + 3.10.6_p2

Signed-off-by: orbea <orbea <AT> riseup.net>
Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>

 dev-lang/python/Manifest                |   4 +
 dev-lang/python/python-3.10.6_p2.ebuild | 409 ++++++++++++++++++++++++++++++++
 dev-lang/python/python-3.9.13_p4.ebuild | 405 +++++++++++++++++++++++++++++++
 3 files changed, 818 insertions(+)

diff --git a/dev-lang/python/Manifest b/dev-lang/python/Manifest
index fd2e44d..b5bb2ab 100644
--- a/dev-lang/python/Manifest
+++ b/dev-lang/python/Manifest
@@ -2,11 +2,15 @@ DIST Python-3.10.4.tar.xz 19342692 BLAKE2B 
c430ad9bed71729fda29433af0614b6c0110a
 DIST Python-3.10.4.tar.xz.asc 833 BLAKE2B 
289f2e96bfc2b60c4ae94b1591779d604f203890c4f5db2ee16e305bf03c6ddb9c8d6da4471a06b5943e12888f37ca572ea30876e9a80382a26814f66b41b7bf
 SHA512 
699e37bf09067083af159e3734b38c952bdc75432c8abfb7a7b8cce7ca975038da37490abeb5c13befd2dacb84a5341ad30de5d0a63d35af5c512215744f4d6d
 DIST Python-3.10.5.tar.xz 19361320 BLAKE2B 
7f3629f8a16faeb0311947b7d5162bc45d9ed6b2c051f776027d01ebbbdd42e4849efd67921fa57975f68ec67dc34f3135345ce216f2d3f02bfcfa4245d266f1
 SHA512 
aa7f58a9b31de9824185b3e7bfa7da0dcf64ae9e89840664eae9d98d9048a650fa012cd5b873a62ff44b65b856db86f095c4003117406ec5e9583ec5f7e78e90
 DIST Python-3.10.5.tar.xz.asc 833 BLAKE2B 
36da2d557a5c38cfc473b2138412f9bc011d19c8538475e623bf41d81eb2c8f8e977945a3065a48c5b234d2b2c7d0dd5e83112c948591628cec344651dc9055c
 SHA512 
72d0ab09900e2a10b85ccac804efd5536251152798e7347576e0e28bff4ab4a84b08d646329b225f9949047586686f9f4e7f05652526657a0948951b739c14e0
+DIST Python-3.10.6.tar.xz 19600672 BLAKE2B 
b21398f68e13cf8464077aa2c7f08d9044198cc3d2e2829d12239d420c1c922cbad8427f3e0fae3fe62a4b8ebb7db7eff441266eff82f0c78d7a98a62d8e64c3
 SHA512 
f2bf424bf4f4caa524ee1248b431e8e06d0745c3fc3ba457710d75f3698e653733feb4b059cd124f1de2a9e851c30d847f567aa47abef12898c9dc8a6507b476
+DIST Python-3.10.6.tar.xz.asc 833 BLAKE2B 
ea6546c01a4fbfe3f3e56b2f980da53f0692d9c638534bd25fb96a0f657424f979b6a82a01c77c05ddfded30441b4a0348cc407d5b29290ffc653a508ca32ec8
 SHA512 
9288e2f62f2e8c8208ad176372261545a64e675d737bb616403bcd888bc91177909257632e4cc0b5d688d612bea38a274030ec6989dc7d56c03064e32ad9903e
 DIST Python-3.9.12.tar.xz 19740524 BLAKE2B 
05f2469aa53ca36221ef4976b17bfde3e5b86afd5a8114e5a7fd899f975a8e55022555ef718d5352ab68de1b7b23865a0bf713768c9c2b30d591438c9a396d25
 SHA512 
081981901e14149748fd35228db0b3b1d96fef227ae7404f07b8bad0fda4b02649bf31c348c94aefdaf3327565d78f9489437c2c02f647b15d41376a27a23e97
 DIST Python-3.9.12.tar.xz.asc 833 BLAKE2B 
33436d0404a643215a8fd2b967ffd216201da24f374941bf65b888159ccfabcbe79b751eca2dd489b06605604338c8bbaab74aa10abbe4bcffaa54236301228e
 SHA512 
dddaa27f8a29034f458edb6739398a5455c87fe37b6349e161865a9deedca118ffe9cb82663cc75bbe60b3b556399c0c6855f5262aac1fe90d36a3694fca65b2
 DIST Python-3.9.13.tar.xz 19754368 BLAKE2B 
4f583f66c28b791e19cd6d79695fe9eb815fd333542be22aec8bd73d1f4d3f17f2c4e9de198e7b16c1ca6362a613a8a02fb965c7dc7db3e510fd31de15ba2d19
 SHA512 
e9664e7f908092df11236b22465d217531d6f0378e88d889108d19fe77f28f46ffb629b8733f84b41409e255367321893a2b1bd64518930d9d8cae5d1b774d23
 DIST Python-3.9.13.tar.xz.asc 833 BLAKE2B 
db01c01be9d56cd15f9ab4a9e2cfa800faf4ebecb92b01c133865d3b3134bc910258a33b766306c3d01f98e35bbf9c03c7cba697760b7095999cbd63ed6c276c
 SHA512 
9367afe8ec32195adbb64fa32eb9e3881cfdbbb38efcb5e0804a15486232aecbc81ed20a8ffed652f06a881744f3efd2c2df3cc652d70671c94d6668a17a391e
 DIST python-gentoo-patches-3.10.4.tar.xz 8592 BLAKE2B 
67fba3e1fedb17430e5cd93da995b4acaf714db512031b5a2f775a25f793f007941561663cfa413d645ccddc2e22d65d250a40fa166cafda8805488d877ff57d
 SHA512 
3ed2b8ff8f1eb8febe7dcd4b5d13d6d54468be1d525f8f1118977d3bbc78f690a597b09383939d023b03380a306e4bff1693382e29ff562312d803305b1709b2
 DIST python-gentoo-patches-3.10.5.tar.xz 8584 BLAKE2B 
d4a812a33e485b1eae5629e519dca4dc6625b743b07c7f7bbc62562f345d87723ba499893702310b1e96e443d2946e27a8d4971f32ca1125d4827d0d594ccaa6
 SHA512 
77f0478f7d0491e103857a83a97d6e04a9ec68740a7f9357cbbdd316462e7d98ea8236bd05a30e7556457ece5fbcfa4a7a78a25d4eb12779455ce2bb5b6f30d0
+DIST python-gentoo-patches-3.10.6_p2.tar.xz 12040 BLAKE2B 
75c93fab19137a966b3775308bc20142f4d3648bbb9364e82c4eaffae93beda54011192881c52b85d2e2493a06cfe2a90f50675609908c3d5ebdb0103fe41644
 SHA512 
7e451a8a18a62592c2cd7b2db71065b77256960f43e172a0d7856b22b69138dcb1552f53b39bec14585a761cfe729c81613551c1b616fe1ec8d2b59856b11453
 DIST python-gentoo-patches-3.9.12.tar.xz 12848 BLAKE2B 
5dd66fa94b136a463d2c4be3a5b7dfad770c3905467a1d81af02a35b2783ce7d614881c915ee8f8e764c1656963d6886d9c60c6e524f512e1bc496e42d01307b
 SHA512 
07de63e47a8e547724099062239df8fcfd254f19d38be28131e6bbb094ffbab8483861fb6a5905e60d7fa7a1a5dc06785951fa31984ecad89516b0b742c47f91
 DIST python-gentoo-patches-3.9.13.tar.xz 12836 BLAKE2B 
ba687a3d6e00baf4d9640ab78a29c3e21bf1872b5019198991521cf37bb0780f592db742ee4fdfe6bfb1cab1c1f6587889dfdb024cae72766b6c83c2ffe319be
 SHA512 
e393992ff92625771c6ffeb500637862f0163c689c685fd245a6e5bbdd3128154ce439ecab56eaf1359e67ea0d173dfb19f65a4098ea2266922bfb43aba517dc
+DIST python-gentoo-patches-3.9.13_p4.tar.xz 22072 BLAKE2B 
a0e084eff35d075d2255b139d0db114d282cb6c9c0c2ea51a8ecb7f5f1dc8096d6578ae5f804b7583a2b7842152b5723ad802ca816d46813c40aaa756118afc8
 SHA512 
cdf8d43fd5263c4956be234f36c0767215ab2495705d4f2a060b32ecbfbe159e618e31693b0538a1b970f7b27ebe4953063f585930d074dcaf59f2f61486e6b6

diff --git a/dev-lang/python/python-3.10.6_p2.ebuild 
b/dev-lang/python/python-3.10.6_p2.ebuild
new file mode 100644
index 0000000..163d9a7
--- /dev/null
+++ b/dev-lang/python/python-3.10.6_p2.ebuild
@@ -0,0 +1,409 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+WANT_LIBTOOL="none"
+
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
+inherit python-utils-r1 toolchain-funcs verify-sig
+
+MY_PV=${PV/_rc/rc}
+MY_P="Python-${MY_PV%_p*}"
+PYVER=$(ver_cut 1-2)
+PATCHSET="python-gentoo-patches-${MY_PV}"
+
+DESCRIPTION="An interpreted, interactive, object-oriented programming language"
+HOMEPAGE="
+       https://www.python.org/
+       https://github.com/python/cpython/
+"
+SRC_URI="
+       https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
+       https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
+       verify-sig? (
+               https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
+       )
+"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="PSF-2"
+SLOT="${PYVER}"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 
~riscv ~s390 sparc x86"
+IUSE="
+       bluetooth build +ensurepip examples gdbm hardened libedit lto
+       +ncurses pgo +readline +sqlite +ssl test tk +xml
+"
+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:=
+       dev-lang/python-exec[python_targets_python3_10(-)]
+       dev-libs/libffi:=
+       sys-apps/util-linux:=
+       >=sys-libs/zlib-1.1.3:=
+       virtual/libcrypt:=
+       virtual/libintl
+       ensurepip? ( dev-python/ensurepip-wheels )
+       gdbm? ( sys-libs/gdbm:=[berkdb] )
+       ncurses? ( >=sys-libs/ncurses-5.2:= )
+       readline? (
+               !libedit? ( >=sys-libs/readline-4.1:= )
+               libedit? ( dev-libs/libedit:= )
+       )
+       sqlite? ( >=dev-db/sqlite-3.3.8:3= )
+       ssl? ( >=dev-libs/openssl-1.1.1:= )
+       tk? (
+               >=dev-lang/tcl-8.0:=
+               >=dev-lang/tk-8.0:=
+               dev-tcltk/blt:=
+               dev-tcltk/tix
+       )
+       xml? ( >=dev-libs/expat-2.1:= )
+       !!<sys-apps/sandbox-2.21
+"
+# bluetooth requires headers from bluez
+DEPEND="
+       ${RDEPEND}
+       bluetooth? ( net-wireless/bluez )
+       test? ( app-arch/xz-utils[extra-filters(+)] )
+"
+# autoconf-archive needed to eautoreconf
+BDEPEND="
+       sys-devel/autoconf-archive
+       virtual/awk
+       virtual/pkgconfig
+       verify-sig? ( sec-keys/openpgp-keys-python )
+       !sys-devel/gcc[libffi(-)]
+"
+RDEPEND+="
+       !build? ( app-misc/mime-types )
+"
+
+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}
+
+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.
+       rm -r Modules/expat || die
+       rm -r Modules/_ctypes/libffi* || die
+
+       local PATCHES=(
+               "${WORKDIR}/${PATCHSET}"
+               "${FILESDIR}"/${PN}-3.10.3-libressl.patch
+       )
+
+       default
+
+       # https://bugs.gentoo.org/850151
+       sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
+
+       # force the correct number of jobs
+       # https://bugs.gentoo.org/737660
+       local jobs=$(makeopts_jobs)
+       sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
+       sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
+
+       eautoreconf
+}
+
+src_configure() {
+       # disable automagic bluetooth headers detection
+       if ! use bluetooth; then
+               local -x ac_cv_header_bluetooth_bluetooth_h=no
+       fi
+       local disable
+       use gdbm      || disable+=" gdbm"
+       use ncurses   || disable+=" _curses _curses_panel"
+       use readline  || disable+=" readline"
+       use sqlite    || disable+=" _sqlite3"
+       use ssl       || export PYTHON_DISABLE_SSL="1"
+       use tk        || disable+=" _tkinter"
+       use xml       || disable+=" _elementtree pyexpat" # _elementtree uses 
pyexpat.
+       export PYTHON_DISABLE_MODULES="${disable}"
+
+       if ! use xml; then
+               ewarn "You have configured Python without XML support."
+               ewarn "This is NOT a recommended configuration as you"
+               ewarn "may face problems parsing any XML documents."
+       fi
+
+       if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
+               einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
+       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
+
+       # Fix implicit declarations on cross and prefix builds. Bug #674070.
+       if use ncurses; then
+               append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
+       fi
+
+       local dbmliborder=
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+
+       if use pgo; then
+               local profile_task_flags=(
+                       -m test
+                       "-j$(makeopts_jobs)"
+                       --pgo-extended
+                       -x test_gdb
+                       -u-network
+
+                       # All of these seem to occasionally hang for PGO 
inconsistently
+                       # They'll even hang here but be fine in src_test 
sometimes.
+                       # bug #828535 (and related: bug #788022)
+                       -x test_asyncio
+                       -x test_httpservers
+                       -x test_logging
+                       -x test_multiprocessing_fork
+                       -x test_socket
+                       -x test_xmlrpc
+               )
+
+               if has_version "app-arch/rpm" ; then
+                       # Avoid sandbox failure (attempts to write to 
/var/lib/rpm)
+                       profile_task_flags+=(
+                               -x test_distutils
+                       )
+               fi
+               local -x PROFILE_TASK="${profile_task_flags[*]}"
+       fi
+
+       local myeconfargs=(
+               # glibc-2.30 removes it; since we can't cleanly force-rebuild
+               # Python on glibc upgrade, remove it proactively to give
+               # a chance for users rebuilding python before glibc
+               ac_cv_header_stropts_h=no
+
+               --enable-shared
+               --without-static-libpython
+               --enable-ipv6
+               --infodir='${prefix}/share/info'
+               --mandir='${prefix}/share/man'
+               --with-computed-gotos
+               --with-dbmliborder="${dbmliborder}"
+               --with-libc=
+               --enable-loadable-sqlite-extensions
+               --without-ensurepip
+               --with-system-expat
+               --with-system-ffi
+               --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
+
+               $(use_with lto)
+               $(use_enable pgo optimizations)
+               $(use_with readline readline "$(usex libedit editline 
readline)")
+       )
+
+       # disable implicit optimization/debugging flags
+       local -x OPT=
+       # 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=
+
+       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
+       # Prevent using distutils bundled by setuptools.
+       # https://bugs.gentoo.org/823728
+       export SETUPTOOLS_USE_DISTUTILS=stdlib
+
+       # 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/python3.10/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
+
+       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
+
+       # bug 660358
+       local -x COLUMNS=80
+       local -x PYTHONDONTWRITEBYTECODE=
+       # workaround https://bugs.gentoo.org/775416
+       addwrite /usr/lib/python3.10/site-packages
+
+       emake test EXTRATESTOPTS="${test_opts[*]}" \
+               CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed"
+}
+
+src_install() {
+       local libdir=${ED}/usr/lib/python${PYVER}
+
+       emake 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,test/test_sqlite*} || die
+       fi
+       if ! use tk; then
+               rm -r "${ED}/usr/bin/idle${PYVER}" || die
+               rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
+       fi
+
+       dodoc Misc/{ACKS,HISTORY,NEWS}
+
+       if use examples; then
+               docinto examples
+               find Tools -name __pycache__ -exec rm -fr {} + || die
+               dodoc -r Tools
+       fi
+       insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
+       local libname=$(
+               printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
+               emake --no-print-directory -s -f - 2>/dev/null
+       )
+       newins Tools/gdb/libpython.py "${libname}"-gdb.py
+
+       newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
+       newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
+       sed \
+               -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
+               -e "s:@PYDOC@:pydoc${PYVER}:" \
+               -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
+               "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
+
+       # python-exec wrapping support
+       local pymajor=${PYVER%.*}
+       local EPYTHON=python${PYVER}
+       local scriptdir=${D}$(python_get_scriptdir)
+       mkdir -p "${scriptdir}" || die
+       # python and pythonX
+       ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
+       ln -s "python${pymajor}" "${scriptdir}/python" || die
+       # python-config and pythonX-config
+       # note: we need to create a wrapper rather than symlinking it due
+       # to some random dirname(argv[0]) magic performed by python-config
+       cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
+               #!/bin/sh
+               exec "${abiver}-config" "\${@}"
+       EOF
+       chmod +x "${scriptdir}/python${pymajor}-config" || die
+       ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
+       # 2to3, pydoc
+       ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
+       ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
+       # idle
+       if use tk; then
+               ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
+       fi
+}

diff --git a/dev-lang/python/python-3.9.13_p4.ebuild 
b/dev-lang/python/python-3.9.13_p4.ebuild
new file mode 100644
index 0000000..54c6114
--- /dev/null
+++ b/dev-lang/python/python-3.9.13_p4.ebuild
@@ -0,0 +1,405 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="7"
+WANT_LIBTOOL="none"
+
+inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
+inherit python-utils-r1 toolchain-funcs verify-sig
+
+MY_PV=${PV/_rc/rc}
+MY_P="Python-${MY_PV%_p*}"
+PYVER=$(ver_cut 1-2)
+PATCHSET="python-gentoo-patches-${MY_PV}"
+
+DESCRIPTION="An interpreted, interactive, object-oriented programming language"
+HOMEPAGE="
+       https://www.python.org/
+       https://github.com/python/cpython/
+"
+SRC_URI="
+       https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz
+       https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
+       verify-sig? (
+               https://www.python.org/ftp/python/${PV%%_*}/${MY_P}.tar.xz.asc
+       )
+"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="PSF-2"
+SLOT="${PYVER}"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 
~riscv ~s390 sparc x86"
+IUSE="
+       bluetooth build +ensurepip examples gdbm hardened lto +ncurses pgo
+       +readline +sqlite +ssl test tk +xml
+"
+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:=
+       dev-lang/python-exec[python_targets_python3_9(-)]
+       dev-libs/libffi:=
+       sys-apps/util-linux:=
+       >=sys-libs/zlib-1.1.3:=
+       virtual/libcrypt:=
+       virtual/libintl
+       ensurepip? ( dev-python/ensurepip-wheels )
+       gdbm? ( sys-libs/gdbm:=[berkdb] )
+       ncurses? ( >=sys-libs/ncurses-5.2:= )
+       readline? ( >=sys-libs/readline-4.1:= )
+       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
+       )
+       xml? ( >=dev-libs/expat-2.1:= )
+"
+# bluetooth requires headers from bluez
+DEPEND="
+       ${RDEPEND}
+       bluetooth? ( net-wireless/bluez )
+       test? ( app-arch/xz-utils[extra-filters(+)] )
+"
+# autoconf-archive needed to eautoreconf
+BDEPEND="
+       sys-devel/autoconf-archive
+       virtual/awk
+       virtual/pkgconfig
+       verify-sig? ( sec-keys/openpgp-keys-python )
+       !sys-devel/gcc[libffi(-)]
+"
+RDEPEND+="
+       !build? ( app-misc/mime-types )
+"
+
+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}
+
+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.
+       rm -r Modules/expat || die
+       rm -r Modules/_ctypes/libffi* || die
+       rm -f 
"${WORKDIR}/${PATCHSET}"/0013-bpo-43998-Default-to-TLS-1.2-and-increase-cipher-sui.patch
 || die
+
+       local PATCHES=(
+               "${WORKDIR}/${PATCHSET}"
+               "${FILESDIR}"/${PN}-3.9.9-r1-libressl.patch
+       )
+
+       default
+
+       # https://bugs.gentoo.org/850151
+       sed -i -e "s:@@GENTOO_LIBDIR@@:$(get_libdir):g" setup.py || die
+
+       # force the correct number of jobs
+       # https://bugs.gentoo.org/737660
+       local jobs=$(makeopts_jobs)
+       sed -i -e "s:-j0:-j${jobs}:" Makefile.pre.in || die
+       sed -i -e "/self\.parallel/s:True:${jobs}:" setup.py || die
+
+       eautoreconf
+}
+
+src_configure() {
+       # disable automagic bluetooth headers detection
+       if ! use bluetooth; then
+               local -x ac_cv_header_bluetooth_bluetooth_h=no
+       fi
+       local disable
+       use gdbm      || disable+=" gdbm"
+       use ncurses   || disable+=" _curses _curses_panel"
+       use readline  || disable+=" readline"
+       use sqlite    || disable+=" _sqlite3"
+       use ssl       || export PYTHON_DISABLE_SSL="1"
+       use tk        || disable+=" _tkinter"
+       use xml       || disable+=" _elementtree pyexpat" # _elementtree uses 
pyexpat.
+       export PYTHON_DISABLE_MODULES="${disable}"
+
+       if ! use xml; then
+               ewarn "You have configured Python without XML support."
+               ewarn "This is NOT a recommended configuration as you"
+               ewarn "may face problems parsing any XML documents."
+       fi
+
+       if [[ -n "${PYTHON_DISABLE_MODULES}" ]]; then
+               einfo "Disabled modules: ${PYTHON_DISABLE_MODULES}"
+       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
+
+       # Fix implicit declarations on cross and prefix builds. Bug #674070.
+       if use ncurses; then
+               append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw
+       fi
+
+       local dbmliborder=
+       if use gdbm; then
+               dbmliborder+="${dbmliborder:+:}gdbm"
+       fi
+
+       if use pgo; then
+               local profile_task_flags=(
+                       -m test
+                       "-j$(makeopts_jobs)"
+                       --pgo-extended
+                       -x test_gdb
+                       -u-network
+
+                       # All of these seem to occasionally hang for PGO 
inconsistently
+                       # They'll even hang here but be fine in src_test 
sometimes.
+                       # bug #828535 (and related: bug #788022)
+                       -x test_asyncio
+                       -x test_httpservers
+                       -x test_logging
+                       -x test_multiprocessing_fork
+                       -x test_socket
+                       -x test_xmlrpc
+               )
+
+               if has_version "app-arch/rpm" ; then
+                       # Avoid sandbox failure (attempts to write to 
/var/lib/rpm)
+                       profile_task_flags+=(
+                               -x test_distutils
+                       )
+               fi
+               local -x PROFILE_TASK="${profile_task_flags[*]}"
+       fi
+
+       local myeconfargs=(
+               # glibc-2.30 removes it; since we can't cleanly force-rebuild
+               # Python on glibc upgrade, remove it proactively to give
+               # a chance for users rebuilding python before glibc
+               ac_cv_header_stropts_h=no
+
+               --enable-shared
+               --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-system-ffi
+               --with-wheel-pkg-dir="${EPREFIX}"/usr/lib/python/ensurepip
+
+               $(use_with lto)
+               $(use_enable pgo optimizations)
+       )
+
+       # disable implicit optimization/debugging flags
+       local -x OPT=
+       # 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=
+
+       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
+       # Prevent using distutils bundled by setuptools.
+       # https://bugs.gentoo.org/823728
+       export SETUPTOOLS_USE_DISTUTILS=stdlib
+
+       # 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/python3.9/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
+
+       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
+
+       # bug 660358
+       local -x COLUMNS=80
+       local -x PYTHONDONTWRITEBYTECODE=
+
+       emake test EXTRATESTOPTS="${test_opts[*]}" \
+               CPPFLAGS= CFLAGS= LDFLAGS= < /dev/tty || die "emake test failed"
+}
+
+src_install() {
+       local libdir=${ED}/usr/lib/python${PYVER}
+
+       emake DESTDIR="${D}" altinstall
+
+       # Remove static library
+       rm "${ED}"/usr/$(get_libdir)/libpython*.a || die
+
+       # 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,test/test_sqlite*} || die
+       fi
+       if ! use tk; then
+               rm -r "${ED}/usr/bin/idle${PYVER}" || die
+               rm -r "${libdir}/"{idlelib,tkinter,test/test_tk*} || die
+       fi
+
+       dodoc Misc/{ACKS,HISTORY,NEWS}
+
+       if use examples; then
+               docinto examples
+               find Tools -name __pycache__ -exec rm -fr {} + || die
+               dodoc -r Tools
+       fi
+       insinto /usr/share/gdb/auto-load/usr/$(get_libdir) #443510
+       local libname=$(
+               printf 'e:\n\t@echo $(INSTSONAME)\ninclude Makefile\n' |
+               emake --no-print-directory -s -f - 2>/dev/null
+       )
+       newins Tools/gdb/libpython.py "${libname}"-gdb.py
+
+       newconfd "${FILESDIR}/pydoc.conf" pydoc-${PYVER}
+       newinitd "${FILESDIR}/pydoc.init" pydoc-${PYVER}
+       sed \
+               -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${PYVER/./_}_PORT:" \
+               -e "s:@PYDOC@:pydoc${PYVER}:" \
+               -i "${ED}/etc/conf.d/pydoc-${PYVER}" \
+               "${ED}/etc/init.d/pydoc-${PYVER}" || die "sed failed"
+
+       # python-exec wrapping support
+       local pymajor=${PYVER%.*}
+       local EPYTHON=python${PYVER}
+       local scriptdir=${D}$(python_get_scriptdir)
+       mkdir -p "${scriptdir}" || die
+       # python and pythonX
+       ln -s "../../../bin/${abiver}" "${scriptdir}/python${pymajor}" || die
+       ln -s "python${pymajor}" "${scriptdir}/python" || die
+       # python-config and pythonX-config
+       # note: we need to create a wrapper rather than symlinking it due
+       # to some random dirname(argv[0]) magic performed by python-config
+       cat > "${scriptdir}/python${pymajor}-config" <<-EOF || die
+               #!/bin/sh
+               exec "${abiver}-config" "\${@}"
+       EOF
+       chmod +x "${scriptdir}/python${pymajor}-config" || die
+       ln -s "python${pymajor}-config" "${scriptdir}/python-config" || die
+       # 2to3, pydoc
+       ln -s "../../../bin/2to3-${PYVER}" "${scriptdir}/2to3" || die
+       ln -s "../../../bin/pydoc${PYVER}" "${scriptdir}/pydoc" || die
+       # idle
+       if use tk; then
+               ln -s "../../../bin/idle${PYVER}" "${scriptdir}/idle" || die
+       fi
+}

Reply via email to