summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-11-30 10:56:38 +0100
committerMichał Górny <mgorny@gentoo.org>2019-12-07 15:36:28 +0100
commit1d5b43ab215e7062d48a581b18f69df4eccb40ac (patch)
tree86fe5094f859c9e7ac9ec67cb0430e8b25946d6b /eclass/python-utils-r1.eclass
parentpython-single-r1.eclass: Restore PYTHON_SINGLE_TARGET for one impl (diff)
downloadgentoo-1d5b43ab215e7062d48a581b18f69df4eccb40ac.tar.gz
gentoo-1d5b43ab215e7062d48a581b18f69df4eccb40ac.tar.bz2
gentoo-1d5b43ab215e7062d48a581b18f69df4eccb40ac.zip
python*r1.eclass: Reliably allow empty <pattern>s to gen funcs
Reliably allow empty pattern lists (equivalent to no restrictions) in all pattern-based generator functions, notably python_gen_cond_dep. Previously, only some of the functions accepted them while others failed via _python_impl_matches function. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass6
1 files changed, 4 insertions, 2 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 4f3ac66f215..3eadc50f93e 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -164,11 +164,12 @@ _python_set_impls() {
}
# @FUNCTION: _python_impl_matches
-# @USAGE: <impl> <pattern>...
+# @USAGE: <impl> [<pattern>...]
# @INTERNAL
# @DESCRIPTION:
# Check whether the specified <impl> matches at least one
# of the patterns following it. Return 0 if it does, 1 otherwise.
+# Matches if no patterns are provided.
#
# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
# either:
@@ -176,7 +177,8 @@ _python_set_impls() {
# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
# c) '-3' to indicate all Python 3 variants (= python_is_python3)
_python_impl_matches() {
- [[ ${#} -ge 2 ]] || die "${FUNCNAME}: takes at least 2 parameters"
+ [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
+ [[ ${#} -eq 1 ]] && return 0
local impl=${1} pattern
shift