Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 29 May 2017 21:54:00
Message-Id: 1496094807.65a8abba1c180bc062221c2d224ecb5dc8c81ef8.mgorny@gentoo
1 commit: 65a8abba1c180bc062221c2d224ecb5dc8c81ef8
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 20 07:04:06 2017 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon May 29 21:53:27 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65a8abba
7
8 python-utils-r1.eclass: _python_impl_matches, handle both forms of impl
9
10 Make the pattern matching code in _python_impl_matches() more lax,
11 allowing (accidental) mixing of PYTHON_COMPAT-style values with
12 EPYTHON-style values. This is trivial to do, and solves the problem
13 introduced by complexity-by-limitation of other eclasses -- where
14 patterns for dependency strings are using PYTHON_COMPAT syntax,
15 and patterns for python_setup are using EPYTHON syntax.
16
17 eclass/python-utils-r1.eclass | 6 ++++--
18 1 file changed, 4 insertions(+), 2 deletions(-)
19
20 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
21 index 0bf7e7ec1a3..68fb9ba2578 100644
22 --- a/eclass/python-utils-r1.eclass
23 +++ b/eclass/python-utils-r1.eclass
24 @@ -169,7 +169,8 @@ _python_set_impls() {
25 # Check whether the specified <impl> matches at least one
26 # of the patterns following it. Return 0 if it does, 1 otherwise.
27 #
28 -# <impl> should be in PYTHON_COMPAT form. The patterns can be either:
29 +# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
30 +# either:
31 # a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
32 # b) '-2' to indicate all Python 2 variants (= !python_is_python3)
33 # c) '-3' to indicate all Python 3 variants (= python_is_python3)
34 @@ -186,7 +187,8 @@ _python_impl_matches() {
35 elif [[ ${pattern} == -3 ]]; then
36 python_is_python3 "${impl}"
37 return
38 - elif [[ ${impl} == ${pattern} ]]; then
39 + # unify value style to allow lax matching
40 + elif [[ ${impl/./_} == ${pattern/./_} ]]; then
41 return 0
42 fi
43 done