mac_app.py   mac_app.py 
skipping to change at line 61 skipping to change at line 61
output, oerr = process.communicate() output, oerr = process.communicate()
for line in output.split('\n'): for line in output.split('\n'):
line = line.strip() line = line.strip()
if line.find('Qt') is not -1: if line.find('Qt') is not -1:
frameworks.append(line[:line.find(' ')]) frameworks.append(line[:line.find(' ')])
return frameworks return frameworks
def copyFrameworkToApp(framework): def copyFrameworkToApp(framework):
''' '''
Copy the Qt framework into the bundle. Copy the Qt framework into the bundle.
NOTE: OS X 10.11 changes things, and the framework now has @rpath, n
ot the absolute path.
''' '''
frameworkRoot = os.path.split(os.path.split(os.path.split(framework) # print('%s' % framework)
[0])[0])[0] if '@rpath' in framework:
frameworkName = os.path.split(frameworkRoot)[1] frameworkRoot = os.path.split(os.path.split(os.path.split(fr
target = os.path.join(installDirectory, 'Frameworks', frameworkName) amework)[0])[0])[0]
if not os.path.exists(target): beginPosition = framework.index('/') + 1
shutil.copytree(frameworkRoot, target, symlinks=True, ignore endPosition = framework.index('/', beginPosition)
=shutil.ignore_patterns('*debug*')) frameworkName = framework[beginPosition:endPosition]
# print('====> %s : %s' % (frameworkName, qtFrameworksDirect
ory))
else:
frameworkRoot = os.path.split(os.path.split(os.path.split(fr
amework)[0])[0])[0]
frameworkName = os.path.split(frameworkRoot)[1]
if frameworkName != 'Qt':
target = os.path.join(installDirectory, 'Frameworks', framew
orkName)
if not os.path.exists(target):
shutil.copytree(os.path.join(qtFrameworksDirectory,
frameworkName), target, symlinks=True, ignore=shutil.ignore_patterns('*debu
g*', 'Headers', '*.prl'))
def updateName(file): def updateName(file):
''' '''
file is expected to be the path as output from tool file is expected to be the path as output from tool
''' '''
base = file[file.find(file[file.rfind('/'):]) + 1:] base = file[file.find(file[file.rfind('/'):]) + 1:]
args = ['install_name_tool', '-id', '@executable_path/../Frameworks/ ' + base, os.path.join(installDirectory, 'Frameworks', base)] args = ['install_name_tool', '-id', '@executable_path/../Frameworks/ ' + base, os.path.join(installDirectory, 'Frameworks', base)]
# print(args) # print(args)
process = Popen(args, stdout=PIPE, stderr=PIPE) process = Popen(args, stdout=PIPE, stderr=PIPE)
output, oerr = process.communicate() output, oerr = process.communicate()
if process.returncode != 0: if process.returncode != 0:
print('Error updating name.\n%s\n%s' % (output, oerr)) print('Error updating name.\n%s\n%s' % (output, oerr))
def updateLibraryPath(file, where): def updateLibraryPath(file, where):
''' '''
file is expected to be the path as output from otool file is expected to be the path as output from otool
'where' is the path relative to the installDirectory 'where' is the path relative to the installDirectory
''' '''
base = '' base = ''
if '@rpath' in file:
file = file[file.find('/') + 1:]
file = os.path.join(installDirectory, 'Frameworks', file)
if file.endswith('dylib') or file == 'stellarium': if file.endswith('dylib') or file == 'stellarium':
base = file base = file
file = os.path.join(installDirectory, where, file) file = os.path.join(installDirectory, where, file)
else: else:
base = file[file.find(file[file.rfind('/'):]) + 1:] base = file[file.find(file[file.rfind('/'):]) + 1:]
args = ['install_name_tool', '-change', '', '', os.path.join(install Directory, where, base )] args = ['install_name_tool', '-change', '', '', os.path.join(install Directory, where, base )]
for framework in getListOfLinkedQtFrameworksForFile(file): for framework in getListOfLinkedQtFrameworksForFile(file):
# otool adds self, so ignore it # otool adds self, so ignore it
if not framework == file: if not framework == file:
args[2] = framework args[2] = framework
args[3] = '@executable_path/../Frameworks' + framewo rk[framework.find(framework[framework.rfind('/'):]):] args[3] = '@executable_path/../Frameworks' + framewo rk[framework.find(framework[framework.rfind('/'):]):]
# print(args) #print(args)
process = Popen(args, stdout=PIPE, stderr=PIPE) process = Popen(args, stdout=PIPE, stderr=PIPE)
output, oerr = process.communicate() output, oerr = process.communicate()
if process.returncode != 0: if process.returncode != 0:
print('Error updating name.\n%s\n%s' % (outp ut, oerr)) print('Error updating name.\n%s\n%s' % (outp ut, oerr))
def processFrameworks(): def processFrameworks():
''' '''
Copies over and process all linked Qt frameworks. Copies over and process all linked Qt frameworks.
''' '''
frameworkDirectory = os.path.join(installDirectory, 'Frameworks') frameworkDirectory = os.path.join(installDirectory, 'Frameworks')
skipping to change at line 125 skipping to change at line 141
for framework in frameworks: for framework in frameworks:
copyFrameworkToApp(framework) copyFrameworkToApp(framework)
allFramework.append(framework) allFramework.append(framework)
# Now copy over any of the framework's dependencies themselves # Now copy over any of the framework's dependencies themselves
for framework in frameworks: for framework in frameworks:
for dependentFramework in getListOfLinkedQtFrameworksForFile (framework): for dependentFramework in getListOfLinkedQtFrameworksForFile (framework):
copyFrameworkToApp(dependentFramework) copyFrameworkToApp(dependentFramework)
allFramework.append(dependentFramework) allFramework.append(dependentFramework)
# for framework in set(allFramework): # for framework in set(allFramework):
updateName(framework) updateName(framework)
print('Processing %s' % framework)
updateLibraryPath(framework, 'Frameworks') updateLibraryPath(framework, 'Frameworks')
def copyPluginDirectory(pluginDirectoryName): def copyPluginDirectory(pluginDirectoryName):
''' '''
Utility function to be called by processPlugins(). Utility function to be called by processPlugins().
pluginDirectoryName is the name of a plugins subdirectory to copy ov er. pluginDirectoryName is the name of a plugins subdirectory to copy ov er.
''' '''
pluginsDirectory = os.path.join(installDirectory, 'plugins') pluginsDirectory = os.path.join(installDirectory, 'plugins')
toDir = os.path.join(pluginsDirectory, pluginDirectoryName) toDir = os.path.join(pluginsDirectory, pluginDirectoryName)
 End of changes. 6 change blocks. 
8 lines changed or deleted 30 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/