diff options
author | V3n3RiX <venerix@koprulu.sector> | 2022-03-20 00:40:44 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2022-03-20 00:40:44 +0000 |
commit | 4cbcc855382a06088e2f016f62cafdbcb7e40665 (patch) | |
tree | 356496503d52354aa6d9f2d36126302fed5f3a73 /eclass/python-any-r1.eclass | |
parent | fcc5224904648a8e6eb528d7603154160a20022f (diff) |
gentoo resync : 20.03.2022
Diffstat (limited to 'eclass/python-any-r1.eclass')
-rw-r--r-- | eclass/python-any-r1.eclass | 64 |
1 files changed, 18 insertions, 46 deletions
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 282c449f2a03..805981bb7aa8 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -271,44 +271,6 @@ python_gen_any_dep() { echo "|| ( ${out})" } -# @FUNCTION: _python_EPYTHON_supported -# @USAGE: <epython> -# @INTERNAL -# @DESCRIPTION: -# Check whether the specified implementation is supported by package -# (specified in PYTHON_COMPAT). Calls python_check_deps() if declared. -_python_EPYTHON_supported() { - debug-print-function ${FUNCNAME} "${@}" - - 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 - fi - elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then - ewarn "Invalid EPYTHON: ${EPYTHON}" - fi - return 1 -} - # @FUNCTION: python_setup # @DESCRIPTION: # Determine what the best installed (and supported) Python @@ -332,27 +294,37 @@ python_setup() { _python_export "${impls[0]}" EPYTHON PYTHON _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via PYTHON_COMPAT_OVERRIDE)" return fi # first, try ${EPYTHON}... maybe it's good enough for us. - if [[ ${EPYTHON} ]]; then - if _python_EPYTHON_supported "${EPYTHON}"; then + local epython_impl=${EPYTHON/./_} + if [[ ${epython_impl} ]]; then + if ! has "${epython_impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then + if ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then + ewarn "Invalid EPYTHON: ${EPYTHON}" + else + einfo "EPYTHON (${EPYTHON}) not supported by the package" + fi + elif _python_run_check_deps "${epython_impl}"; then _python_export EPYTHON PYTHON _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via EPYTHON)" return fi fi - # fallback to best installed impl. + # fallback to the best installed impl. # (reverse iteration over _PYTHON_SUPPORTED_IMPLS) for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do - _python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON - if _python_EPYTHON_supported "${EPYTHON}"; then + local impl=${_PYTHON_SUPPORTED_IMPLS[i]} + # avoid checking EPYTHON twice + [[ ${impl} == ${epython_impl} ]] && continue + _python_export "${impl}" EPYTHON PYTHON + if _python_run_check_deps "${impl}"; then _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via PYTHON_COMPAT iteration)" return fi done |