aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-12-31 09:51:33 -0500
committerXavier Claessens <xclaesse@gmail.com>2019-01-16 11:16:46 -0500
commitcb20f3104ebff50f67f28de16909b3fe979797e4 (patch)
treec2fa295590f4f07dc3479360b4ae2bff1ca05efd
parent83766b3687b3d639af5175e9b1dc8fd039659b55 (diff)
downloadmeson-cb20f3104ebff50f67f28de16909b3fe979797e4.zip
meson-cb20f3104ebff50f67f28de16909b3fe979797e4.tar.gz
meson-cb20f3104ebff50f67f28de16909b3fe979797e4.tar.bz2
ConfigTool: Avoid None being printed in logs
When req_version is None (e.g. pcap-config case) it gets printed in the logs. Take this opportunity to reformat the message to look more like ExternalProgram messages.
-rw-r--r--mesonbuild/dependencies/base.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index e9f778b..c7556e1 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -437,17 +437,21 @@ class ConfigToolDependency(ExternalDependency):
def report_config(self, version, req_version):
"""Helper method to print messages about the tool."""
+
+ found_msg = [mlog.bold(self.tool_name), 'found:']
+
if self.config is None:
- if version is not None:
- mlog.log('Found', mlog.bold(self.tool_name), repr(version),
- mlog.red('NO'), '(needed', req_version, ')')
- else:
- mlog.log('Found', mlog.bold(self.tool_name), repr(req_version),
- mlog.red('NO'))
- return False
- mlog.log('Found {}:'.format(self.tool_name), mlog.bold(shutil.which(self.config[0])),
- '({})'.format(version))
- return True
+ found_msg.append(mlog.red('NO'))
+ if version is not None and req_version is not None:
+ found_msg.append('found {!r} but need {!r}'.format(version, req_version))
+ elif req_version:
+ found_msg.append('need {!r}'.format(req_version))
+ else:
+ found_msg += [mlog.green('YES'), '({})'.format(shutil.which(self.config[0])), version]
+
+ mlog.log(*found_msg)
+
+ return self.config is not None
def get_config_value(self, args, stage):
p, out, err = Popen_safe(self.config + args)
@@ -825,10 +829,10 @@ class PkgConfigDependency(ExternalDependency):
pkgbin = False
if not self.silent:
if pkgbin:
- mlog.log('Found pkg-config:', mlog.bold(pkgbin.get_path()),
- '(%s)' % out.strip())
+ mlog.log(mlog.bold('pkg-config'), 'found:', mlog.green('YES'), '({})'.format(pkgbin.get_path()),
+ out.strip())
else:
- mlog.log('Found Pkg-config:', mlog.red('NO'))
+ mlog.log(mlog.bold('pkg-config'), 'found:', mlog.red('NO'))
return pkgbin
def extract_field(self, la_file, fieldname):