From e9d7a718bdee8127b30fb55842f534cb4b0fb0ed Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 28 Jun 2021 13:02:43 +0200 Subject: distutils-r1.eclass: Check for _all phase mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check for the mistake of calling distutils-r1_python_*_all() from non-all python_*() subphase. Signed-off-by: Michał Górny --- eclass/distutils-r1.eclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e2cafb425c3a..344aa46b2f94 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -616,6 +616,20 @@ _distutils-r1_handle_pyproject_toml() { fi } +# @FUNCTION: _distutils-r1_check_all_phase_mismatch +# @DESCRIPTION: +# Verify whether *_all phase impls is not called from from non-*_all +# subphase. +_distutils-r1_check_all_phase_mismatch() { + if has "python_${EBUILD_PHASE}" "${FUNCNAME[@]}"; then + eqawarn "QA Notice: distutils-r1_python_${EBUILD_PHASE}_all called" + eqawarn "from python_${EBUILD_PHASE}. Did you mean to use" + eqawarn "python_${EBUILD_PHASE}_all()?" + [[ ${EAPI} != [67] ]] && + die "distutils-r1_python_${EBUILD_PHASE}_all called from python_${EBUILD_PHASE}." + fi +} + # @FUNCTION: distutils-r1_python_prepare_all # @DESCRIPTION: # The default python_prepare_all(). It applies the patches from PATCHES @@ -626,6 +640,7 @@ _distutils-r1_handle_pyproject_toml() { # distutils patches and/or quirks. distutils-r1_python_prepare_all() { debug-print-function ${FUNCNAME} "${@}" + _distutils-r1_check_all_phase_mismatch if [[ ! ${DISTUTILS_OPTIONAL} ]]; then default @@ -932,6 +947,7 @@ distutils-r1_python_install() { # The default python_install_all(). It installs the documentation. distutils-r1_python_install_all() { debug-print-function ${FUNCNAME} "${@}" + _distutils-r1_check_all_phase_mismatch einstalldocs } -- cgit v1.2.3-65-gdbad