Gentoo Archives: gentoo-dev

From: Florian Schmaus <flow@g.o>
To: gentoo-dev@l.g.o
Cc: Florian Schmaus <flow@g.o>
Subject: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: add and use _python_check_EPYTHON
Date: Mon, 13 Sep 2021 07:48:12
Message-Id: 20210913074745.580719-1-flow@gentoo.org
1 Signed-off-by: Florian Schmaus <flow@g.o>
2 ---
3 eclass/python-utils-r1.eclass | 14 ++++++++++++--
4 1 file changed, 12 insertions(+), 2 deletions(-)
5
6 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
7 index 4fedf939c779..c729651699dd 100644
8 --- a/eclass/python-utils-r1.eclass
9 +++ b/eclass/python-utils-r1.eclass
10 @@ -1250,6 +1250,16 @@ build_sphinx() {
11 HTML_DOCS+=( "${dir}/_build/html/." )
12 }
13
14 +# @FUNCTION: _python_check_EPYTHON
15 +# @INTERNAL
16 +# @DESCRIPTION:
17 +# Check if EPYTHON is set, die if not.
18 +_python_check_EPYTHON() {
19 + if [[ -z ${EPYTHON} ]]; then
20 + die "EPYTHON unset, invalid call context"
21 + fi
22 +}
23 +
24 # @VARIABLE: EPYTEST_DESELECT
25 # @DEFAULT_UNSET
26 # @DESCRIPTION:
27 @@ -1279,7 +1289,7 @@ build_sphinx() {
28 epytest() {
29 debug-print-function ${FUNCNAME} "${@}"
30
31 - [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
32 + _python_check_EPYTHON
33
34 local args=(
35 # verbose progress reporting and tracebacks
36 @@ -1322,7 +1332,7 @@ epytest() {
37 eunittest() {
38 debug-print-function ${FUNCNAME} "${@}"
39
40 - [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
41 + _python_check_EPYTHON
42
43 set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
44
45 --
46 2.32.0

Replies