Add a python_has_version() wrapper that runs has_version in a verbose
way that makes python_check_deps() failures easier to understand.

Signed-off-by: Michał Górny <[email protected]>
---
 eclass/python-utils-r1.eclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 3d938f5ee74f..c3726437cb68 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1380,5 +1380,21 @@ _python_run_check_deps() {
        eend ${?}
 }
 
+# @FUNCTION: python_has_version
+# @USAGE: [-b|-d|-r] <atom>
+# @DESCRIPTION:
+# A wrapper for has_version() with verbose output suitable for
+# python_check_deps.
+python_has_version() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       local pkg=${1}
+       [[ ${pkg} == -* ]] && pkg=${2}
+
+       ebegin "    ${pkg}"
+       has_version "${@}"
+       eend ${?}
+}
+
 _PYTHON_UTILS_R1=1
 fi
-- 
2.35.1


Reply via email to