aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-07-28 21:11:34 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2016-07-28 21:11:45 +0530
commitbaf8481c4f8835b9c9bdaa6e82946ee123127394 (patch)
treeaf9478e5b86bc53c650fd1a51bd0648fd75fb5c2 /mesonbuild/dependencies.py
parent48b4defa3781dac7bd9bf7988664c9de4f576a07 (diff)
downloadmeson-baf8481c4f8835b9c9bdaa6e82946ee123127394.zip
meson-baf8481c4f8835b9c9bdaa6e82946ee123127394.tar.gz
meson-baf8481c4f8835b9c9bdaa6e82946ee123127394.tar.bz2
pkg-config: Print 'NO' when version is too old
This gives a clearer output when the dependency is not required or has a fallback subproject otherwise the user is left wondering why the optional dependency wasn't used or why the fallback subproject is being used.
Diffstat (limited to 'mesonbuild/dependencies.py')
-rw-r--r--mesonbuild/dependencies.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index bfcc420..3f1e214 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -124,8 +124,7 @@ class PkgConfigDependency(Dependency):
self.modversion = 'none'
return
self.modversion = out.decode().strip()
- mlog.log('%s dependency' % self.type_string, mlog.bold(name), 'found:',
- mlog.green('YES'), self.modversion)
+ found_msg = ['%s dependency' % self.type_string, mlog.bold(name), 'found:']
self.version_requirement = kwargs.get('version', None)
if self.version_requirement is None:
self.is_found = True
@@ -133,12 +132,17 @@ class PkgConfigDependency(Dependency):
if not isinstance(self.version_requirement, str):
raise DependencyException('Version argument must be string.')
self.is_found = mesonlib.version_compare(self.modversion, self.version_requirement)
- if not self.is_found and self.required:
- raise DependencyException(
- 'Invalid version of a dependency, needed %s %s found %s.' %
- (name, self.version_requirement, self.modversion))
- if not self.is_found:
- return
+ if not self.is_found:
+ found_msg += [mlog.red('NO'), 'found {!r}'.format(self.modversion),
+ 'but need {!r}'.format(self.version_requirement)]
+ mlog.log(*found_msg)
+ if self.required:
+ raise DependencyException(
+ 'Invalid version of a dependency, needed %s %s found %s.' %
+ (name, self.version_requirement, self.modversion))
+ return
+ found_msg += [mlog.green('YES'), self.modversion]
+ mlog.log(*found_msg)
# Fetch cargs to be used while using this dependency
self._set_cargs()
# Fetch the libraries and library paths needed for using this