Merge lp:~mzibricky/openlp/mac_build_refactoring into lp:openlp

Proposed by matysek
Status: Merged
Approved by: Andreas Preikschat
Approved revision: 1802
Merged at revision: 1858
Proposed branch: lp:~mzibricky/openlp/mac_build_refactoring
Merge into: lp:openlp
Diff against target: 138 lines (+22/-32)
1 file modified
resources/osx/build.py (+22/-32)
To merge this branch: bzr merge lp:~mzibricky/openlp/mac_build_refactoring
Reviewer Review Type Date Requested Status
Andreas Preikschat (community) Approve
Raoul Snyman Approve
Review via email: mp+86875@code.launchpad.net

Description of the change

These changes in the mac build script include:
- removing some old unnecessary code
- fix necessary for media player from media-rewrite branch

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Andreas Preikschat (googol-deactivatedaccount) wrote :

Approved, but not tested.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'resources/osx/build.py'
2--- resources/osx/build.py 2011-07-13 20:41:54 +0000
3+++ resources/osx/build.py 2011-12-26 00:12:26 +0000
4@@ -31,8 +31,8 @@
5 This script is used to build the OS X binary and the accompanying installer.
6 For this script to work out of the box, it depends on a number of things:
7
8-Python 2.6
9- This build script only works with Python 2.6.
10+Python 2.6/2.7
11+ This build script only works with Python 2.6/2.7
12
13 PyQt4
14 You should already have this installed, OpenLP doesn't work without it.
15@@ -76,7 +76,6 @@
16 make bundle -- compresses the dmg file and sets the dmg file icon
17 """
18
19-import time
20 import os
21 import ConfigParser
22 import logging
23@@ -87,33 +86,23 @@
24 import re
25 import subprocess as subp
26
27+from shutil import copy
28+
29 # set the script name
30 script_name = "build"
31
32+
33 def build_application(settings, app_name_lower, app_dir):
34 logging.info('[%s] now building the app with pyinstaller at "%s"...',
35 script_name, settings['pyinstaller_basedir'])
36- full_python_dir = os.path.join('/opt/local/Library/Frameworks',
37- 'Python.framework/Versions/2.6/Resources/',
38- 'Python.app/Contents/MacOS/Python')
39 result = os.system('arch -i386 %s %s/pyinstaller.py openlp.spec' \
40- % ( full_python_dir,
41+ % ( sys.executable,
42 settings['pyinstaller_basedir']) )
43 if (result != 0):
44 logging.error('[%s] The pyinstaller build reported an error, cannot \
45 continue!', script_name)
46 sys.exit(1)
47
48- logging.info('[%s] copying the qt_menu files...', script_name)
49- # see http://www.pyinstaller.org/ticket/157
50- result = os.system('cp -R %(qt_menu_directory)s \
51- %(application_directory)s/Contents/Resources' \
52- % { 'qt_menu_directory' : settings['qt_menu_basedir'],
53- 'application_directory' : app_dir })
54- if (result != 0):
55- logging.error('[%s] could not copy the qt_menu files, cannot \
56- continue!', script_name)
57- sys.exit(1)
58
59 dist_folder = os.getcwd() + '/dist/' + app_name_lower
60
61@@ -166,7 +155,7 @@
62 sys.exit(1)
63
64 logging.info('[%s] copying the translations...', script_name)
65- os.mkdir(app_dir + '/Contents/MacOS/i18n')
66+ os.makedirs(app_dir + '/Contents/MacOS/i18n')
67 for ts_file in glob.glob(os.path.join(settings['openlp_basedir']
68 + '/resources/i18n/', '*ts')):
69 result = os.system('lconvert -i %(ts_file)s \
70@@ -178,14 +167,21 @@
71 creation failed!', script_name)
72 sys.exit(1)
73
74-def deploy_qt(settings):
75- logging.info('[%s] running mac deploy qt on %s.app...', script_name,
76- settings['openlp_appname']);
77+ # Backported from windows build script.
78+ logging.info('[%s] copying the media player...', script_name)
79+ os.makedirs(os.path.join(app_dir, 'Contents/MacOS/core/ui/media'))
80+ source = os.path.join(settings['openlp_basedir'], u'openlp', u'core', u'ui', u'media')
81+ dest = os.path.join(app_dir, u'Contents/MacOS/core/ui/media')
82+ for root, dirs, files in os.walk(source):
83+ for filename in files:
84+ print filename
85+ if not filename.endswith(u'.pyc'):
86+ dest_path = os.path.join(dest, root[len(source)+1:])
87+ if not os.path.exists(dest_path):
88+ os.makedirs(dest_path)
89+ copy(os.path.join(root, filename),
90+ os.path.join(dest_path, filename))
91
92- result = os.system('macdeployqt %s.app' % settings['openlp_appname']);
93- if (result != 0):
94- logging.error('[%s] could not create dmg file!', script_name)
95- sys.exit(1)
96
97 def create_dmg(settings):
98 logging.info('[%s] creating the dmg...', script_name)
99@@ -308,7 +304,6 @@
100 do_package_view = True
101 do_create_dmg = True
102 do_compress_dmg = True
103- do_deploy_qt = True
104
105 parser = optparse.OptionParser()
106 parser.add_option('-c', '--config', dest='config', help='config file',
107@@ -335,7 +330,6 @@
108 if (options.package_view is True or options.compress_view is True
109 or options.package is True or options.compress is True):
110 do_build = False
111- do_deploy_qt = False
112 do_package_view = options.package_view
113 do_compress_view = options.compress_view
114 do_create_dmg = options.package
115@@ -366,7 +360,7 @@
116
117 version = platform.mac_ver()[0]
118 # we only need the differenciation between leopard and snow leopard
119- if version.startswith("10.6"):
120+ if version.startswith("10.6") or version.startswith("10.7"):
121 SNOWLEOPARD = True
122 logging.info('[%s] using snow leopard scripts (version = %s)',
123 script_name, version)
124@@ -408,9 +402,6 @@
125 if (do_build is True):
126 build_application(settings, app_name_lower, app_dir)
127
128- if (do_deploy_qt is True):
129- deploy_qt(settings)
130-
131 if (do_create_dmg is True):
132 (volume_basedir, dmg_file) = create_dmg(settings)
133 else:
134@@ -433,4 +424,3 @@
135 if (do_compress_dmg is True):
136 logging.info('[%s] finished creating dmg file, resulting file is "%s"',
137 script_name, dmg_file)
138-