Do not cache paths of found external libraries. Closes #312.

pull/319/head
Jussi Pakkanen 9 years ago
parent 1caf7e6f4a
commit 06c7cef26e
  1. 1
      coredata.py
  2. 12
      interpreter.py

@ -155,7 +155,6 @@ class CoreData():
self.cross_compilers = {}
self.deps = {}
self.ext_progs = {}
self.ext_libs = {}
self.modules = {}
def init_builtins(self, options):

@ -1527,9 +1527,14 @@ class Interpreter():
if not isinstance(required, bool):
raise InvalidArguments('"required" argument must be a boolean.')
libname = args[0]
if libname in self.coredata.ext_libs and\
self.coredata.ext_libs[libname].found():
return ExternalLibraryHolder(self.coredata.ext_libs[libname])
# We do not cache found libraries because they can come
# and go between invocations wildly. As an example we
# may find the 64 bit version but need instead the 32 bit
# one that is not installed. If we cache the found path
# then we will never found the new one if it get installed.
# This causes a bit of a slowdown as libraries are rechecked
# on every regen, but since it is a fast operation it should be
# ok.
if 'dirs' in kwargs:
search_dirs = kwargs['dirs']
if not isinstance(search_dirs, list):
@ -1544,7 +1549,6 @@ class Interpreter():
result = self.environment.find_library(libname, search_dirs)
extlib = dependencies.ExternalLibrary(libname, result)
libobj = ExternalLibraryHolder(extlib)
self.coredata.ext_libs[libname] = extlib
if required and not libobj.found():
raise InvalidArguments('External library "%s" not found.' % libname)
return libobj

Loading…
Cancel
Save