diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-06-23 22:03:43 -0400 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2020-07-01 09:51:57 -0400 |
commit | 7c90639078650d9457db21a024d437cbb90452c1 (patch) | |
tree | cd2ff15dfed99546f3a03dfec2162e71d407b220 | |
parent | f7a07ee91a77f68e27b1cf60f5ffcd3296f15b7b (diff) | |
download | meson-7c90639078650d9457db21a024d437cbb90452c1.zip meson-7c90639078650d9457db21a024d437cbb90452c1.tar.gz meson-7c90639078650d9457db21a024d437cbb90452c1.tar.bz2 |
interpreter: Don't abort if dep isn't required and sub didn't override
-rw-r--r-- | mesonbuild/interpreter.py | 8 | ||||
-rw-r--r-- | test cases/common/102 subproject subdir/meson.build | 7 | ||||
-rw-r--r-- | test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 7896f51..12d6cde 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3489,8 +3489,12 @@ external dependencies (including libraries) must go to "dependencies".''') raise DependencyException(m.format(display_name)) return DependencyHolder(cached_dep, self.subproject) else: - m = 'Subproject {} did not override dependency {}' - raise DependencyException(m.format(subproj_path, display_name)) + if required: + m = 'Subproject {} did not override dependency {}' + raise DependencyException(m.format(subproj_path, display_name)) + mlog.log('Dependency', mlog.bold(display_name), 'from subproject', + mlog.bold(subproj_path), 'found:', mlog.red('NO')) + return self.notfound_dependency() if subproject.found(): self.verify_fallback_consistency(dirname, varname, cached_dep) dep = self.subprojects[dirname].get_variable_method([varname], {}) diff --git a/test cases/common/102 subproject subdir/meson.build b/test cases/common/102 subproject subdir/meson.build index 93093bf..a891ca9 100644 --- a/test cases/common/102 subproject subdir/meson.build +++ b/test cases/common/102 subproject subdir/meson.build @@ -47,3 +47,10 @@ assert(d.found(), 'Should implicitly fallback') d = dependency('glib-2.0', required : false) assert(d.found()) assert(d.type_name() == 'internal') + +# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject, +# so we must not return the system dependency here. But since the subproject did +# not override that dependency and its not required, not-found should be returned. +# Using gobject-2.0 here because some CI runners have it installed. +d = dependency('gobject-2.0', required : false) +assert(not d.found()) diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap index 6f2dab6..a809c43 100644 --- a/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap +++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap @@ -2,5 +2,5 @@ [provide] glib-2.0 = glib_dep -dependency_names = sub_implicit_provide1 +dependency_names = sub_implicit_provide1, gobject-2.0 sub_implicit_provide2 = sub_implicit_provide2_dep |