aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-10-10 17:23:34 -0400
committerEli Schwartz <eschwartz@archlinux.org>2021-10-10 18:20:45 -0400
commitdfa19af0ae346bb24d0e20ab7d9e22f4cded6f3b (patch)
tree87c92ebfcc44b3939bcdb5280600b24cd82a667d /mesonbuild/dependencies
parent437745b0287873270a3e34d68000654a23084308 (diff)
downloadmeson-dfa19af0ae346bb24d0e20ab7d9e22f4cded6f3b.zip
meson-dfa19af0ae346bb24d0e20ab7d9e22f4cded6f3b.tar.gz
meson-dfa19af0ae346bb24d0e20ab7d9e22f4cded6f3b.tar.bz2
simplify some log formatting by splitting out a commonly used format string
There are a bunch of cases in a single function where we would want to log the detected path of pkg-config. Formatting this is awkward. Define it once, then use f-strings everywhere. :D
Diffstat (limited to 'mesonbuild/dependencies')
-rw-r--r--mesonbuild/dependencies/pkgconfig.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py
index a7ba603..da1d72f 100644
--- a/mesonbuild/dependencies/pkgconfig.py
+++ b/mesonbuild/dependencies/pkgconfig.py
@@ -423,18 +423,17 @@ class PkgConfigDependency(ExternalDependency):
if not pkgbin.found():
mlog.log(f'Did not find pkg-config by name {pkgbin.name!r}')
return None
+ command_as_string = ' '.join(pkgbin.get_command())
try:
p, out = Popen_safe(pkgbin.get_command() + ['--version'])[0:2]
if p.returncode != 0:
- mlog.warning('Found pkg-config {!r} but it failed when run'
- ''.format(' '.join(pkgbin.get_command())))
+ mlog.warning(f'Found pkg-config {command_as_string!r} but it failed when run')
return None
except FileNotFoundError:
- mlog.warning('We thought we found pkg-config {!r} but now it\'s not there. How odd!'
- ''.format(' '.join(pkgbin.get_command())))
+ mlog.warning(f'We thought we found pkg-config {command_as_string!r} but now it\'s not there. How odd!')
return None
except PermissionError:
- msg = 'Found pkg-config {!r} but didn\'t have permissions to run it.'.format(' '.join(pkgbin.get_command()))
+ msg = f'Found pkg-config {command_as_string!r} but didn\'t have permissions to run it.'
if not self.env.machines.build.is_windows():
msg += '\n\nOn Unix-like systems this is often caused by scripts that are not executable.'
mlog.warning(msg)