"Various updates to the OS X packaging scripts:

1. Further attempts to make the DMG layout and background stick (still not working)
2. Create a shiny new icon for the DMG with the OpenLP logo on it
3. Create new versions of the app and DMG icons with the new logo for when we move to that
4. Make the builder script work better"

bzr-revno: 30
This commit is contained in:
raoul@snyman.info 2016-05-17 22:55:19 +02:00 committed by Raoul Snyman
commit 36e1961b9d
9 changed files with 81 additions and 57 deletions

View File

@ -1,31 +1,32 @@
on run on run
-- wait for virus scanner -- wait for virus scanner
delay 2 delay 2
tell application "Finder" tell application "Finder"
tell disk "%s" tell disk "%(dmg_name)s"
open open
set current view of container window to icon view set current view of container window to icon view
set toolbar visible of container window to false set toolbar visible of container window to false
set statusbar 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 the bounds of container window to {400, 100, 1100, 500}
set theViewOptions to the icon view options of container window set theViewOptions to the icon view options of container window
set arrangement of theViewOptions to not arranged set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128 set icon size of theViewOptions to 128
set background picture of theViewOptions to file ".background:installer-background.png" set background picture of theViewOptions to file ".background:installer-background.png"
set position of item "%s" of container window to {160, 200} set position of item "%(app_name)s" of container window to {160, 200}
set position of item "Applications" of container window to {550, 200} set position of item "Applications" of container window to {550, 200}
set position of item ".background" of container window to {100, 500} set position of item ".background" of container window to {100, 500}
set position of item ".DS_Store" of container window to {200, 500} set position of item ".DS_Store" of container window to {200, 500}
set position of item ".fseventsd" of container window to {300, 500} set position of item ".fseventsd" of container window to {300, 500}
set position of item ".Trashes" of container window to {400, 500} set position of item ".Trashes" of container window to {400, 500}
set position of item ".VolumeIcon.icns" of container window to {500, 500} set position of item ".VolumeIcon.icns" of container window to {500, 500}
open delay 5
close close
update without registering applications open
-- wait until the virus scan completes update without registering applications
delay 5 -- wait until the virus scan completes
-- eject delay 2
end tell -- eject
end tell end tell
end tell
end run end run

View File

@ -1,17 +1,19 @@
[executables] [executables]
sphinx = sphinx-build-3.4 sphinx = sphinx-build-3.4
pyinstaller = %(projects)s/pyinstaller/pyinstaller.py pyinstaller = %(projects)s/../pyinstaller/pyinstaller.py
lrelease = lrelease lrelease = /opt/local/libexec/qt5/bin/lrelease
diskutil = diskutil diskutil = diskutil
hdiutil = hdiutil hdiutil = hdiutil
osascript = osascript osascript = osascript
mudrawbin = mudraw mudrawbin = mudraw
mutoolbin = mutool
[paths] [paths]
branch = %(projects)s/trunk branch = %(projects)s/trunk
documentation = %(projects)s/documentation documentation = %(projects)s/documentation
macicon = %(here)s/OpenLP.icns app_icon = %(here)s/OpenLP.icns
bundleinfo = %(here)s/Info.plist dmg_icon = %(here)s/openlp-dmg.icns
bundle_info = %(here)s/Info.plist
hooks = %(here)s/../pyinstaller-hooks hooks = %(here)s/../pyinstaller-hooks
dmg_background = %(here)s/DmgImageInstallBackground.png dmg_background = %(here)s/DmgImageInstallBackground.png
@ -20,4 +22,4 @@ username =
password = password =
[codesigning] [codesigning]
certificate = OpenLP certificate = org.openlp.OpenLP

View File

