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.
This commit is contained in:
parent
83766b3687
commit
cb20f3104e
|
@ -437,17 +437,21 @@ class ConfigToolDependency(ExternalDependency):
|
||||||
|
|
||||||
def report_config(self, version, req_version):
|
def report_config(self, version, req_version):
|
||||||
"""Helper method to print messages about the tool."""
|
"""Helper method to print messages about the tool."""
|
||||||
|
|
||||||
|
found_msg = [mlog.bold(self.tool_name), 'found:']
|
||||||
|
|
||||||
if self.config is None:
|
if self.config is None:
|
||||||
if version is not None:
|
found_msg.append(mlog.red('NO'))
|
||||||
mlog.log('Found', mlog.bold(self.tool_name), repr(version),
|
if version is not None and req_version is not None:
|
||||||
mlog.red('NO'), '(needed', req_version, ')')
|
found_msg.append('found {!r} but need {!r}'.format(version, req_version))
|
||||||
else:
|
elif req_version:
|
||||||
mlog.log('Found', mlog.bold(self.tool_name), repr(req_version),
|
found_msg.append('need {!r}'.format(req_version))
|
||||||
mlog.red('NO'))
|
else:
|
||||||
return False
|
found_msg += [mlog.green('YES'), '({})'.format(shutil.which(self.config[0])), version]
|
||||||
mlog.log('Found {}:'.format(self.tool_name), mlog.bold(shutil.which(self.config[0])),
|
|
||||||
'({})'.format(version))
|
mlog.log(*found_msg)
|
||||||
return True
|
|
||||||
|
return self.config is not None
|
||||||
|
|
||||||
def get_config_value(self, args, stage):
|
def get_config_value(self, args, stage):
|
||||||
p, out, err = Popen_safe(self.config + args)
|
p, out, err = Popen_safe(self.config + args)
|
||||||
|
@ -825,10 +829,10 @@ class PkgConfigDependency(ExternalDependency):
|
||||||
pkgbin = False
|
pkgbin = False
|
||||||
if not self.silent:
|
if not self.silent:
|
||||||
if pkgbin:
|
if pkgbin:
|
||||||
mlog.log('Found pkg-config:', mlog.bold(pkgbin.get_path()),
|
mlog.log(mlog.bold('pkg-config'), 'found:', mlog.green('YES'), '({})'.format(pkgbin.get_path()),
|
||||||
'(%s)' % out.strip())
|
out.strip())
|
||||||
else:
|
else:
|
||||||
mlog.log('Found Pkg-config:', mlog.red('NO'))
|
mlog.log(mlog.bold('pkg-config'), 'found:', mlog.red('NO'))
|
||||||
return pkgbin
|
return pkgbin
|
||||||
|
|
||||||
def extract_field(self, la_file, fieldname):
|
def extract_field(self, la_file, fieldname):
|
||||||
|
|
Loading…
Reference in New Issue