All: Fix small bugs in deploy-mac.py when using a root

This commit is contained in:
Jeffrey Pfau 2014-12-27 18:32:33 -08:00
parent 27eb75fcde
commit 444d703e90

View File

@ -60,26 +60,25 @@ def parseOtoolLine(line, execPath, root):
newExecPath = ['@executable_path', '..', 'Frameworks'] newExecPath = ['@executable_path', '..', 'Frameworks']
newPath = execPath[:-1] newPath = execPath[:-1]
newPath.append('Frameworks') newPath.append('Frameworks')
if split[0] == '/': if split[:3] == ['/', 'usr', 'lib'] or split[:2] == ['/', 'System']:
split[:1] = root return None, None, None, None
if split[0] == '@executable_path': if split[0] == '@executable_path':
split[:1] = execPath split[:1] = execPath
if split[:3] == ['/', 'usr', 'lib'] or split[:2] == ['/', 'System']: if split[0] == '/' and not os.access(joinPath(split), os.F_OK):
newPath = None print(split)
newExecPath = None split[:1] = root
else: isFramework = False
isFramework = False if not split[-1].endswith('.dylib'):
if not split[-1].endswith('.dylib'): isFramework = True
isFramework = True split, framework = findFramework(split)
split, framework = findFramework(split) newPath.append(split[-1])
newPath.append(split[-1]) newExecPath.append(split[-1])
newExecPath.append(split[-1]) if isFramework:
if isFramework: newPath.extend(framework)
newPath.extend(framework) newExecPath.extend(framework)
newExecPath.extend(framework) split.extend(framework)
split.extend(framework) newPath = joinPath(newPath)
newPath = joinPath(newPath) newExecPath = joinPath(newExecPath)
newExecPath = joinPath(newExecPath)
return joinPath(split), newPath, path, newExecPath return joinPath(split), newPath, path, newExecPath
def updateMachO(bin, execPath, root): def updateMachO(bin, execPath, root):
@ -133,7 +132,7 @@ if __name__ == '__main__':
if executable.endswith('.dSYM'): if executable.endswith('.dSYM'):
continue continue
fullPath = os.path.join(args.bundle, 'Contents/MacOS/', executable) fullPath = os.path.join(args.bundle, 'Contents/MacOS/', executable)
updateMachO(fullPath, splitPath(os.path.join(args.bundle, 'Contents/MacOS')), args.root) updateMachO(fullPath, splitPath(os.path.join(args.bundle, 'Contents/MacOS')), splitPath(args.root))
if args.qt_plugins: if args.qt_plugins:
try: try:
shutil.rmtree(os.path.join(args.bundle, 'Contents/PlugIns/')) shutil.rmtree(os.path.join(args.bundle, 'Contents/PlugIns/'))
@ -152,4 +151,4 @@ if __name__ == '__main__':
makedirs(newDir) makedirs(newDir)
newPath = os.path.join(newDir, plug) newPath = os.path.join(newDir, plug)
shutil.copy2(os.path.join(qtPath, 'plugins', plugin), newPath) shutil.copy2(os.path.join(qtPath, 'plugins', plugin), newPath)
updateMachO(newPath, splitPath(os.path.join(args.bundle, 'Contents/MacOS')), args.root) updateMachO(newPath, splitPath(os.path.join(args.bundle, 'Contents/MacOS')), splitPath(args.root))