aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2016-11-06 09:11:42 -0800
committerGitHub <noreply@github.com>2016-11-06 09:11:42 -0800
commitf8bf37979b904ccef89149005cf3615caa3bb774 (patch)
tree3104441438d970bfa6e076cb51847032883dfe83
parentae8a0a1438dab3929fe21422163372925ca706b3 (diff)
parentcb36843863e098752ce77965226fd864c6134a2a (diff)
downloadmeson-f8bf37979b904ccef89149005cf3615caa3bb774.zip
meson-f8bf37979b904ccef89149005cf3615caa3bb774.tar.gz
meson-f8bf37979b904ccef89149005cf3615caa3bb774.tar.bz2
Merge pull request #993 from centricular/cached-dep-required-attr
dependency: Check that cached_dep has the 'required' attribute
-rw-r--r--mesonbuild/interpreter.py6
-rw-r--r--test cases/failing/34 dependency not-required then required/meson.build2
2 files changed, 3 insertions, 5 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 8fa9385..ca97f74 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1856,12 +1856,10 @@ requirements use the version keyword argument instead.''')
# Cached dep has the wrong version. Check if an external
# dependency or a fallback dependency provides it.
cached_dep = None
-
# Don't re-use cached dep if it wasn't required but this one is,
# so we properly go into fallback/error code paths
- if 'required' in kwargs and cached_dep is not None:
- if not cached_dep.required and kwargs.get('required', True):
- cached_dep = None
+ if kwargs.get('required', True) and not getattr(cached_dep, 'required', False):
+ cached_dep = None
if cached_dep:
dep = cached_dep
diff --git a/test cases/failing/34 dependency not-required then required/meson.build b/test cases/failing/34 dependency not-required then required/meson.build
index f33c41c..1796699 100644
--- a/test cases/failing/34 dependency not-required then required/meson.build
+++ b/test cases/failing/34 dependency not-required then required/meson.build
@@ -1,4 +1,4 @@
project('dep-test', 'c', version : '1.0')
foo_dep = dependency('foo-bar-xyz-12.3', required : false)
-bar_dep = dependency('foo-bar-xyz-12.3', required : true)
+bar_dep = dependency('foo-bar-xyz-12.3')