diff options
author | Salamandar <felix@piedallu.me> | 2018-06-04 14:32:02 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-07-02 07:05:08 +0000 |
commit | df1970d3add1f673f06f6269b45e8833a0bfd5c1 (patch) | |
tree | e041aa74fdfc5ae3b831694ef055ef30a33ec83a /mesonbuild/mesonlib.py | |
parent | 5113eb14b9ca4711c5fc197b150dc125eeaf77f6 (diff) | |
download | meson-df1970d3add1f673f06f6269b45e8833a0bfd5c1.zip meson-df1970d3add1f673f06f6269b45e8833a0bfd5c1.tar.gz meson-df1970d3add1f673f06f6269b45e8833a0bfd5c1.tar.bz2 |
Various bug fixes for FeatureNew
* Use _get_callee_args to unwrap function call arguments, needed for
module functions.
* Move some FeatureNewKwargs from build.py to interpreter.py
* Print a summary for featurenew only if conflicts were found. The
summary now only prints conflicting features.
* Report and store featurenew/featuredeprecated only once
* Fix version comparison: use le/ge and resize arrays to not fail on
'0.47.0>=0.47'
Closes https://github.com/mesonbuild/meson/issues/3660
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r-- | mesonbuild/mesonlib.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 21a6e29..c122589 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -396,6 +396,12 @@ def grab_leading_numbers(vstr, strict=False): break return result +def make_same_len(listA, listB): + maxlen = max(len(listA), len(listB)) + for i in listA, listB: + for n in range(len(i), maxlen): + i.append(0) + numpart = re.compile('[0-9.]+') def version_compare(vstr1, vstr2, strict=False): @@ -429,6 +435,7 @@ def version_compare(vstr1, vstr2, strict=False): cmpop = operator.eq varr1 = grab_leading_numbers(vstr1, strict) varr2 = grab_leading_numbers(vstr2, strict) + make_same_len(varr1, varr2) return cmpop(varr1, varr2) def version_compare_many(vstr1, conditions): @@ -451,7 +458,7 @@ def version_compare_condition_with_min(condition, minimum): raise MesonException(msg.format(minimum)) minimum = match.group(0) if condition.startswith('>='): - cmpop = operator.lt + cmpop = operator.le condition = condition[2:] elif condition.startswith('<='): return True @@ -460,10 +467,10 @@ def version_compare_condition_with_min(condition, minimum): return True condition = condition[2:] elif condition.startswith('=='): - cmpop = operator.lt + cmpop = operator.le condition = condition[2:] elif condition.startswith('='): - cmpop = operator.lt + cmpop = operator.le condition = condition[1:] elif condition.startswith('>'): cmpop = operator.lt @@ -472,9 +479,10 @@ def version_compare_condition_with_min(condition, minimum): return True condition = condition[2:] else: - cmpop = operator.eq + cmpop = operator.le varr1 = grab_leading_numbers(minimum, True) varr2 = grab_leading_numbers(condition, True) + make_same_len(varr1, varr2) return cmpop(varr1, varr2) def version_compare_condition_with_max(condition, maximum): @@ -487,27 +495,28 @@ def version_compare_condition_with_max(condition, maximum): return False condition = condition[2:] elif condition.startswith('<='): - cmpop = operator.lt + cmpop = operator.ge condition = condition[2:] elif condition.startswith('!='): return False condition = condition[2:] elif condition.startswith('=='): - cmpop = operator.lt + cmpop = operator.ge condition = condition[2:] elif condition.startswith('='): - cmpop = operator.lt + cmpop = operator.ge condition = condition[1:] elif condition.startswith('>'): return False condition = condition[1:] elif condition.startswith('<'): - cmpop = operator.lt + cmpop = operator.gt condition = condition[2:] else: - cmpop = operator.eq + cmpop = operator.ge varr1 = grab_leading_numbers(maximum, True) varr2 = grab_leading_numbers(condition, True) + make_same_len(varr1, varr2) return cmpop(varr1, varr2) |