openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #13654
[Merge] lp:~mzibricky/openlp/mac_build_refactoring into lp:openlp
matysek has proposed merging lp:~mzibricky/openlp/mac_build_refactoring into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Related bugs:
Bug #814838 in OpenLP: "cleanup Mac OS X build script"
https://bugs.launchpad.net/openlp/+bug/814838
Bug #902541 in OpenLP: "OpenLP on OS X shows revision number instead of version number"
https://bugs.launchpad.net/openlp/+bug/902541
For more details, see:
https://code.launchpad.net/~mzibricky/openlp/mac_build_refactoring/+merge/86875
These changes in the mac build script include:
- removing some old unnecessary code
- fix necessary for media player from media-rewrite branch
--
https://code.launchpad.net/~mzibricky/openlp/mac_build_refactoring/+merge/86875
Your team OpenLP Core is requested to review the proposed merge of lp:~mzibricky/openlp/mac_build_refactoring into lp:openlp.
=== modified file 'resources/osx/build.py'
--- resources/osx/build.py 2011-07-13 20:41:54 +0000
+++ resources/osx/build.py 2011-12-26 00:12:26 +0000
@@ -31,8 +31,8 @@
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 @@
make bundle -- compresses the dmg file and sets the dmg file icon
"""
-import time
import os
import ConfigParser
import logging
@@ -87,33 +86,23 @@
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'])
- 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,
+ % ( 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
@@ -166,7 +155,7 @@
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 \
@@ -178,14 +167,21 @@
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']);
+ # 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))
- 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)
@@ -308,7 +304,6 @@
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 +330,6 @@
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 +360,7 @@
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 +402,6 @@
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:
@@ -433,4 +424,3 @@
if (do_compress_dmg is True):
logging.info('[%s] finished creating dmg file, resulting file is "%s"',
script_name, dmg_file)
-
Follow ups