diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2020-08-11 10:53:36 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2020-08-12 13:38:55 +0000 |
commit | 435db359622ca6507a087b6bdcb2a977b3d3b8a4 (patch) | |
tree | a14bfb6ff347549d869fbab3da9f2a3863a5fae0 | |
parent | 4b0e1850a00431fe34b4e8087865f51225fe027d (diff) | |
download | meson-435db359622ca6507a087b6bdcb2a977b3d3b8a4.zip meson-435db359622ca6507a087b6bdcb2a977b3d3b8a4.tar.gz meson-435db359622ca6507a087b6bdcb2a977b3d3b8a4.tar.bz2 |
interpreter: Don't force fallback when subproject failed to configure
Fixes: #7534
-rw-r--r-- | mesonbuild/interpreter.py | 3 | ||||
-rwxr-xr-x | run_unittests.py | 18 |
2 files changed, 20 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 429c9bb..2af08ec 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3671,7 +3671,8 @@ external dependencies (including libraries) must go to "dependencies".''') # a higher level project, try to use it first. if has_fallback: dirname, varname = self.get_subproject_infos(kwargs) - if dirname in self.subprojects: + sub = self.subprojects.get(dirname) + if sub and sub.found(): return self.get_subproject_dep(name, display_name, dirname, varname, kwargs) wrap_mode = self.coredata.get_builtin_option('wrap_mode') diff --git a/run_unittests.py b/run_unittests.py index 7044d5e..97b3b58 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -7127,6 +7127,24 @@ c = ['{0}'] build_rpath = get_rpath(os.path.join(self.builddir, 'prog')) self.assertIsNone(build_rpath) + def test_lookup_system_after_broken_fallback(self): + # Just to generate libfoo.pc so we can test system dependency lookup. + testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen') + self.init(testdir) + privatedir = self.privatedir + + # Write test project where the first dependency() returns not-found + # because 'broken' subproject does not exit, but that should not prevent + # the 2nd dependency() to lookup on system. + self.new_builddir() + with tempfile.TemporaryDirectory() as d: + with open(os.path.join(d, 'meson.build'), 'w') as f: + f.write(textwrap.dedent('''\ + project('test') + dependency('notfound', fallback: 'broken', required: false) + dependency('libfoo', fallback: 'broken', required: true) + ''')) + self.init(d, override_envvars={'PKG_CONFIG_LIBDIR': privatedir}) class BaseLinuxCrossTests(BasePlatformTests): # Don't pass --libdir when cross-compiling. We have tests that |