in scripts/buildsystems/osx/applocal.py [0:0]
def normalize_loaderpath_name(filename):
"""
input: a path to a loaderpath library, as returned by otool, that can have this form :
- an relative path @loaderpath/yyy
output:
a tuple (loaderpathlib, abspath, rpath) where:
- loaderpathlib is the name of the loaderpath lib
- abspath is the absolute path of the qt lib inside the app bundle of exepath
- relpath is the correct rpath to a qt lib inside the app bundle
"""
GlobalConfig.logger.debug('normalize_loaderpath_name({0})'.format(filename))
loaderpath_name_rgx = re.compile(LOADERPATH_REGEX)
rgxret = loaderpath_name_rgx.match(filename)
if not rgxret:
msg = 'couldn\'t normalize a loaderpath lib filename: {0}'.format(filename)
GlobalConfig.logger.critical(msg)
raise Exception(msg)
# loaderpath normalization settings
loaderpathlib = rgxret.groups()[0]
templ = Template(LOADERPATH_NORMALIZED)
# from loaderpath, forge 2 path :
# - absolute path of qt lib in bundle,
abspath = os.path.normpath(templ.safe_substitute(
prefix=os.path.dirname(GlobalConfig.exepath) + '/..',
loaderpathlib=loaderpathlib))
# - and rpath containing @executable_path, relative to exepath
rpath = templ.safe_substitute(
prefix='@executable_path/..',
loaderpathlib=loaderpathlib)
GlobalConfig.logger.debug('\treturns({0})'.format((loaderpathlib, abspath, rpath)))
return loaderpathlib, abspath, rpath