• [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: Fix pyvenv correctly for

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sat May 10 15:00:01 2025
    Python 3.14 cleaned up the venv logic, and we have been apparently
    relying on some hacks that worked by accident. More specifically:

    1. pyvenv.cfg location is used explicitly as sys.prefix, so we can
    no longer put it inside bin/ subdirectory (no clue why we did that
    -- probably a long chain of historical reasons).

    2. "home =" must always be present for venv detection to work.

    With these changes, Python 3.14 seems now able to correctly detect
    the venv and set prefixes accordingly. Since they improve correctness,
    they should also be fine for other Python versions.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 10 ++++++----
    1 file changed, 6 insertions(+), 4 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index cced2b8ffef7..d32e5929177e 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1662,7 +1662,7 @@ distutils-r1_python_install() {
    # let's explicitly verify these assumptions

    # remove files that we've created explicitly
    - rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,pyvenv.cfg} || die
    + rm "${reg_scriptdir}"/{"${EPYTHON}",python3,python,../pyvenv.cfg} || die

    # Automagically do the QA check to avoid issues when bootstrapping
    # prefix.
    @@ -2030,9 +2030,11 @@ _distutils-r1_post_python_compile() {
    ln -s "${PYTHON}" "${bindir}/${EPYTHON}" || die
    ln -s "${EPYTHON}" "${bindir}/python3" || die
    ln -s "${EPYTHON}" "${bindir}/python" || die
    - # python3.14t seems to require "home" being present
    - # (though it does not seem to care about the actual value)
    - cat > "${bindir}