From 4e939bcf8ad7e52853877f39b582ce0ed7cdd423 Mon Sep 17 00:00:00 2001 From: Jan Niklas Hasse Date: Wed, 3 Apr 2019 16:44:49 +0200 Subject: [PATCH] Use ExternalProgram to find config tools, fix #1423 Needed for wx-config on Windows. --- mesonbuild/dependencies/base.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index af4b13fad..ddc56fcaf 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -419,6 +419,14 @@ class ConfigToolDependency(ExternalDependency): best_match = (None, None) for tool in tools: + if len(tool) == 1: + # In some situations the command can't be directly executed. + # For example Shell scripts need to be called through sh on + # Windows (see issue #1423). + potential_bin = ExternalProgram(tool[0], silent=True) + if not potential_bin.found(): + continue + tool = potential_bin.get_command() try: p, out = Popen_safe(tool + ['--version'])[:2] except (FileNotFoundError, PermissionError): @@ -459,7 +467,7 @@ class ConfigToolDependency(ExternalDependency): elif req_version: found_msg.append('need {!r}'.format(req_version)) else: - found_msg += [mlog.green('YES'), '({})'.format(shutil.which(self.config[0])), version] + found_msg += [mlog.green('YES'), '({})'.format(' '.join(self.config)), version] mlog.log(*found_msg)