Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def locate(self, filename):
assert isinstance(filename, (str, unicode))
fn = self.trans_table.get(filename)
if fn is None:
try:
fn = dyld_find(filename, env=self.env,
executable_path=self.executable_path)
self.trans_table[filename] = fn
except ValueError:
return None
return fn
def locate(self, filename):
assert isinstance(filename, (str, unicode))
fn = self.trans_table.get(filename)
if fn is None:
try:
fn = dyld_find(filename, env=self.env,
executable_path=self.executable_path)
self.trans_table[filename] = fn
except ValueError:
return None
return fn
final_lib = os.path.abspath(os.path.join(run_path, lib))
rslt.add(final_lib)
break
# Log error if no existing file found.
if not final_lib:
logger.error('Can not find path %s (needed by %s)', lib, pth)
# Macholib has to be used to get absolute path to libraries.
else:
# macholib can't handle @loader_path. It has to be
# handled the same way as @executable_path.
# It is also replaced by 'exec_path'.
if lib.startswith('@loader_path'):
lib = lib.replace('@loader_path', '@executable_path')
try:
lib = dyld_find(lib, executable_path=exec_path)
rslt.add(lib)
except ValueError:
logger.error('Can not find path %s (needed by %s)', lib, pth)
return rslt
if filename.startswith('@loader_path/') and loader is not None:
fn = self.trans_table.get((loader.filename, filename))
if fn is None:
try:
fn = dyld_find(filename, env=self.env,
executable_path=self.executable_path,
loader=loader.filename)
self.trans_table[(loader.filename, filename)] = fn
except ValueError:
return None
else:
fn = self.trans_table.get(filename)
if fn is None:
try:
fn = dyld_find(filename, env=self.env,
executable_path=self.executable_path)
self.trans_table[filename] = fn
except ValueError:
return None
return fn