Do not cache found programs because it is unreliable. Closes #374.
This commit is contained in:
parent
72a94c13f2
commit
fc08f60b9f
|
@ -154,7 +154,6 @@ class CoreData():
|
|||
self.compilers = {}
|
||||
self.cross_compilers = {}
|
||||
self.deps = {}
|
||||
self.ext_progs = {}
|
||||
self.modules = {}
|
||||
|
||||
def init_builtins(self, options):
|
||||
|
|
|
@ -1497,14 +1497,12 @@ class Interpreter():
|
|||
if not isinstance(required, bool):
|
||||
raise InvalidArguments('"required" argument must be a boolean.')
|
||||
exename = args[0]
|
||||
if exename in self.coredata.ext_progs and\
|
||||
self.coredata.ext_progs[exename].found():
|
||||
return ExternalProgramHolder(self.coredata.ext_progs[exename])
|
||||
# Search for scripts relative to current subdir.
|
||||
# Do not cache found programs because find_program('foobar')
|
||||
# might give different results when run from different source dirs.
|
||||
search_dir = os.path.join(self.environment.get_source_dir(), self.subdir)
|
||||
extprog = dependencies.ExternalProgram(exename, search_dir=search_dir)
|
||||
progobj = ExternalProgramHolder(extprog)
|
||||
self.coredata.ext_progs[exename] = extprog
|
||||
if required and not progobj.found():
|
||||
raise InvalidArguments('Program "%s" not found.' % exename)
|
||||
return progobj
|
||||
|
|
Loading…
Reference in New Issue