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.
pull/9531/head
Dylan Baker 3 years ago
parent 5593352b87
commit 822b087f24
  1. 6
      mesonbuild/interpreter/interpreter.py
  2. 2
      mesonbuild/interpreter/mesonmain.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)

@ -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)

Loading…
Cancel
Save