summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-05-20 09:04:06 +0200
committerMichał Górny <mgorny@gentoo.org>2017-05-29 23:53:27 +0200
commit65a8abba1c180bc062221c2d224ecb5dc8c81ef8 (patch)
tree9e6ac5c5712f0470e69e2777a1e208297c38abd8 /eclass/python-utils-r1.eclass
parentdistutils-r1.eclass: Use _python_impl_matches() (diff)
downloadgentoo-65a8abba1c180bc062221c2d224ecb5dc8c81ef8.tar.gz
gentoo-65a8abba1c180bc062221c2d224ecb5dc8c81ef8.tar.bz2
gentoo-65a8abba1c180bc062221c2d224ecb5dc8c81ef8.zip
python-utils-r1.eclass: _python_impl_matches, handle both forms of impl
Make the pattern matching code in _python_impl_matches() more lax, allowing (accidental) mixing of PYTHON_COMPAT-style values with EPYTHON-style values. This is trivial to do, and solves the problem introduced by complexity-by-limitation of other eclasses -- where patterns for dependency strings are using PYTHON_COMPAT syntax, and patterns for python_setup are using EPYTHON syntax.
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 0bf7e7ec1a3e..68fb9ba2578d 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -169,7 +169,8 @@ _python_set_impls() {
# Check whether the specified <impl> matches at least one
# of the patterns following it. Return 0 if it does, 1 otherwise.
#
-# <impl> should be in PYTHON_COMPAT form. The patterns can be either:
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
+# either:
# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
# c) '-3' to indicate all Python 3 variants (= python_is_python3)
@@ -186,7 +187,8 @@ _python_impl_matches() {
elif [[ ${pattern} == -3 ]]; then
python_is_python3 "${impl}"
return
- elif [[ ${impl} == ${pattern} ]]; then
+ # unify value style to allow lax matching
+ elif [[ ${impl/./_} == ${pattern/./_} ]]; then
return 0
fi
done