aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-03-13 12:46:45 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2021-03-13 13:42:41 +0200
commit2729958e612e393f8850a4acec0a45494a57fb08 (patch)
tree499db92f1481219e78851bcdf20d0c5dbfc3b952
parent005e50c2160a792f92d854d1adb2c9784268cb7a (diff)
downloadmeson-progrefactor.zip
meson-progrefactor.tar.gz
meson-progrefactor.tar.bz2
Use find_program also in add_*_script for consistency.progrefactor
-rw-r--r--mesonbuild/interpreter.py20
1 files 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