aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-25 01:59:24 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-03-27 22:02:06 +0300
commit98e71e1e65ed2992c06dfa41169a73f0b44df2cf (patch)
treeed50733055c2e90d2e6014fedb9d42d316cc7341 /mesonbuild
parent905dbd5cd2204621e4b8e422d8351538151f2e2c (diff)
downloadmeson-98e71e1e65ed2992c06dfa41169a73f0b44df2cf.zip
meson-98e71e1e65ed2992c06dfa41169a73f0b44df2cf.tar.gz
meson-98e71e1e65ed2992c06dfa41169a73f0b44df2cf.tar.bz2
Allow not-required not-found dependencies in subprojects
Closes https://github.com/mesonbuild/meson/issues/1474
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index cd5db62..4ee0485 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -1938,8 +1938,14 @@ class Interpreter(InterpreterBase):
try:
dep = self.subprojects[dirname].get_variable_method([varname], {})
except KeyError:
- raise InvalidCode('Fallback variable {!r} in the subproject '
- '{!r} does not exist'.format(varname, dirname))
+ if kwargs.get('required', True):
+ m = 'Fallback variable {!r} in the subproject {!r} does not exist'
+ raise DependencyException(m.format(varname, dirname))
+ # If the dependency is not required, don't raise an exception
+ mlog.log('Also couldn\'t find the dependency', mlog.bold(name),
+ 'in the fallback subproject',
+ mlog.bold(os.path.join(self.subproject_dir, dirname)))
+ return None
if not isinstance(dep, DependencyHolder):
raise InvalidCode('Fallback variable {!r} in the subproject {!r} is '
'not a dependency object.'.format(varname, dirname))