From 822b087f2496ab06e71d7c0a7f85fb36fd01f16d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 4 Nov 2021 12:32:25 -0700 Subject: [PATCH] interpreter: use find_program_impl internally instead of func_find_program Calling interpreter implementation methods is just a bad idea, apart from the extra type checking that goes into it, we need to pass more arguments than we need to calling the impl method. --- mesonbuild/interpreter/interpreter.py | 6 +++--- mesonbuild/interpreter/mesonmain.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index b11a0009d..3fb0fc377 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1751,7 +1751,7 @@ This will become a hard error in the future.''', location=self.current_node) kwargs['env'] = self.unpack_env_kwarg(kwargs) if 'command' in kwargs and isinstance(kwargs['command'], list) and kwargs['command']: if isinstance(kwargs['command'][0], str): - kwargs['command'][0] = self.func_find_program(node, kwargs['command'][0], {}) + kwargs['command'][0] = self.find_program_impl([kwargs['command'][0]]) tg = build.CustomTarget(name, self.subdir, self.subproject, kwargs, backend=self.backend) self.add_target(tg.name, tg) return tg @@ -1771,7 +1771,7 @@ This will become a hard error in the future.''', location=self.current_node) if isinstance(i, ExternalProgram) and not i.found(): raise InterpreterException(f'Tried to use non-existing executable {i.name!r}') if isinstance(all_args[0], str): - all_args[0] = self.func_find_program(node, all_args[0], {}) + all_args[0] = self.find_program_impl([all_args[0]]) name = args[0] tg = build.RunTarget(name, all_args, kwargs['depends'], self.subdir, self.subproject, kwargs['env']) self.add_target(name, tg) @@ -1849,7 +1849,7 @@ This will become a hard error in the future.''', location=self.current_node) name = name.replace(':', '_') exe = args[1] if isinstance(exe, mesonlib.File): - exe = self.func_find_program(node, args[1], {}) + exe = self.find_program_impl([exe]) env = self.unpack_env_kwarg(kwargs) diff --git a/mesonbuild/interpreter/mesonmain.py b/mesonbuild/interpreter/mesonmain.py index adc342f29..e973c5d12 100644 --- a/mesonbuild/interpreter/mesonmain.py +++ b/mesonbuild/interpreter/mesonmain.py @@ -86,7 +86,7 @@ class MesonMain(MesonInterpreterObject): largs.append(prog) largs.extend(args) return self.interpreter.backend.get_executable_serialisation(largs) - found = self.interpreter.func_find_program({}, prog, {}) + found = self.interpreter.find_program_impl([prog]) largs.append(found) largs.extend(args) es = self.interpreter.backend.get_executable_serialisation(largs)