• [gentoo-dev] [PATCH 4/7] distutils-r1.eclass: Support reusing prior whe

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed May 15 21:00:01 2024
    Support reusing the wheels built for earlier Python implementations
    if they are compatible with the subsequent implementations being built.
    This includes pure Python wheels in packages that do not set
    DISTUTILS_EXT, and stable ABI wheels.

    Closes: https://bugs.gentoo.org/931689
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 33 +++++++++++++++++++++++++++++++++
    1 file changed, 33 insertions(+)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index f014a184885a..e4d53083124e 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -189,6 +189,18 @@ esac
    # ${DISTUTILS_DEPS}"
    # @CODE

    +# @ECLASS_VARIABLE: DISTUTILS_ALLOW_WHEEL_REUSE
    +# @DEFAULT_UNSET
    +# @USER_VARIABLE
    +# @DESCRIPTION:
    +# If set to a non-empty value, the eclass is allowed to reuse a wheel
    +# that was built for a prior Python implementation, provided that it is
    +# compatible with the current one, rather than building a new one.
    +#
    +# This is an optimization that can avoid the overhead of calling into
    +# the build system in pure Python packages and packages using the stable
    +# Python ABI.
    +
    if [[ -z ${_DISTUTILS_R1_ECLASS} ]]; then
    _DISTUTILS_R1_ECLASS=1

    @@ -1584,6 +1596,27 @@ distutils-r1_python_compile() {
    esac

    if [[ ${DISTUTILS_USE_PEP517} ]]; then