X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=scripts%2Fbuild%2Fmacosx_DeployApp.py;h=a46b5dca4184d59fe792d782761b121b7f810a48;hp=4be32f7fdd0efd79a7c8c14dfae446838e08fd0e;hb=cf17ae38dd425697d0d8e22d50fb16f2bc821df6;hpb=335e3cf6203327b3ce1ee6e47c09a8139232317c diff --git a/scripts/build/macosx_DeployApp.py b/scripts/build/macosx_DeployApp.py index 4be32f7f..a46b5dca 100755 --- a/scripts/build/macosx_DeployApp.py +++ b/scripts/build/macosx_DeployApp.py @@ -16,6 +16,8 @@ import sys import os +from subprocess import Popen, PIPE + class InstallQt(object): def __init__(self, appdir, bundle = True): self.appDir = appdir @@ -31,6 +33,8 @@ class InstallQt(object): self.needFrameworks = [] + self.findFrameworkPath() + executables = [self.executableDir + "/" + executable for executable in os.listdir(self.executableDir)] for executable in executables: @@ -40,12 +44,22 @@ class InstallQt(object): self.installFramework(framework) self.changeDylPath(executable) + def findFrameworkPath(self): + otoolProcess = Popen('qmake -query QT_INSTALL_LIBS', shell=True, stdout=PIPE, stderr=PIPE) + self.sourceFrameworkPath = otoolProcess.stdout.read().strip() + otoolProcess.stdout.close() + otoolProcess.wait() + + def installFramework(self, framework): try: os.mkdir(self.frameworkDir) except: pass + if not framework.startswith('/'): + framework = "%s/%s" % (self.sourceFrameworkPath, framework) + # Copy Framework os.system('cp -R "%s" "%s"' % (framework, self.frameworkDir)) @@ -59,9 +73,14 @@ class InstallQt(object): # Install new Lib ID and Change Path to Frameworks for the Dynamic linker for lib in os.listdir(localframework + "/Versions/Current"): lib = "%s/Versions/Current/%s" % (localframework, lib) - otoolpipe = os.popen('otool -D "%s"' % lib) - libname = [line for line in otoolpipe][1].strip() - otoolpipe.close() + otoolProcess = Popen('otool -D "%s"' % lib, shell=True, stdout=PIPE, stderr=PIPE) + try: + libname = [line for line in otoolProcess.stdout][1].strip() + except: + libname = '' + otoolProcess.stdout.close() + if otoolProcess.wait() == 1: # we found some Resource dir or similar -> skip + continue frameworkpath, libpath = libname.split(frameworkname) if self.bundle: newlibname = "@executable_path/../%s%s" % (frameworkname, libpath) @@ -72,7 +91,7 @@ class InstallQt(object): self.changeDylPath(lib) def determineDependancies(self, app): - otoolPipe = os.popen('otool -L "%s"' % app) + otoolPipe = Popen('otool -L "%s"' % app, shell=True, stdout=PIPE).stdout otoolOutput = [line for line in otoolPipe] otoolPipe.close() libs = [line.split()[0] for line in otoolOutput[1:] if "Qt" in line and not "@executable_path" in line]