aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-06-22 17:45:58 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-30 13:28:15 +0000
commitfd4872ae77015983370f01013c4826f36c91907a (patch)
tree64e2c73f97070b81d92d9b01c288b4fa17573380
parent9efdcfbb8d49286e08b7bbb50afd59f7f3d93f4a (diff)
downloadmeson-fd4872ae77015983370f01013c4826f36c91907a.zip
meson-fd4872ae77015983370f01013c4826f36c91907a.tar.gz
meson-fd4872ae77015983370f01013c4826f36c91907a.tar.bz2
More tests to cover missing fallback for a non-found dependency
Fix logic so we correctly raise an exception about missing fallback in the case where the dependency is required.
-rw-r--r--mesonbuild/interpreter.py4
-rw-r--r--test cases/common/171 not-found dependency/meson.build1
-rw-r--r--test cases/failing/80 subproj dependency not-found and required/meson.build2
3 files changed, 6 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index f0e7106..c469ec6 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2841,7 +2841,7 @@ external dependencies (including libraries) must go to "dependencies".''')
# Unless a fallback exists and is forced ...
if self.coredata.wrap_mode == WrapMode.forcefallback and 'fallback' in kwargs:
- exception = DependencyException("fallback for %s not found" % name)
+ pass
# ... search for it outside the project
elif name != '':
try:
@@ -2852,6 +2852,8 @@ external dependencies (including libraries) must go to "dependencies".''')
# Search inside the projects list
if not dep.found():
if 'fallback' in kwargs:
+ if not exception:
+ exception = DependencyException("fallback for %s not found" % display_name)
fallback_dep = self.dependency_fallback(name, kwargs)
if fallback_dep:
# Never add fallback deps to self.coredata.deps since we
diff --git a/test cases/common/171 not-found dependency/meson.build b/test cases/common/171 not-found dependency/meson.build
index c1e3a9a..02072b6 100644
--- a/test cases/common/171 not-found dependency/meson.build
+++ b/test cases/common/171 not-found dependency/meson.build
@@ -11,3 +11,4 @@ library('testlib', 'testlib.c', dependencies: [dep])
subdir('sub', if_found: dep)
subdep = dependency('', fallback: ['trivial', 'trivial_dep'])
+missing = dependency('', fallback: ['missing', 'missing_dep'], required: false)
diff --git a/test cases/failing/80 subproj dependency not-found and required/meson.build b/test cases/failing/80 subproj dependency not-found and required/meson.build
new file mode 100644
index 0000000..c5a2961
--- /dev/null
+++ b/test cases/failing/80 subproj dependency not-found and required/meson.build
@@ -0,0 +1,2 @@
+project('dep-test')
+missing = dependency('', fallback: ['missing', 'missing_dep'], required: true)