From f40225419b6ecfad7d570c67e12a5c90b1d2058a Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sun, 24 Jun 2012 16:59:45 +0200 Subject: [PATCH 01/11] Fix build paths after moving osx build code to packaging branch. --- osx/config.ini.default | 2 +- osx/macosx-builder.py | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/osx/config.ini.default b/osx/config.ini.default index 0fc6792..4445e64 100644 --- a/osx/config.ini.default +++ b/osx/config.ini.default @@ -1,6 +1,6 @@ [executables] sphinx = sphinx-build -pyinstaller = %(here)s/../pyinstaller/pyinstaller.py +pyinstaller = %(projects)s/pyinstaller/pyinstaller.py lrelease = lrelease diskutil = diskutil hdiutil = hdiutil diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 5179e9a..c44f9a7 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -205,14 +205,13 @@ class MacosxBuilder(object): """ parser = ArgumentParser() parser.add_argument('-b', '--branch', metavar='BRANCH', dest='branch', - help='Specify the path to the branch you wish to build.', - default='../trunk') + help='Specify the path to the branch you wish to build.') parser.add_argument('--devel', dest='devel', action='store_true', default=False, help='Development build does not have set icons for .dmg file ' 'and .dmg filename contains bzr revision number.') parser.add_argument('-d', '--documentation', metavar='DOCS', - dest='docs', default=os.path.join('..', 'documentation'), + dest='docs', help='Specify the path to the documentation branch.') parser.add_argument('-c', '--config', metavar='CONFIG', dest='config', help='Specify the path to the configuration file.', @@ -236,7 +235,9 @@ class MacosxBuilder(object): Read the configuration from the configuration file. """ self.config = ConfigParser(defaults={ - u'here': self.script_path + u'here': self.script_path, + u'projects': os.path.abspath(os.path.join(self.script_path, + '..', '..')), }) self.config.read(os.path.abspath(self.args.config)) @@ -264,15 +265,15 @@ class MacosxBuilder(object): Set up a variety of paths that we use throughout the build process. """ if self.args.branch: - branch_path = self.args.branch + branch_path = os.path.abspath(self.args.branch) else: branch_path = self.config.get(u'paths', u'branch') - self.branch_path = os.path.abspath(branch_path) + self.branch_path = branch_path if self.args.docs: - docs_path = self.args.docs + docs_path = os.path.abspath(self.args.docs) else: docs_path = self.config.get(u'paths', u'documentation') - self.docs_path = os.path.abspath(docs_path) + self.docs_path = docs_path self.openlp_script = os.path.abspath( os.path.join(branch_path, u'openlp.pyw')) @@ -374,6 +375,7 @@ class MacosxBuilder(object): version_string = latest == revision and tag or \ u'%s-bzr%s' % (tag, latest) self.version_string = version_string + self.version_tag = tag version_file = open(os.path.join(self.dist_path, u'.version'), u'w') version_file.write(version_string) version_file.close() @@ -513,7 +515,12 @@ class MacosxBuilder(object): """ self._print(u'Creating dmg file...') - dmg_name = 'OpenLP-' + self.version_string + '.dmg' + # Release version does not contain revision in .dmg name. + if self.args.devel: + dmg_name = 'OpenLP-' + self.version_string + '.dmg' + else: + dmg_name = 'OpenLP-' + self.version_tag + '.dmg' + dmg_file = os.path.join(self.branch_path, 'build', dmg_name) # Remove dmg if it exists. if os.path.exists(dmg_file): From d49470614babf3cec3d8255e53fa825bcba75bd2 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sun, 24 Jun 2012 19:17:59 +0200 Subject: [PATCH 02/11] Fix setting dmg background in osx build. --- osx/applescript-adjustview-10-6.master | 11 +---- osx/macosx-builder.py | 62 ++++++++++++++------------ 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/osx/applescript-adjustview-10-6.master b/osx/applescript-adjustview-10-6.master index 1708425..cbc7bd0 100755 --- a/osx/applescript-adjustview-10-6.master +++ b/osx/applescript-adjustview-10-6.master @@ -9,15 +9,6 @@ on saveImageWithItselfAsIcon(icon_image_file) end tell end saveImageWithItselfAsIcon -on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder) - tell application "Finder" to set f to aFileOrFolderWithIcon as alias - -- grab the file's icon - my CopyOrPaste(f, "c") - -- now the icon is in the clipboard - tell application "Finder" to set c to aFileOrFolder as alias - my CopyOrPaste(result, "v") -end copyIconOfTo - on CopyOrPaste(i, cv) tell application "Finder" activate @@ -37,7 +28,7 @@ on run my saveImageWithItselfAsIcon(icon_image_file) -- wait for virus scanner delay 2 - my copyIconOfTo(icon_image_file, dmg_file) + -- my copyIconOfTo(icon_image_file, dmg_file) tell application "Finder" tell disk "%s" diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index c44f9a7..d03b7e6 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -563,6 +563,14 @@ class MacosxBuilder(object): u'Could not copy the background image, dmg creation failed.' ) + + # Set dmg background. + # TODO: better formatting and code refactoring + self.adjust_package_view({'openlp_dmg_icon_file': + self.dmg_background_img,'openlp_appname': 'OpenLP' }, + os.path.join(self.script_path, + 'applescript-adjustview-10-6.master')) + # Unmount dmg file. self._print('... unmounting the dmg.') self._run_command([self.hdiutil, 'detach', dmg_volume_path], @@ -598,9 +606,34 @@ class MacosxBuilder(object): compressed_dmg) # TODO Reimplement following actions. - #adjust_package_view(settings, adjustview_scriptname) + #seticon_scriptname = "applescript-seticon-10-6.master" #compress_view(settings, seticon_scriptname, dmg_file) + def adjust_package_view(self, settings, adjustview_scriptname): + #logging.info('[%s] making adjustments to the view...', script_name) + try: + f = open(adjustview_scriptname) + p = Popen(["osascript"], stdin=PIPE) + p.communicate(f.read() % ( + settings['openlp_dmg_icon_file'], + settings['openlp_appname'], + settings['openlp_appname'], + settings['openlp_appname'])) + f.close() + result = p.returncode + if (result != 0): + #logging.error('[%s] could not adjust the view, dmg creation \ + # failed!', script_name) + sys.exit(1) + except IOError, e: + #logging.error('[%s] could not adjust the view (%s), dmg creation \ + # failed!', script_name, e) + sys.exit(1) + except OSError, e: + #logging.error('[%s] could not adjust the view (%s), dmg creation \ + # failed!', script_name, e) + sys.exit(1) + def main(self): """ @@ -672,31 +705,6 @@ def compress_view(settings, seticon_scriptname, dmg_file): dmg creation failed!', script_name, e) sys.exit(1) -def adjust_package_view(settings, adjustview_scriptname): - logging.info('[%s] making adjustments to the view...', script_name) - try: - f = open(adjustview_scriptname) - p = subp.Popen(["osascript"], stdin=subp.PIPE) - p.communicate(f.read() % ((os.getcwd() + '/' + \ - settings['openlp_dmg_icon_file']), - settings['openlp_appname'], - settings['openlp_appname'], - settings['openlp_appname'])) - f.close() - result = p.returncode - if (result != 0): - logging.error('[%s] could not adjust the view, dmg creation \ - failed!', script_name) - sys.exit(1) - except IOError, e: - logging.error('[%s] could not adjust the view (%s), dmg creation \ - failed!', script_name, e) - sys.exit(1) - except OSError, e: - logging.error('[%s] could not adjust the view (%s), dmg creation \ - failed!', script_name, e) - sys.exit(1) - def old_main(): version = platform.mac_ver()[0] @@ -705,8 +713,6 @@ def old_main(): SNOWLEOPARD = True logging.info('[%s] using snow leopard scripts (version = %s)', script_name, version) - adjustview_scriptname = "applescript-adjustview-10-6.master" - seticon_scriptname = "applescript-seticon-10-6.master" else: SNOWLEOPARD = False logging.info('[%s] using leopard scripts (version = %s)', script_name, From 12fd1af4fb12ab5d7ef2322444d007e3c35f89ab Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Sun, 24 Jun 2012 19:22:04 +0200 Subject: [PATCH 03/11] Setting dmg background in osx build only for release build. --- osx/macosx-builder.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index d03b7e6..baab08b 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -564,12 +564,13 @@ class MacosxBuilder(object): ) - # Set dmg background. + # Set dmg background. Requires running Mac OS X gui. # TODO: better formatting and code refactoring - self.adjust_package_view({'openlp_dmg_icon_file': - self.dmg_background_img,'openlp_appname': 'OpenLP' }, - os.path.join(self.script_path, - 'applescript-adjustview-10-6.master')) + if not self.args.devel: + self.adjust_package_view({'openlp_dmg_icon_file': + self.dmg_background_img,'openlp_appname': 'OpenLP' }, + os.path.join(self.script_path, + 'applescript-adjustview-10-6.master')) # Unmount dmg file. self._print('... unmounting the dmg.') From 04c73e4c45b6743880c0c4878e7a6e929ebeaa8c Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Mon, 25 Jun 2012 00:35:37 +0200 Subject: [PATCH 04/11] Fix setting dmg icon for osx build. Icon is now set without Mac gui (Finder). --- osx/DmgImageInstallBackground.png | Bin osx/macosx-builder.py | 84 +++++++++--------------------- 2 files changed, 25 insertions(+), 59 deletions(-) mode change 100755 => 100644 osx/DmgImageInstallBackground.png diff --git a/osx/DmgImageInstallBackground.png b/osx/DmgImageInstallBackground.png old mode 100755 new mode 100644 diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index baab08b..27b8912 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -555,23 +555,38 @@ class MacosxBuilder(object): u'Could not copy app bundle, dmg creation failed.' ) - self._print('... Copying the background image.') - os.mkdir(os.path.join(dmg_volume_path, '.background')) - self._run_command(['cp', self.dmg_background_img, - os.path.join(dmg_volume_path, - '.background/installer-background.png')], - u'Could not copy the background image, dmg creation failed.' - ) - # Set dmg background. Requires running Mac OS X gui. # TODO: better formatting and code refactoring if not self.args.devel: + self._print('... Setting the background image.') + + os.mkdir(os.path.join(dmg_volume_path, '.background')) + self._run_command(['cp', self.dmg_background_img, + os.path.join(dmg_volume_path, + '.background/installer-background.png')], + u'Could not copy the background image, dmg creation failed.' + ) + self.adjust_package_view({'openlp_dmg_icon_file': self.dmg_background_img,'openlp_appname': 'OpenLP' }, os.path.join(self.script_path, 'applescript-adjustview-10-6.master')) + # Set icon for dmg file. + # http://endrift.com/blog/2010/06/14/dmg-files-volume-icons-cli/ + self._print('... Setting the dmg icon.') + dmg_icon = os.path.join(dmg_volume_path, '.VolumeIcon.icns') + self._run_command(['cp', self.mac_icon, dmg_icon], + u'Could not copy the dmg icon file, dmg creation failed.' + ) + # Set proper dmg icon attributes. + self._run_command(['SetFile', '-c', 'icnC', dmg_icon], + 'Could not set dmg icon attributes.') + # Ensures dmg icon will be used while mounted. + self._run_command(['SetFile', '-a', 'C', dmg_volume_path], + 'Could not set dmg icon attributes.') + # Unmount dmg file. self._print('... unmounting the dmg.') self._run_command([self.hdiutil, 'detach', dmg_volume_path], @@ -606,9 +621,7 @@ class MacosxBuilder(object): self._print('Finished creating dmg file, resulting file: %s' % compressed_dmg) - # TODO Reimplement following actions. - #seticon_scriptname = "applescript-seticon-10-6.master" - #compress_view(settings, seticon_scriptname, dmg_file) + self.dmg_file = compressed_dmg def adjust_package_view(self, settings, adjustview_scriptname): #logging.info('[%s] making adjustments to the view...', script_name) @@ -635,7 +648,6 @@ class MacosxBuilder(object): # failed!', script_name, e) sys.exit(1) - def main(self): """ The main function to run the Mac OS X builder. @@ -648,7 +660,7 @@ class MacosxBuilder(object): self._print_verbose(u'Source path: .............%s', self.source_path) self._print_verbose(u'"dist.app" path: .........%s', self.dist_app_path) self._print_verbose(u'"dist" path: .............%s', self.dist_path) - self._print_verbose(u'"hooks" path: .............%s', self.hooks_path) + self._print_verbose(u'"hooks" path: ............%s', self.hooks_path) self._print_verbose(u'PyInstaller: .............%s', self.pyinstaller) self._print_verbose(u'Documentation branch path:%s', self.docs_path) self._print_verbose(u'') @@ -680,49 +692,3 @@ class MacosxBuilder(object): if __name__ == u'__main__': MacosxBuilder().main() - - - -# TODO reimplement following options. They arenecessary for release builds. -def compress_view(settings, seticon_scriptname, dmg_file): - logging.info('[%s] setting icon of the dmg file...', script_name) - try: - f = open(seticon_scriptname) - p = subp.Popen(["osascript"], stdin=subp.PIPE) - p.communicate(f.read() % ((os.getcwd() + '/' + - settings['openlp_dmg_icon_file']), dmg_file)) - f.close() - result = p.returncode - if (result != 0): - logging.error('[%s] could not set the icon to the dmg file, \ - dmg creation failed!', script_name) - sys.exit(1) - except IOError, e: - logging.error('[%s] could not adjust the view (%s), dmg creation \ - failed!', script_name, e) - sys.exit(1) - except OSError, e: - logging.error('[%s] could not set the icon to the dmg file(%s), \ - dmg creation failed!', script_name, e) - sys.exit(1) - -def old_main(): - - version = platform.mac_ver()[0] - # we only need the differenciation between leopard and snow leopard - if version.startswith("10.6") or version.startswith("10.7"): - SNOWLEOPARD = True - logging.info('[%s] using snow leopard scripts (version = %s)', - script_name, version) - else: - SNOWLEOPARD = False - logging.info('[%s] using leopard scripts (version = %s)', script_name, - version) - adjustview_scriptname = "applescript-adjustview-10-5.master" - seticon_scriptname = "applescript-seticon-10-5.master" - - if not os.path.isfile(adjustview_scriptname) \ - or not os.path.isfile(seticon_scriptname): - logging.error('[%s] could not find apple scripts for given OS X ' - + 'version %s', script_name, version) - sys.exit(1) From 57441ec741ec8d3d3681d2c06c8322b052e0ea53 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Mon, 25 Jun 2012 00:36:45 +0200 Subject: [PATCH 05/11] Remove unused applescript files. --- osx/applescript-seticon-10-5.master | 40 ---------------------------- osx/applescript-seticon-10-6.master | 41 ----------------------------- 2 files changed, 81 deletions(-) delete mode 100755 osx/applescript-seticon-10-5.master delete mode 100755 osx/applescript-seticon-10-6.master diff --git a/osx/applescript-seticon-10-5.master b/osx/applescript-seticon-10-5.master deleted file mode 100755 index 738c4b8..0000000 --- a/osx/applescript-seticon-10-5.master +++ /dev/null @@ -1,40 +0,0 @@ -on saveImageWithItselfAsIcon(icon_image_file) - -- save icon_image_file with itself as icon - set icon_image_file_string to icon_image_file as string - tell application "Image Events" - launch - set icon_image to open file icon_image_file_string - save icon_image with icon - close icon_image - end tell -end saveImageWithItselfAsIcon - -on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder) - tell application "Finder" to set f to aFileOrFolderWithIcon as alias - -- grab the file's icon - my CopyOrPaste(f, "c") - -- now the icon is in the clipboard - tell application "Finder" to set c to aFileOrFolder as alias - my CopyOrPaste(result, "v") -end copyIconOfTo - -on CopyOrPaste(i, cv) - tell application "Finder" - activate - open information window of i - end tell - tell application "System Events" to tell process "Finder" to tell window 1 - keystroke tab -- select icon button - keystroke (cv & "w") using command down (* (copy or paste) + close window *) - end tell -- window 1 then process Finder then System Events -end CopyOrPaste - -on run - set icon_image_file to POSIX file "%s" as alias - set dmg_file to POSIX file "%s" as alias - - my saveImageWithItselfAsIcon(icon_image_file) - -- wait for virus scanner - delay 2 - my copyIconOfTo(icon_image_file, dmg_file) -end run diff --git a/osx/applescript-seticon-10-6.master b/osx/applescript-seticon-10-6.master deleted file mode 100755 index 849f023..0000000 --- a/osx/applescript-seticon-10-6.master +++ /dev/null @@ -1,41 +0,0 @@ -on saveImageWithItselfAsIcon(icon_image_file) - -- save icon_image_file with itself as icon - set icon_image_file_string to icon_image_file as string - tell application "Image Events" - launch - set icon_image to open file icon_image_file_string - save icon_image with icon - close icon_image - end tell -end saveImageWithItselfAsIcon - -on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder) - tell application "Finder" to set f to aFileOrFolderWithIcon as alias - -- grab the file's icon - my CopyOrPaste(f, "c") - -- now the icon is in the clipboard - tell application "Finder" to set c to aFileOrFolder as alias - my CopyOrPaste(result, "v") -end copyIconOfTo - -on CopyOrPaste(i, cv) - tell application "Finder" - activate - set infoWindow to open information window of i - set infoWindowName to name of infoWindow - end tell - tell application "System Events" to tell process "Finder" to tell window infoWindowName - keystroke tab -- select icon button - keystroke (cv & "w") using command down (* (copy or paste) + close window *) - end tell -- window 1 then process Finder then System Events -end CopyOrPaste - -on run - set icon_image_file to POSIX file "%s" as alias - set dmg_file to POSIX file "%s" as alias - - my saveImageWithItselfAsIcon(icon_image_file) - -- wait for virus scanner - delay 2 - my copyIconOfTo(icon_image_file, dmg_file) -end run From d5e908f6eeb67eac762586e67062e79ed8eaa561 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Mon, 25 Jun 2012 01:09:46 +0200 Subject: [PATCH 06/11] Refactoring: Simplify code adjusting dmg view in osx build. --- osx/applescript-adjustview-10-6.master | 28 ------------- osx/macosx-builder.py | 57 ++++++++++---------------- 2 files changed, 22 insertions(+), 63 deletions(-) diff --git a/osx/applescript-adjustview-10-6.master b/osx/applescript-adjustview-10-6.master index cbc7bd0..abd8b7e 100755 --- a/osx/applescript-adjustview-10-6.master +++ b/osx/applescript-adjustview-10-6.master @@ -1,34 +1,6 @@ -on saveImageWithItselfAsIcon(icon_image_file) - -- save icon_image_file with itself as icon - set icon_image_file_string to icon_image_file as string - tell application "Image Events" - launch - set icon_image to open file icon_image_file_string - save icon_image with icon - close icon_image - end tell -end saveImageWithItselfAsIcon - -on CopyOrPaste(i, cv) - tell application "Finder" - activate - set infoWindow to open information window of i - set infoWindowName to name of infoWindow - end tell - tell application "System Events" to tell process "Finder" to tell window infoWindowName - keystroke tab -- select icon button - keystroke (cv & "w") using command down (* (copy or paste) + close window *) - end tell -- window 1 then process Finder then System Events -end CopyOrPaste - on run - set icon_image_file to POSIX file "%s" as alias - set dmg_file to POSIX file "/Volumes/%s" as alias - - my saveImageWithItselfAsIcon(icon_image_file) -- wait for virus scanner delay 2 - -- my copyIconOfTo(icon_image_file, dmg_file) tell application "Finder" tell disk "%s" diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 27b8912..25605bc 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -555,24 +555,6 @@ class MacosxBuilder(object): u'Could not copy app bundle, dmg creation failed.' ) - - # Set dmg background. Requires running Mac OS X gui. - # TODO: better formatting and code refactoring - if not self.args.devel: - self._print('... Setting the background image.') - - os.mkdir(os.path.join(dmg_volume_path, '.background')) - self._run_command(['cp', self.dmg_background_img, - os.path.join(dmg_volume_path, - '.background/installer-background.png')], - u'Could not copy the background image, dmg creation failed.' - ) - - self.adjust_package_view({'openlp_dmg_icon_file': - self.dmg_background_img,'openlp_appname': 'OpenLP' }, - os.path.join(self.script_path, - 'applescript-adjustview-10-6.master')) - # Set icon for dmg file. # http://endrift.com/blog/2010/06/14/dmg-files-volume-icons-cli/ self._print('... Setting the dmg icon.') @@ -587,6 +569,20 @@ class MacosxBuilder(object): self._run_command(['SetFile', '-a', 'C', dmg_volume_path], 'Could not set dmg icon attributes.') + # Set dmg background. Requires running Mac OS X gui. + # TODO: better formatting and code refactoring + if not self.args.devel: + self._print('... Setting the background image.') + + os.mkdir(os.path.join(dmg_volume_path, '.background')) + self._run_command(['cp', self.dmg_background_img, + os.path.join(dmg_volume_path, + '.background/installer-background.png')], + u'Could not copy the background image, dmg creation failed.' + ) + + self.adjust_dmg_view(os.path.basename(dmg_volume_path)) + # Unmount dmg file. self._print('... unmounting the dmg.') self._run_command([self.hdiutil, 'detach', dmg_volume_path], @@ -623,29 +619,20 @@ class MacosxBuilder(object): self.dmg_file = compressed_dmg - def adjust_package_view(self, settings, adjustview_scriptname): - #logging.info('[%s] making adjustments to the view...', script_name) + def adjust_dmg_view(self, dmg_volume_name): try: - f = open(adjustview_scriptname) + # TODO: Use only one applescript file. Remove one for osx 10.5. + f = open(os.path.join(self.script_path, + 'applescript-adjustview-10-6.master')) p = Popen(["osascript"], stdin=PIPE) - p.communicate(f.read() % ( - settings['openlp_dmg_icon_file'], - settings['openlp_appname'], - settings['openlp_appname'], - settings['openlp_appname'])) + p.communicate(f.read() % (dmg_volume_name, 'OpenLP')) f.close() result = p.returncode if (result != 0): - #logging.error('[%s] could not adjust the view, dmg creation \ - # failed!', script_name) + self._print('Adjusting dmg view failed.') sys.exit(1) - except IOError, e: - #logging.error('[%s] could not adjust the view (%s), dmg creation \ - # failed!', script_name, e) - sys.exit(1) - except OSError, e: - #logging.error('[%s] could not adjust the view (%s), dmg creation \ - # failed!', script_name, e) + except (IOError, OSError): + self._print('Adjusting dmg view failed.') sys.exit(1) def main(self): From d4d0559a7c5b7b53573518a9d5341071ec49d306 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Mon, 25 Jun 2012 22:12:26 +0200 Subject: [PATCH 07/11] Remove old files. --- osx/Makefile | 28 ------- ...ter => applescript-adjust-dmg-view.master} | 0 osx/applescript-adjustview-10-5.master | 74 ------------------- osx/macosx-builder.py | 4 +- 4 files changed, 2 insertions(+), 104 deletions(-) delete mode 100644 osx/Makefile rename osx/{applescript-adjustview-10-6.master => applescript-adjust-dmg-view.master} (100%) delete mode 100755 osx/applescript-adjustview-10-5.master diff --git a/osx/Makefile b/osx/Makefile deleted file mode 100644 index 738a27a..0000000 --- a/osx/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -all: - python build.py -c openlp.cfg - -view: - python build.py -c openlp.cfg --package-view --compress-view - -package: - - python build.py -c openlp.cfg --package --package-view - -bundle: - - python build.py -c openlp.cfg --compress --compress-view - -clean: - # remove old configuration files - rm -f openlp.spec - rm -f Info.plist - rm -f .version - - # remove old build artifacts - rm -rf build - rm -rf dist - rm -rf Macopenlp.app - rm -rf OpenLP.app - rm -f warnopenlp.txt - rm -f *dmg - diff --git a/osx/applescript-adjustview-10-6.master b/osx/applescript-adjust-dmg-view.master similarity index 100% rename from osx/applescript-adjustview-10-6.master rename to osx/applescript-adjust-dmg-view.master diff --git a/osx/applescript-adjustview-10-5.master b/osx/applescript-adjustview-10-5.master deleted file mode 100755 index 19be239..0000000 --- a/osx/applescript-adjustview-10-5.master +++ /dev/null @@ -1,74 +0,0 @@ -on saveImageWithItselfAsIcon(icon_image_file) - -- save icon_image_file with itself as icon - set icon_image_file_string to icon_image_file as string - tell application "Image Events" - launch - set icon_image to open file icon_image_file_string - save icon_image with icon - close icon_image - end tell -end saveImageWithItselfAsIcon - -on copyIconOfTo(aFileOrFolderWithIcon, aFileOrFolder) - tell application "Finder" to set f to aFileOrFolderWithIcon as alias - -- grab the file's icon - my CopyOrPaste(f, "c") - -- now the icon is in the clipboard - tell application "Finder" to set c to aFileOrFolder as alias - my CopyOrPaste(result, "v") -end copyIconOfTo - -on CopyOrPaste(i, cv) - tell application "Finder" - activate - open information window of i - end tell - tell application "System Events" to tell process "Finder" to tell window 1 - keystroke tab -- select icon button - keystroke (cv & "w") using command down (* (copy or paste) + close window *) - end tell -- window 1 then process Finder then System Events -end CopyOrPaste - -on run - set icon_image_file to POSIX file "%s" as alias - set dmg_file to POSIX file "/Volumes/%s" as alias - - my saveImageWithItselfAsIcon(icon_image_file) - -- wait for virus scanner - delay 2 - my copyIconOfTo(icon_image_file, dmg_file) - - tell application "Finder" - tell disk "%s" - open - set current view of container window to icon view - set toolbar visible of container window to false - set statusbar visible of container window to false - set the bounds of container window to {400, 100, 1100, 500} - set theViewOptions to the icon view options of container window - set arrangement of theViewOptions to not arranged - set icon size of theViewOptions to 128 - set background picture of theViewOptions to file ".background:installer-background.png" - if not exists file "Applications" then - make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} - end if - delay 5 - set position of item "%s" of container window to {160, 200} - set position of item ".Trashes" of container window to {100, 500} - set position of item ".installer-background.png" of container window to {200, 500} - set position of item ".DS_Store" of container window to {400, 500} - set position of item "Applications" of container window to {550, 200} - set position of item ".VolumeIcon.icns" of container window to {500, 500} - set position of item ".fseventsd" of container window to {300, 500} - if exists POSIX file ".SymAVx86QSFile" then - set position of item ".SymAVx86QSFile" of container window to {600, 500} - end if - open - close - update without registering applications - -- wait until the virus scan completes - delay 5 - -- eject - end tell - end tell -end run diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 25605bc..fe36df7 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -623,8 +623,8 @@ class MacosxBuilder(object): try: # TODO: Use only one applescript file. Remove one for osx 10.5. f = open(os.path.join(self.script_path, - 'applescript-adjustview-10-6.master')) - p = Popen(["osascript"], stdin=PIPE) + 'applescript-adjust-dmg-view.master')) + p = Popen([self.osascript], stdin=PIPE) p.communicate(f.read() % (dmg_volume_name, 'OpenLP')) f.close() result = p.returncode From caa0e5e90cf9b4720f47ff988072872aaed685b4 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Tue, 26 Jun 2012 00:39:49 +0200 Subject: [PATCH 08/11] Add cli options to specify transifex login on command line. --- osx/macosx-builder.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index fe36df7..74d319d 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -225,6 +225,10 @@ class MacosxBuilder(object): parser.add_argument('--transifex', dest='update_translations', action='store_true', default=False, help='Update the language translation from Transifex.') + parser.add_argument('--transifex-user', + dest='transifex_user', help='Transifex username.') + parser.add_argument('--transifex-pass', + dest='transifex_pass', help='Transifex password.') parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False, help='Print out additional information.') @@ -372,8 +376,7 @@ class MacosxBuilder(object): raise Exception(u'Error running bzr log') output_ascii = unicode(output, errors=u'ignore') latest = output_ascii.split(u':')[0] - version_string = latest == revision and tag or \ - u'%s-bzr%s' % (tag, latest) + version_string = u'%s-bzr%s' % (tag, latest) self.version_string = version_string self.version_tag = tag version_file = open(os.path.join(self.dist_path, u'.version'), u'w') @@ -452,8 +455,14 @@ class MacosxBuilder(object): raise Exception(u'No option named "username" found.') if not self.config.has_option('transifex', 'password'): raise Exception(u'No option named "password" found.') - username = self.config.get(u'transifex', u'username') - password = self.config.get(u'transifex', u'password') + if self.args.transifex_user: + username = self.args.transifex_user + else: + username = self.config.get(u'transifex', u'username') + if self.args.transifex_pass: + password = self.args.transifex_pass + else: + password = self.config.get(u'transifex', u'password') os.chdir(os.path.split(self.i18n_utils)[0]) translation_utils = Popen([self.python, self.i18n_utils, u'-qdpu', u'-U', username, u'-P', password]) From 0d6b003572635c465e6cf469bce6c000c3dc14b6 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Tue, 26 Jun 2012 21:49:33 +0200 Subject: [PATCH 09/11] Cleanup: use self. directly in args assignment. --- osx/macosx-builder.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 74d319d..b76e676 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -269,15 +269,13 @@ class MacosxBuilder(object): Set up a variety of paths that we use throughout the build process. """ if self.args.branch: - branch_path = os.path.abspath(self.args.branch) + self.branch_path = os.path.abspath(self.args.branch) else: - branch_path = self.config.get(u'paths', u'branch') - self.branch_path = branch_path + self.branch_path = self.config.get(u'paths', u'branch') if self.args.docs: - docs_path = os.path.abspath(self.args.docs) + self.docs_path = os.path.abspath(self.args.docs) else: - docs_path = self.config.get(u'paths', u'documentation') - self.docs_path = docs_path + self.docs_path = self.config.get(u'paths', u'documentation') self.openlp_script = os.path.abspath( os.path.join(branch_path, u'openlp.pyw')) From 88e2bc4ed963030de443a65f4d915a0de3468ff1 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Tue, 26 Jun 2012 21:50:12 +0200 Subject: [PATCH 10/11] Cleanup: use self. directly in args assignment. --- osx/macosx-builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index b76e676..0bf6965 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -278,7 +278,7 @@ class MacosxBuilder(object): self.docs_path = self.config.get(u'paths', u'documentation') self.openlp_script = os.path.abspath( - os.path.join(branch_path, u'openlp.pyw')) + os.path.join(self.branch_path, u'openlp.pyw')) self.hooks_path = os.path.abspath(os.path.join( self.branch_path, self.config.get(u'paths', u'hooks'))) self.mac_icon = os.path.abspath( From 40cb404af6b7ee40f5b8fe67fd42065e239594e2 Mon Sep 17 00:00:00 2001 From: Martin Zibricky Date: Wed, 27 Jun 2012 15:13:20 +0200 Subject: [PATCH 11/11] Clean: merge version_string lines in osx build script. --- osx/macosx-builder.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 0bf6965..3b8a16e 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -374,11 +374,10 @@ class MacosxBuilder(object): raise Exception(u'Error running bzr log') output_ascii = unicode(output, errors=u'ignore') latest = output_ascii.split(u':')[0] - version_string = u'%s-bzr%s' % (tag, latest) - self.version_string = version_string + self.version_string = u'%s-bzr%s' % (tag, latest) self.version_tag = tag version_file = open(os.path.join(self.dist_path, u'.version'), u'w') - version_file.write(version_string) + version_file.write(self.version_string) version_file.close() def copy_plugins(self):