mac_app.py   mac_app.py 
skipping to change at line 19 skipping to change at line 19
# Copyright (C) 2013 Timothy Reaves # Copyright (C) 2013 Timothy Reaves
# Copyright (C) 2014 Alexander Wolf # Copyright (C) 2014 Alexander Wolf
import os import os
import shutil import shutil
import sys import sys
from subprocess import Popen from subprocess import Popen
from subprocess import PIPE from subprocess import PIPE
installDirectory = None installDirectory = None
qmlDirectory = None
qtFrameworksDirectory = None qtFrameworksDirectory = None
qtPluginsDirectory = None qtPluginsDirectory = None
sourceDirectory = None sourceDirectory = None
def processResources(): def processResources():
''' '''
Copy over all required resources. Copy over all required resources.
''' '''
# rename resources folder # rename resources folder
resourcesDirectory = os.path.join(installDirectory, 'Resources') resourcesDirectory = os.path.join(installDirectory, 'Resources')
skipping to change at line 173 skipping to change at line 172
''' '''
Copies over and process all Qt plugins. Copies over and process all Qt plugins.
''' '''
#Setup the plugin directory #Setup the plugin directory
pluginsDirectory = os.path.join(installDirectory, 'plugins') pluginsDirectory = os.path.join(installDirectory, 'plugins')
os.mkdir(pluginsDirectory) os.mkdir(pluginsDirectory)
# copy over image plugins # copy over image plugins
copyPluginDirectory('imageformats') copyPluginDirectory('imageformats')
copyPluginDirectory('iconengines') copyPluginDirectory('iconengines')
copyPluginDirectory('qmltooling')
# check multimedia support # check multimedia support
if 'QtMultimedia' in ' '.join(getListOfLinkedQtFrameworksForFile(os. path.join(installDirectory, 'MacOS/stellarium'))): if 'QtMultimedia' in ' '.join(getListOfLinkedQtFrameworksForFile(os. path.join(installDirectory, 'MacOS/stellarium'))):
copyPluginDirectory('mediaservice') copyPluginDirectory('mediaservice')
copyPluginDirectory('audio') copyPluginDirectory('audio')
# copy over the Cocoa platform plugin; we do single one here, as we do not want every platform # copy over the Cocoa platform plugin; we do single one here, as we do not want every platform
os.mkdir(os.path.join(pluginsDirectory, 'platforms')) os.mkdir(os.path.join(pluginsDirectory, 'platforms'))
shutil.copy(os.path.join(qtPluginsDirectory, 'platforms', 'libqcocoa .dylib'), os.path.join(pluginsDirectory, 'platforms')) shutil.copy(os.path.join(qtPluginsDirectory, 'platforms', 'libqcocoa .dylib'), os.path.join(pluginsDirectory, 'platforms'))
for framework in getListOfLinkedQtFrameworksForFile(os.path.join(plu ginsDirectory, 'platforms', 'libqcocoa.dylib')): for framework in getListOfLinkedQtFrameworksForFile(os.path.join(plu ginsDirectory, 'platforms', 'libqcocoa.dylib')):
copyFrameworkToApp(framework) copyFrameworkToApp(framework)
updateLibraryPath(framework, 'Frameworks') updateLibraryPath(framework, 'Frameworks')
# Always update paths after copying... # Always update paths after copying...
updateLibraryPath('libqcocoa.dylib', 'plugins/platforms') updateLibraryPath('libqcocoa.dylib', 'plugins/platforms')
def processQmlDirectory(qtImportsDirectoryName):
qmlOutputDirectory = os.path.join(installDirectory, 'MacOS/Qt/labs')
toDir = os.path.join(qmlOutputDirectory, qtImportsDirectoryName)
os.mkdir(toDir)
fromDir = os.path.join(qmlDirectory, qtImportsDirectoryName)
for plugin in os.listdir(fromDir):
# there may be debug versions installed; if so, ignore them
if plugin.find('_debug') is -1:
shutil.copy(os.path.join(fromDir, plugin), toDir)
# Update all paths
for plugin in os.listdir(toDir):
if plugin[-5:] == 'dylib':
# copy required frameworks
for framework in getListOfLinkedQtFrameworksForFile(
os.path.join(toDir, plugin)):
copyFrameworkToApp(framework)
updateLibraryPath(framework, 'Frameworks')
# Update path
updateLibraryPath(plugin, 'MacOS/Qt/labs/' + qtImpor
tsDirectoryName)
def processQml():
qmlQtDir = os.path.join(installDirectory, 'MacOS/Qt')
os.mkdir(qmlQtDir)
qmlOutputDirectory = os.path.join(qmlQtDir, 'labs')
os.mkdir(qmlOutputDirectory)
processQmlDirectory("shaders")
def processBin(): def processBin():
''' '''
Moves the binary to the correct location Moves the binary to the correct location
''' '''
os.rename(os.path.join(installDirectory, 'bin'), os.path.join(instal lDirectory, 'MacOS')) os.rename(os.path.join(installDirectory, 'bin'), os.path.join(instal lDirectory, 'MacOS'))
def processDMG(): def processDMG():
''' '''
Create a DMG bundle Create a DMG bundle
''' '''
skipping to change at line 253 skipping to change at line 223
args = ['rm', '-rf', dmgDir] args = ['rm', '-rf', dmgDir]
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 deleting temporary directory.\n%s\n%s' % (outpu t, oerr)) print('Error deleting temporary directory.\n%s\n%s' % (outpu t, oerr))
def main(): def main():
''' '''
main expects three arguments: main expects three arguments:
''' '''
global installDirectory, sourceDirectory, qtFrameworksDirectory, qtP luginsDirectory, qmlDirectory global installDirectory, sourceDirectory, qtFrameworksDirectory, qtP luginsDirectory
if len(sys.argv) < 4: if len(sys.argv) < 4:
print("usage: mac_app.py ${CMAKE_INSTALL_PREFIX} ${PROJECT_S OURCE_DIR} ${CMAKE_BUILD_TYPE} ${Qt5Core_INCLUDE_DIRS}") print("usage: mac_app.py ${CMAKE_INSTALL_PREFIX} ${PROJECT_S OURCE_DIR} ${CMAKE_BUILD_TYPE} ${Qt5Core_INCLUDE_DIRS}")
print(sys.argv) print(sys.argv)
return return
installDirectory = sys.argv[1] installDirectory = sys.argv[1]
sourceDirectory = sys.argv[2] sourceDirectory = sys.argv[2]
buildType = sys.argv[3] # ignored for now buildType = sys.argv[3] # ignored for now
qtFrameworksDirectory = sys.argv[4] qtFrameworksDirectory = sys.argv[4]
# qtDirectory will actually be an include dir; we need to convert to the directory where # qtDirectory will actually be an include dir; we need to convert to the directory where
skipping to change at line 281 skipping to change at line 251
qtPluginsDirectory = os.path.normpath(qtFrameworksDirectory + '/../p lugins') qtPluginsDirectory = os.path.normpath(qtFrameworksDirectory + '/../p lugins')
if not os.path.exists(qtPluginsDirectory): if not os.path.exists(qtPluginsDirectory):
print('Could not find plugins directory.') print('Could not find plugins directory.')
return return
qmlDirectory = os.path.normpath(qtFrameworksDirectory + '/../imports /Qt/labs') qmlDirectory = os.path.normpath(qtFrameworksDirectory + '/../imports /Qt/labs')
processBin() processBin()
processResources() processResources()
processFrameworks() processFrameworks()
processPlugins() processPlugins()
processQml()
# update application lib's locations; we need to do this here, as th e above rely # update application lib's locations; we need to do this here, as th e above rely
# on the binary with the 'original' paths. # on the binary with the 'original' paths.
updateLibraryPath('stellarium', 'MacOS') updateLibraryPath('stellarium', 'MacOS')
# create a DMG bundle # create a DMG bundle
# processDMG() # processDMG()
if __name__ == '__main__': if __name__ == '__main__':
main() main()
 End of changes. 5 change blocks. 
34 lines changed or deleted 1 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/