mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-07 05:57:07 -08:00
python-utils-r1.eclass: Add a verbose python_has_version() wrapper
Add a python_has_version() wrapper for convenient use in python_check_deps(). It includes: - verbose output - default "-b" root that's more suitable for build-time checks - forward compatibility for -b/-d/-r arguments in EAPI 6 Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -1397,5 +1397,47 @@ _python_run_check_deps() {
|
||||
eend ${?}
|
||||
}
|
||||
|
||||
# @FUNCTION: python_has_version
|
||||
# @USAGE: [-b|-d|-r] <atom>...
|
||||
# @DESCRIPTION:
|
||||
# A convenience wrapper for has_version() with verbose output and better
|
||||
# defaults for use in python_check_deps().
|
||||
#
|
||||
# The wrapper accepts EAPI 7+-style -b/-d/-r options to indicate
|
||||
# the root to perform the lookup on. Unlike has_version, the default
|
||||
# is -b. In EAPI 6, -b and -d are translated to --host-root
|
||||
# for compatibility.
|
||||
#
|
||||
# The wrapper accepts multiple package specifications. For the check
|
||||
# to succeed, *all* specified atoms must match.
|
||||
python_has_version() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
local root_arg=( -b )
|
||||
case ${1} in
|
||||
-b|-d|-r)
|
||||
root_arg=( "${1}" )
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ${EAPI} == 6 ]]; then
|
||||
if [[ ${root_arg} == -r ]]; then
|
||||
root_arg=()
|
||||
else
|
||||
root_arg=( --host-root )
|
||||
fi
|
||||
fi
|
||||
|
||||
local pkg
|
||||
for pkg; do
|
||||
ebegin " ${pkg}"
|
||||
has_version "${root_arg[@]}" "${pkg}"
|
||||
eend ${?} || return
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
_PYTHON_UTILS_R1=1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user