commit:     be22deb1b7adc56ad559e0184a78d6aa4f614508
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 11 19:39:17 2021 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Tue Sep 14 17:55:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=be22deb1

python-utils-r1.eclass: add and use _python_check_EPYTHON

Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 eclass/python-utils-r1.eclass | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 4fedf939c77..c729651699d 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1250,6 +1250,16 @@ build_sphinx() {
        HTML_DOCS+=( "${dir}/_build/html/." )
 }
 
+# @FUNCTION: _python_check_EPYTHON
+# @INTERNAL
+# @DESCRIPTION:
+# Check if EPYTHON is set, die if not.
+_python_check_EPYTHON() {
+       if [[ -z ${EPYTHON} ]]; then
+               die "EPYTHON unset, invalid call context"
+       fi
+}
+
 # @VARIABLE: EPYTEST_DESELECT
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -1279,7 +1289,7 @@ build_sphinx() {
 epytest() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
+       _python_check_EPYTHON
 
        local args=(
                # verbose progress reporting and tracebacks
@@ -1322,7 +1332,7 @@ epytest() {
 eunittest() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
+       _python_check_EPYTHON
 
        set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
 

Reply via email to