python-utils-r1.eclass: Inline python_is_installed

Inline the python_is_installed function that is used exactly once
(in _python_run_check_deps).  This helps us avoid having to grab
PYTHON_PKG_DEP twice.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2022-02-09 09:43:46 +01:00
parent 950d2685fb
commit bcf57dbbf5
+3 -19
View File
@@ -995,24 +995,6 @@ python_is_python3() {
[[ ${impl} == python3* || ${impl} == pypy3 ]]
}
# @FUNCTION: python_is_installed
# @USAGE: [<impl>]
# @DESCRIPTION:
# Check whether the interpreter for <impl> (or ${EPYTHON}) is installed.
# Uses has_version with a proper dependency string.
#
# Returns 0 (true) if it is, 1 (false) otherwise.
python_is_installed() {
local impl=${1:-${EPYTHON}}
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
local hasv_args=( -b )
[[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
local PYTHON_PKG_DEP
_python_export "${impl}" PYTHON_PKG_DEP
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
}
# @FUNCTION: python_fix_shebang
# @USAGE: [-f|--force] [-q|--quiet] <path>...
# @DESCRIPTION:
@@ -1379,13 +1361,15 @@ _python_run_check_deps() {
debug-print-function ${FUNCNAME} "${@}"
local impl=${1}
local hasv_args=( -b )
[[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
einfo "Checking whether ${impl} is suitable ..."
local PYTHON_PKG_DEP
_python_export "${impl}" PYTHON_PKG_DEP
ebegin " ${PYTHON_PKG_DEP}"
python_is_installed "${impl}"
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
eend ${?} || return 1
declare -f python_check_deps >/dev/null || return 0