From 3da2fada664304966434036d3c765431099e447d Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sat, 19 Nov 2011 00:42:05 +0100 Subject: [PATCH 1/2] remove some unneeded stuff from mac build script (like macdeployqt or qt_menu.nib) --- resources/osx/build.py | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/resources/osx/build.py b/resources/osx/build.py index 38e56e42a..53033c943 100644 --- a/resources/osx/build.py +++ b/resources/osx/build.py @@ -31,8 +31,8 @@ Mac OS X Build Script This script is used to build the OS X binary and the accompanying installer. For this script to work out of the box, it depends on a number of things: -Python 2.6 - This build script only works with Python 2.6. +Python 2.6/2.7 + This build script only works with Python 2.6/2.7 PyQt4 You should already have this installed, OpenLP doesn't work without it. @@ -76,7 +76,6 @@ build process you can specify different make targets make bundle -- compresses the dmg file and sets the dmg file icon """ -import time import os import ConfigParser import logging @@ -93,27 +92,14 @@ script_name = "build" def build_application(settings, app_name_lower, app_dir): logging.info('[%s] now building the app with pyinstaller at "%s"...', script_name, settings['pyinstaller_basedir']) - full_python_dir = os.path.join('/opt/local/Library/Frameworks', - 'Python.framework/Versions/2.6/Resources/', - 'Python.app/Contents/MacOS/Python') - result = os.system('arch -i386 %s %s/pyinstaller.py openlp.spec' \ - % ( full_python_dir, + result = os.system('%s %s/pyinstaller.py openlp.spec' \ + % ( sys.executable, settings['pyinstaller_basedir']) ) if (result != 0): logging.error('[%s] The pyinstaller build reported an error, cannot \ continue!', script_name) sys.exit(1) - logging.info('[%s] copying the qt_menu files...', script_name) - # see http://www.pyinstaller.org/ticket/157 - result = os.system('cp -R %(qt_menu_directory)s \ - %(application_directory)s/Contents/Resources' \ - % { 'qt_menu_directory' : settings['qt_menu_basedir'], - 'application_directory' : app_dir }) - if (result != 0): - logging.error('[%s] could not copy the qt_menu files, cannot \ - continue!', script_name) - sys.exit(1) dist_folder = os.getcwd() + '/dist/' + app_name_lower @@ -178,15 +164,6 @@ def build_application(settings, app_name_lower, app_dir): creation failed!', script_name) sys.exit(1) -def deploy_qt(settings): - logging.info('[%s] running mac deploy qt on %s.app...', script_name, - settings['openlp_appname']); - - result = os.system('macdeployqt %s.app' % settings['openlp_appname']); - if (result != 0): - logging.error('[%s] could not create dmg file!', script_name) - sys.exit(1) - def create_dmg(settings): logging.info('[%s] creating the dmg...', script_name) dmg_file = os.getcwd() + '/' + settings['openlp_dmgname'] + '.dmg' @@ -308,7 +285,6 @@ if __name__ == '__main__': do_package_view = True do_create_dmg = True do_compress_dmg = True - do_deploy_qt = True parser = optparse.OptionParser() parser.add_option('-c', '--config', dest='config', help='config file', @@ -335,7 +311,6 @@ if __name__ == '__main__': if (options.package_view is True or options.compress_view is True or options.package is True or options.compress is True): do_build = False - do_deploy_qt = False do_package_view = options.package_view do_compress_view = options.compress_view do_create_dmg = options.package @@ -366,7 +341,7 @@ if __name__ == '__main__': version = platform.mac_ver()[0] # we only need the differenciation between leopard and snow leopard - if version.startswith("10.6"): + if version.startswith("10.6") or version.startswith("10.7"): SNOWLEOPARD = True logging.info('[%s] using snow leopard scripts (version = %s)', script_name, version) @@ -408,9 +383,6 @@ if __name__ == '__main__': if (do_build is True): build_application(settings, app_name_lower, app_dir) - if (do_deploy_qt is True): - deploy_qt(settings) - if (do_create_dmg is True): (volume_basedir, dmg_file) = create_dmg(settings) else: From 70c0125255d4dd5717b9243904f69e4c7f4a0558 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sat, 24 Dec 2011 13:26:50 +0100 Subject: [PATCH 2/2] Include media player files with build for Mac OS X --- resources/osx/build.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/resources/osx/build.py b/resources/osx/build.py index 53033c943..ea8531239 100644 --- a/resources/osx/build.py +++ b/resources/osx/build.py @@ -86,13 +86,16 @@ import platform import re import subprocess as subp +from shutil import copy + # set the script name script_name = "build" + def build_application(settings, app_name_lower, app_dir): logging.info('[%s] now building the app with pyinstaller at "%s"...', script_name, settings['pyinstaller_basedir']) - result = os.system('%s %s/pyinstaller.py openlp.spec' \ + result = os.system('arch -i386 %s %s/pyinstaller.py openlp.spec' \ % ( sys.executable, settings['pyinstaller_basedir']) ) if (result != 0): @@ -152,7 +155,7 @@ def build_application(settings, app_name_lower, app_dir): sys.exit(1) logging.info('[%s] copying the translations...', script_name) - os.mkdir(app_dir + '/Contents/MacOS/i18n') + os.makedirs(app_dir + '/Contents/MacOS/i18n') for ts_file in glob.glob(os.path.join(settings['openlp_basedir'] + '/resources/i18n/', '*ts')): result = os.system('lconvert -i %(ts_file)s \ @@ -164,6 +167,22 @@ def build_application(settings, app_name_lower, app_dir): creation failed!', script_name) sys.exit(1) + # Backported from windows build script. + logging.info('[%s] copying the media player...', script_name) + os.makedirs(os.path.join(app_dir, 'Contents/MacOS/core/ui/media')) + source = os.path.join(settings['openlp_basedir'], u'openlp', u'core', u'ui', u'media') + dest = os.path.join(app_dir, u'Contents/MacOS/core/ui/media') + for root, dirs, files in os.walk(source): + for filename in files: + print filename + if not filename.endswith(u'.pyc'): + dest_path = os.path.join(dest, root[len(source)+1:]) + if not os.path.exists(dest_path): + os.makedirs(dest_path) + copy(os.path.join(root, filename), + os.path.join(dest_path, filename)) + + def create_dmg(settings): logging.info('[%s] creating the dmg...', script_name) dmg_file = os.getcwd() + '/' + settings['openlp_dmgname'] + '.dmg' @@ -405,4 +424,3 @@ if __name__ == '__main__': if (do_compress_dmg is True): logging.info('[%s] finished creating dmg file, resulting file is "%s"', script_name, dmg_file) -