diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-02-04 15:04:12 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-02-09 09:43:43 +0100 |
commit | c3365e7fe48f49f717b2698d82c26c812910522e (patch) | |
tree | 5003c481aa48dab071bf6db57ba0f223dc444795 /eclass | |
parent | python-r1.eclass: Remove deprecated python_gen_usedep (diff) | |
download | gentoo-c3365e7fe48f49f717b2698d82c26c812910522e.tar.gz gentoo-c3365e7fe48f49f717b2698d82c26c812910522e.tar.bz2 gentoo-c3365e7fe48f49f717b2698d82c26c812910522e.zip |
python-any-r1.eclass: Move EPYTHON validity check to python_setup()
Move the EPYTHON validity check from _python_EPYTHON_supported()
to python_setup() where it belongs. This avoids unnecessarily retesting
implementations taken from PYTHON_COMPAT and paves the way towards
moving the common logic to python-utils-r1.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/python-any-r1.eclass | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 282c449f2a03..4c832384ed7a 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -283,28 +283,15 @@ _python_EPYTHON_supported() { local EPYTHON=${1} local i=${EPYTHON/./_} - case "${i}" in - python*|jython*|pypy*) - ;; - *) - ewarn "Invalid EPYTHON: ${EPYTHON}" - return 1 - ;; - esac - - if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then - if python_is_installed "${i}"; then - if declare -f python_check_deps >/dev/null; then - local PYTHON_USEDEP="python_targets_${i}(-)" - local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" - python_check_deps - return ${?} - fi - - return 0 + if python_is_installed "${i}"; then + if declare -f python_check_deps >/dev/null; then + local PYTHON_USEDEP="python_targets_${i}(-)" + local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" + python_check_deps + return ${?} fi - elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then - ewarn "Invalid EPYTHON: ${EPYTHON}" + + return 0 fi return 1 } @@ -338,7 +325,12 @@ python_setup() { # first, try ${EPYTHON}... maybe it's good enough for us. if [[ ${EPYTHON} ]]; then - if _python_EPYTHON_supported "${EPYTHON}"; then + local impl=${EPYTHON/./_} + if ! has "${impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then + einfo "EPYTHON (${EPYTHON}) not supported by the package" + elif ! has "${impl}" "${_PYTHON_ALL_IMPLS[@]}"; then + ewarn "Invalid EPYTHON: ${EPYTHON}" + elif _python_EPYTHON_supported "${EPYTHON}"; then _python_export EPYTHON PYTHON _python_wrapper_setup einfo "Using ${EPYTHON} to build" |