• [gentoo-dev] [PATCH v2 1/3] python-utils-r1.eclass: Add a verbose pytho

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Thu Feb 10 15:50:01 2022
    Add a python_has_version() wrapper for convenient use
    in python_check_deps(). It includes:

    - verbose output
    - default "-b" root that's more suitable for build-time checks
    - forward compatibility for -b/-d/-r arguments in EAPI 6

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

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 204392e08da4..fd8fbae3ef03 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1397,5 +1397,47 @@ _python_run_check_deps() {
    eend ${?}
    }

    +# @FUNCTION: python_has_version
    +# @USAGE: [-b|-d|-r] <atom>...
    +# @DESCRIPTION:
    +# A convenience wrapper for has_version() with verbose output and better
    +# defaults for use in python_check_deps().
    +#
    +# The wrapper accepts EAPI 7+-style -b/-d/-r options to indicate
    +# the root to perform the lookup on. Unlike has_version, the default
    +# is -b. In EAPI 6, -b and -d are translated to --host-root
    +# for compatibility.
    +#
    +# The wrapper accepts multiple package specifications. For the check
    +# to succeed, *all* specified atoms must match.
    +python_has_version() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local root_arg=