• [gentoo-dev] [PATCH] python-utils-r1.eclass: Check for occluded package

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sat Aug 5 14:40:02 2023
    Add a check for installed packages being occluded by the working
    directory when calling epytest and eunittest. This is primarily meant
    to detect C extensions being missed.

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 2555ce12d066..27157a003ab2 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1231,6 +1231,55 @@ _python_check_EPYTHON() {
    fi
    }

    +# @FUNCTION: _python_check_occluded_packages
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Check if the current directory does not contain any incomplete
    +# package sources that would block installed packages from being used
    +# (and effectively e.g. make it impossible to load compiled extensions). +_python_check_occluded_packages() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + # DO NOT ENABLE THIS unless you're going to check for false
    + # positives before filing bugs.
    + [[ ! ${PYTHON_EXPERIMENTAL_QA} ]] && return
    +
    + type -P diff &>/dev/null || return
    + [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return
    +
    + local sitedir="${BUILD_D
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to All on Sat Aug 5 17:20:02 2023
    On Sat, 2023-08-05 at 14:39 +0200, Michał Górny wrote:
    Add a check for installed packages being occluded by the working
    directory when calling epytest and eunittest. This is primarily meant
    to detect C extensions being missed.

    By the way, I've finally figured out which package was when I've noticed
    the problem for this first time. It is dev-python/ijson -- if you
    remove the 'rm -rf' from test phase, you'd notice that a bunch of tests
    are being skipped because of missing C extension -- but that's easy to
    miss. With this patch, you get a more verbose QA warning.

    That said, I have no clue if we won't see many false positives,
    and that's why it's covered by a condition so that only people from
    Python team would enable it until we know better.

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)