commit:     ec1de2ac234dace0422097caa55c1b43c8fee539
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Feb  7 10:42:39 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Feb 11 20:31:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec1de2ac

python-r1.eclass: Allow empty depstring to python_gen_any_dep

Allow python_gen_any_dep to accept an empty/missing depstring, in order
to generate a pure dependency on the Python interpreter.  This is
a valid use case for it since python-r1 does not provide any-r1 style
PYTHON_DEPS.

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-r1.eclass | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 5cae020c6d9..74e3fb38a1c 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -524,16 +524,18 @@ python_gen_impl_dep() {
 }
 
 # @FUNCTION: python_gen_any_dep
-# @USAGE: <dependency-block> [<impl-pattern>...]
+# @USAGE: [<dependency-block> [<impl-pattern>...]]
 # @DESCRIPTION:
 # Generate an any-of dependency that enforces a version match between
-# the Python interpreter and Python packages. <dependency-block> needs
-# to list one or more dependencies with verbatim '${PYTHON_USEDEP}'
+# the Python interpreter and Python packages. <dependency-block> may
+# list one or more dependencies with verbatim '${PYTHON_USEDEP}'
 # or '${PYTHON_SINGLE_USEDEP}' references (quoted!) that will get
-# expanded inside the function. Optionally, patterns may be specified
-# to restrict the dependency to a subset of Python implementations
-# supported by the ebuild.
+# expanded inside the function. If <dependency-block> is an empty string
+# (or no arguments are passed), a pure dependency on any Python
+# interpreter will be generated.
 #
+# Optionally, patterns may be specified to restrict the dependency to
+# a subset of Python implementations supported by the ebuild.
 # The patterns can be either fnmatch-style patterns (matched via bash
 # == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
 # appropriately all enabled Python 2/3 implementations (alike
@@ -587,7 +589,6 @@ python_gen_any_dep() {
        debug-print-function ${FUNCNAME} "${@}"
 
        local depstr=${1}
-       [[ ${depstr} ]] || die "No dependency string provided"
        shift
 
        local i PYTHON_PKG_DEP out=

Reply via email to