• [gentoo-dev] [PATCH] python-r1.eclass: Warn about direct foreach_impl c

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Thu Jun 9 21:10:01 2022
    Warn if python_foreach_impl is called directly from within a phase
    function that is already covered by a distutils-r1 sub-phase.

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

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 0e069597b3ab..0696b096b3c3 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1750,6 +1750,7 @@ _distutils-r1_run_foreach_impl() {
    set -- distutils-r1_run_phase "${@}"

    if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
    + local _DISTUTILS_CALLING_FOREACH_IMPL=1
    python_foreach_impl "${@}"
    else
    if [[ ! ${EPYTHON} ]]; then
    diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
    index 2f8cfa0316d9..3471e17bdde6 100644
    --- a/eclass/python-r1.eclass
    +++ b/eclass/python-r1.eclass
    @@ -625,6 +625,24 @@ _python_multibuild_wrapper() {
    python_foreach_impl() {
    debug-print-function ${FUNCNAME} "${@}"

    + if [[ ${_DISTUTILS_R1} ]]; then
    + if has "${EBUILD_PHASE}" prepare configure compile test install &&
    + [[ ! ${_DISTUTILS_CALLING_FOREACH_IMPL} &&
    + ! $