• [gentoo-dev] [PATCH 3/7] distutils-r1.eclass: Add a QA warning for pure

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed May 15 21:00:01 2024
    If the package is creating at least one pure Python wheel, check whether
    the baseline package contents (i.e. everything but compiled Python
    modules, extensions and .dist-info) match between implementations.
    This is meant to ensure that we can safely optimize builds by reusing
    pure Python wheels from previous builds.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 89223b248157..f014a184885a 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -2021,6 +2021,44 @@ distutils-r1_src_configure() {
    return ${ret}
    }

    +# @FUNCTION: _distutils-r1_compare_installed_files
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Verify the the match between files installed between this and previous
    +# implementation.
    +_distutils-r1_compare_installed_files() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + # QA check requires diff(1).
    + if ! type -P diff &>/dev/null; then
    + return
    + fi
    +
    + # Perform the check only if at least one potentially reusable wheel
    + # has been produced. Nonpure packages (e.g. NumPy) may install
    + # interpreter configuration details into sitedir.
    + if [[ ${DISTUTILS_WHEELS[*]} != *-none-any.whl* &&
    + ${DISTUTILS_WHEELS[*]} != *-abi3-*.whl ]];