diff options
-rw-r--r-- | mesonbuild/dependencies/base.py | 4 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 13 | ||||
-rw-r--r-- | test cases/linuxlike/5 dependency versions/meson.build | 6 |
3 files changed, 15 insertions, 8 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 1666e0c..06ea1c3 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -365,8 +365,8 @@ class ExternalDependency(Dependency, HasNativeKwarg): if not self.is_found: found_msg = ['Dependency', mlog.bold(self.name), 'found:'] found_msg += [mlog.red('NO'), - 'found {!r} but need:'.format(self.version), - ', '.join(["'{}'".format(e) for e in not_found])] + 'found', mlog.normal_cyan(self.version), 'but need:', + mlog.bold(', '.join(["'{}'".format(e) for e in not_found]))] if found: found_msg += ['; matched:', ', '.join(["'{}'".format(e) for e in found])] diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 618f55b..6f541b2 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3020,7 +3020,7 @@ external dependencies (including libraries) must go to "dependencies".''') return identifier, cached_dep # Verify the cached dep version match - wanted_vers = kwargs.get('version', []) + wanted_vers = mesonlib.stringlistify(kwargs.get('version', [])) found_vers = cached_dep.get_version() if not wanted_vers or mesonlib.version_compare_many(found_vers, wanted_vers)[0]: info = [mlog.blue('(cached)')] @@ -3034,7 +3034,7 @@ external dependencies (including libraries) must go to "dependencies".''') @staticmethod def check_subproject_version(wanted, found): - if wanted == 'undefined': + if not wanted: return True if found == 'undefined' or not mesonlib.version_compare_many(found, wanted)[0]: return False @@ -3057,7 +3057,7 @@ external dependencies (including libraries) must go to "dependencies".''') 'not a dependency object.'.format(varname, dirname)) required = kwargs.get('required', True) - wanted = kwargs.get('version', 'undefined') + wanted = mesonlib.stringlistify(kwargs.get('version', [])) subproj_path = os.path.join(self.subproject_dir, dirname) if not dep.found(): @@ -3076,9 +3076,10 @@ external dependencies (including libraries) must go to "dependencies".''') 'cached, requested incompatible version {} for ' 'dep {}'.format(found, dirname, wanted, display_name)) - mlog.log('Subproject', mlog.bold(subproj_path), 'dependency', - mlog.bold(display_name), 'version is', mlog.normal_cyan(found), - 'but', mlog.bold(wanted), 'is required.') + mlog.log('Dependency', mlog.bold(display_name), 'from subproject', + mlog.bold(subproj_path), 'found:', mlog.red('NO'), + 'found', mlog.normal_cyan(found), 'but need:', + mlog.bold(', '.join(["'{}'".format(e) for e in wanted]))) return self.notfound_dependency() found = mlog.normal_cyan(found) if found else None diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build index 5d9eb32..087db5f 100644 --- a/test cases/linuxlike/5 dependency versions/meson.build +++ b/test cases/linuxlike/5 dependency versions/meson.build @@ -50,6 +50,12 @@ assert(somelib_reqfalse.found(), 'somelib should have been found') somelibver = dependency('somelib', version : '>= 0.3', fallback : ['somelibver', 'some_dep']) +# Find an internal dependency again with impossible multi-version +somelibver = dependency('somelib', + version : ['>= 0.3', '<0.3'], + required : false, + fallback : ['somelibver', 'some_dep']) +assert(not somelibver.found(), 'Dependency should not be found') # Find somelib again, but with a fallback that will fail because subproject does not exist somelibfail = dependency('somelib', version : '>= 0.2', |