Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] distutils-r1.eclass: Check for _all phase mismatch
Date: Mon, 28 Jun 2021 11:04:30
Message-Id: 20210628110418.39772-1-mgorny@gentoo.org
1 Check for the mistake of calling distutils-r1_python_*_all() from
2 non-all python_*() subphase.
3
4 Signed-off-by: Michał Górny <mgorny@g.o>
5 ---
6 eclass/distutils-r1.eclass | 16 ++++++++++++++++
7 1 file changed, 16 insertions(+)
8
9 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
10 index a26130f7a194..5f261612e6d2 100644
11 --- a/eclass/distutils-r1.eclass
12 +++ b/eclass/distutils-r1.eclass
13 @@ -616,6 +616,20 @@ _distutils-r1_handle_pyproject_toml() {
14 fi
15 }
16
17 +# @FUNCTION: _distutils-r1_check_all_phase_mismatch
18 +# @DESCRIPTION:
19 +# Verify whether *_all phase impls is not called from from non-*_all
20 +# subphase.
21 +_distutils-r1_check_all_phase_mismatch() {
22 + if has "python_${EBUILD_PHASE}" "${FUNCNAME[@]}"; then
23 + eqawarn "QA Notice: distutils-r1_python_${EBUILD_PHASE}_all called"
24 + eqawarn "from python_${EBUILD_PHASE}. Did you mean to use"
25 + eqawarn "python_${EBUILD_PHASE}_all()?"
26 + [[ ${EAPI} != [67] ]] &&
27 + die "distutils-r1_python_${EBUILD_PHASE}_all called from python_${EBUILD_PHASE}."
28 + fi
29 +}
30 +
31 # @FUNCTION: distutils-r1_python_prepare_all
32 # @DESCRIPTION:
33 # The default python_prepare_all(). It applies the patches from PATCHES
34 @@ -626,6 +640,7 @@ _distutils-r1_handle_pyproject_toml() {
35 # distutils patches and/or quirks.
36 distutils-r1_python_prepare_all() {
37 debug-print-function ${FUNCNAME} "${@}"
38 + _distutils-r1_check_all_phase_mismatch
39
40 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
41 default
42 @@ -931,6 +946,7 @@ distutils-r1_python_install() {
43 # The default python_install_all(). It installs the documentation.
44 distutils-r1_python_install_all() {
45 debug-print-function ${FUNCNAME} "${@}"
46 + _distutils-r1_check_all_phase_mismatch
47
48 einstalldocs
49 }
50 --
51 2.32.0