1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 04:52:50 +00:00

Fix setting dmg background in osx build.

This commit is contained in:
Martin Zibricky 2012-06-24 19:17:59 +02:00
parent f40225419b
commit d49470614b
2 changed files with 35 additions and 38 deletions

View File

@ -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"

View File

@ -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,