From 2729958e612e393f8850a4acec0a45494a57fb08 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 13 Mar 2021 12:46:45 +0200 Subject: Use find_program also in add_*_script for consistency. --- mesonbuild/interpreter.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 652fd3e..e824725 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1878,7 +1878,6 @@ class MesonMain(InterpreterObject): InterpreterObject.__init__(self) self.build = build self.interpreter = interpreter - self._found_source_scripts = {} self.methods.update({'get_compiler': self.get_compiler_method, 'is_cross_build': self.is_cross_build_method, 'has_exe_wrapper': self.has_exe_wrapper_method, @@ -1908,25 +1907,10 @@ class MesonMain(InterpreterObject): }) def _find_source_script(self, prog: T.Union[str, mesonlib.File, ExecutableHolder], args): + if isinstance(prog, (ExecutableHolder, ExternalProgramHolder)): return self.interpreter.backend.get_executable_serialisation([unholder(prog)] + args) - # Prefer scripts in the current source directory - search_dir = os.path.join(self.interpreter.environment.source_dir, - self.interpreter.subdir) - key = (prog, search_dir) - if key in self._found_source_scripts: - found = self._found_source_scripts[key] - elif isinstance(prog, mesonlib.File): - prog = prog.rel_to_builddir(self.interpreter.environment.source_dir) - found = dependencies.ExternalProgram(prog, search_dir=self.interpreter.environment.build_dir) - else: - found = dependencies.ExternalProgram(prog, search_dir=search_dir) - - if found.found(): - self._found_source_scripts[key] = found - else: - m = 'Script or command {!r} not found or not executable' - raise InterpreterException(m.format(prog)) + found = self.interpreter.func_find_program({}, prog, {}).held_object es = self.interpreter.backend.get_executable_serialisation([found] + args) es.subproject = self.interpreter.subproject return es -- cgit v1.1