@ -113,7 +113,6 @@ def _which(command):
""" """
for path in os.environ["PATH"].split(os.pathsep): for path in os.environ["PATH"].split(os.pathsep):
if os.access(os.path.join(path, command), os.X_OK): if os.access(os.path.join(path, command), os.X_OK):
print("%s/%s" % (path, command))
return "%s/%s" % (path, command) return "%s/%s" % (path, command)
@ -237,11 +236,12 @@ class MacosxBuilder(object):
""" """
self.sphinx = _which(self.config.get('executables', 'sphinx')) self.sphinx = _which(self.config.get('executables', 'sphinx'))
self.pyinstaller = os.path.abspath(self.config.get('executables', 'pyinstaller')) self.pyinstaller = os.path.abspath(self.config.get('executables', 'pyinstaller'))
self.lrelease = _which(self.config.get('executables', 'lrelease')) self.lrelease = self.config.get('executables', 'lrelease')
self.diskutil = _which(self.config.get('executables', 'diskutil')) self.diskutil = _which(self.config.get('executables', 'diskutil'))
self.hdiutil = _which(self.config.get('executables', 'hdiutil')) self.hdiutil = self.config.get('executables', 'hdiutil')
self.osascript = _which(self.config.get('executables', 'osascript')) self.osascript = _which(self.config.get('executables', 'osascript'))
self.mudraw_bin = _which(self.config.get('executables', 'mudrawbin')) self.mudraw_bin = _which(self.config.get('executables', 'mudrawbin'))
self.mutool_bin = _which(self.config.get('executables', 'mutoolbin'))
def setup_paths(self): def setup_paths(self):
""" """
@ -263,20 +263,21 @@ class MacosxBuilder(object):
self.work_path = self.branch_path self.work_path = self.branch_path
self.openlp_script = os.path.abspath(os.path.join(self.work_path, 'openlp.py')) self.openlp_script = os.path.abspath(os.path.join(self.work_path, 'openlp.py'))
self.hooks_path = os.path.abspath(os.path.join(self.work_path, self.config.get('paths', 'hooks'))) self.hooks_path = os.path.abspath(os.path.join(self.work_path, self.config.get('paths', 'hooks')))
self.mac_icon = os.path.abspath(self.config.get('paths', 'macicon')) self.app_icon = os.path.abspath(self.config.get('paths', 'app_icon'))
self.bundle_info = os.path.abspath(self.config.get('paths', 'bundleinfo')) self.dmg_icon = os.path.abspath(self.config.get('paths', 'dmg_icon'))
self.bundle_info = os.path.abspath(self.config.get('paths', 'bundle_info'))
self.dmg_background_img = os.path.abspath(self.config.get('paths', 'dmg_background')) self.dmg_background_img = os.path.abspath(self.config.get('paths', 'dmg_background'))
self.i18n_utils = os.path.join(self.work_path, 'scripts', 'translation_utils.py') self.i18n_utils = os.path.join(self.work_path, 'scripts', 'translation_utils.py')
self.source_path = os.path.join(self.work_path, 'openlp') self.source_path = os.path.join(self.work_path, 'openlp')
self.manual_path = os.path.join(self.docs_path, 'manual') self.manual_path = os.path.join(self.docs_path, 'manual')
self.manual_build_path = os.path.join(self.manual_path, 'build') self.manual_build_path = os.path.join(self.manual_path, 'build')
self.i18n_path = os.path.join(self.work_path, 'resources', 'i18n') self.i18n_path = os.path.join(self.work_path, 'resources', 'i18n')
self.build_path = os.path.join(self.branch_path, 'build') self.build_path = os.path.join(self.work_path, 'build')
self.dist_app_path = os.path.join(self.branch_path, 'dist', 'OpenLP.app') self.dist_app_path = os.path.join(self.work_path, 'dist', 'OpenLP.app')
self.dist_path = os.path.join(self.branch_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS') self.dist_path = os.path.join(self.work_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS')
# Path to Qt translation files. # Path to Qt translation files.
from PyQt4.QtCore import QCoreApplication from PyQt5.QtCore import QCoreApplication
qt_plug_dir = str(list(QCoreApplication.libraryPaths())[0]) qt_plug_dir = str(list(QCoreApplication.libraryPaths())[0])
self.qt_translat_path = os.path.join(os.path.dirname(qt_plug_dir), 'translations') self.qt_translat_path = os.path.join(os.path.dirname(qt_plug_dir), 'translations')
@ -330,8 +331,7 @@ class MacosxBuilder(object):
'--noupx', '--noupx',
'--additional-hooks-dir', self.hooks_path, '--additional-hooks-dir', self.hooks_path,
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'), '--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'),
'-i', self.mac_icon, '-i', self.app_icon,
'-p', self.work_path,
'-n', 'OpenLP', '-n', 'OpenLP',
self.openlp_script] self.openlp_script]
if not self.args.verbose: if not self.args.verbose:
@ -431,7 +431,7 @@ class MacosxBuilder(object):
""" """
Copy Info.plist and OpenLP.icns to app bundle. Copy Info.plist and OpenLP.icns to app bundle.
""" """
copy(self.mac_icon, os.path.join(self.dist_app_path, 'Contents', 'Resources', os.path.basename(self.mac_icon))) copy(self.app_icon, os.path.join(self.dist_app_path, 'Contents', 'Resources', os.path.basename(self.app_icon)))
# Add OpenLP version to Info.plist and put it to app bundle. # Add OpenLP version to Info.plist and put it to app bundle.
fr = open(self.bundle_info, 'r') fr = open(self.bundle_info, 'r')
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w') fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w')
@ -455,17 +455,32 @@ class MacosxBuilder(object):
if self.mudraw_bin and os.path.isfile(self.mudraw_bin): if self.mudraw_bin and os.path.isfile(self.mudraw_bin):
copy(os.path.join(self.mudraw_bin), os.path.join(self.dist_path, 'mudraw')) copy(os.path.join(self.mudraw_bin), os.path.join(self.dist_path, 'mudraw'))
self.relink_mudraw() self.relink_mudraw()
elif self.mutool_bin and os.path.isfile(self.mutool_bin):
copy(os.path.join(self.mutool_bin), os.path.join(self.dist_path, 'mutool'))
self.relink_mutool()
else: else:
self._print('... WARNING: mudraw not found') self._print('... WARNING: mudraw and mutool not found')
def relink_mudraw(self): def relink_mudraw(self):
""" """
Relink mudraw to bundled libraries Relink mudraw to bundled libraries
""" """
self._print('Linking mudraw with bundled libraries...') self.relink_mupdf('mudraw')
libname = os.path.join(self.dist_path, 'mudraw')
def relink_mutool(self):
"""
Relink mudraw to bundled libraries
"""
self.relink_mupdf('mutool')
def relink_mupdf(self, bin_name):
"""
Relink mupdf to bundled libraries
"""
self._print('Linking {bin_name} with bundled libraries...'.format(bin_name=bin_name))
libname = os.path.join(self.dist_path, bin_name)
distname = os.path.relpath(self.dist_path, libname) distname = os.path.relpath(self.dist_path, libname)
self._print_verbose('... mudraw path %s', libname) self._print_verbose('... {bin_name} path {path}'.format(bin_name=bin_name, path=libname))
# Determine how many directories up is the directory with shared # Determine how many directories up is the directory with shared
# dynamic libraries. '../' # dynamic libraries. '../'
@ -613,7 +628,7 @@ class MacosxBuilder(object):
else: else:
dmg_name = 'OpenLP-' + str(self.version_tag) + '.dmg' dmg_name = 'OpenLP-' + str(self.version_tag) + '.dmg'
dmg_file = os.path.join(self.branch_path, 'build', dmg_name) dmg_file = os.path.join(self.work_path, 'build', dmg_name)
# Remove dmg if it exists. # Remove dmg if it exists.
if os.path.exists(dmg_file): if os.path.exists(dmg_file):
os.remove(dmg_file) os.remove(dmg_file)
@ -644,7 +659,7 @@ class MacosxBuilder(object):
# http://endrift.com/blog/2010/06/14/dmg-files-volume-icons-cli/ # http://endrift.com/blog/2010/06/14/dmg-files-volume-icons-cli/
self._print('... Setting the dmg icon.') self._print('... Setting the dmg icon.')
dmg_icon = os.path.join(dmg_volume_path, '.VolumeIcon.icns') dmg_icon = os.path.join(dmg_volume_path, '.VolumeIcon.icns')
self._run_command(['cp', self.mac_icon, dmg_icon], 'Could not copy the dmg icon file, dmg creation failed.') self._run_command(['cp', self.dmg_icon, dmg_icon], 'Could not copy the dmg icon file, dmg creation failed.')
# Set proper dmg icon attributes. # Set proper dmg icon attributes.
self._run_command(['SetFile', '-c', 'icnC', dmg_icon], 'Could not set 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. # Ensures dmg icon will be used while mounted.
@ -684,7 +699,7 @@ class MacosxBuilder(object):
# Compress dmg file. # Compress dmg file.
self._print('... compressing the dmg file') self._print('... compressing the dmg file')
compressed_dmg = os.path.join(self.branch_path, 'dist', os.path.basename(dmg_file)) # Put dmg to 'dist' dir. compressed_dmg = os.path.join(self.work_path, 'dist', os.path.basename(dmg_file)) # Put dmg to 'dist' dir.
# Remove dmg if it exists. # Remove dmg if it exists.
if os.path.exists(compressed_dmg): if os.path.exists(compressed_dmg):
os.remove(compressed_dmg) os.remove(compressed_dmg)
@ -708,11 +723,12 @@ class MacosxBuilder(object):
def adjust_dmg_view(self, dmg_volume_name): def adjust_dmg_view(self, dmg_volume_name):
try: try:
# TODO: Use only one applescript file. Remove one for osx 10.5. master_script = os.path.join(self.script_path, 'applescript-adjust-dmg-view.master')
f = open(os.path.join(self.script_path, 'applescript-adjust-dmg-view.master')) apple_script = os.path.join(self.script_path, 'adjust-dmg-view.applescript')
p = Popen([self.osascript], stdin=PIPE) with open(master_script) as r, open(apple_script, 'w') as w:
p.communicate(bytes(f.read() % (dmg_volume_name, 'OpenLP'), 'utf-8')) apple_script = r.read() % {'dmg_name': dmg_volume_name, 'app_name': 'OpenLP.app'}
f.close() w.write(apple_script)
p = Popen([self.osascript, apple_script])
result = p.returncode result = p.returncode
if (result != 0): if (result != 0):
self._print('Adjusting dmg view failed (non-zero exit code).') self._print('Adjusting dmg view failed (non-zero exit code).')
@ -732,7 +748,12 @@ class MacosxBuilder(object):
self._print_verbose('"hooks" path: ............%s', self.hooks_path) self._print_verbose('"hooks" path: ............%s', self.hooks_path)
self._print_verbose('PyInstaller: .............%s', self.pyinstaller) self._print_verbose('PyInstaller: .............%s', self.pyinstaller)
self._print_verbose('Documentation branch path:%s', self.docs_path) self._print_verbose('Documentation branch path:%s', self.docs_path)
self._print_verbose('Mudraw binary ............%s', self.mudraw_bin) if self.mudraw_bin:
self._print_verbose('mudraw binary ............%s', self.mudraw_bin)
elif self.mutool_bin:
self._print_verbose('mutool binary ............%s', self.mutool_bin)
else:
self._print_verbose('mutool/mudraw ............Not found')
self._print_verbose('') self._print_verbose('')
if not self.args.skip_update: if not self.args.skip_update:
self.update_code() self.update_code()

BIN
osx/openlp-dmg.icns Normal file

Binary file not shown.

BIN
osx/openlp-dmg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
osx/openlp-logo-new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

BIN
osx/openlp-new-dmg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
osx/openlp-new-dmg.png.icns Normal file

Binary file not shown.