diff --git a/osx/Info.plist b/osx/Info.plist index 83946c9..b83db22 100755 --- a/osx/Info.plist +++ b/osx/Info.plist @@ -120,5 +120,9 @@ NSHighResolutionCapable + CFBundleHelpBookFolder + OpenLP.help + CFBundleHelpBookName + org.openlp.OpenLP.help diff --git a/osx/macosx-builder.py b/osx/macosx-builder.py index 652baaf..1243be0 100644 --- a/osx/macosx-builder.py +++ b/osx/macosx-builder.py @@ -98,7 +98,7 @@ import plistlib import signal import subprocess import sys -from shutil import copy, rmtree +from shutil import copy, copytree, rmtree from subprocess import Popen, PIPE from configparser import ConfigParser from argparse import ArgumentParser @@ -567,12 +567,41 @@ class MacosxBuilder(object): rmtree(self.manual_build_path) self._print('Running Sphinx...') os.chdir(self.manual_path) - sphinx = Popen((self.sphinx, '-b', 'htmlhelp', '-d', 'build/doctrees', 'source', 'build/htmlhelp'), stdout=PIPE) + sphinx = Popen((self.sphinx, '-b', 'applehelp', '-d', 'build/doctrees', 'source', 'build/applehelp'), + stdout=PIPE) output, error = sphinx.communicate() code = sphinx.wait() if code != 0: self._print(output) raise Exception('Error running Sphinx') + self._print('Copying help file...') + source = os.path.join(self.manual_build_path, 'applehelp') + files = os.listdir(source) + for filename in files: + if filename.endswith('.help'): + self._print_verbose('... %s', filename) + copytree(os.path.join(source, filename), + os.path.join(self.dist_app_path, 'Contents', 'Resources', filename)) + + def code_sign(self): + certificate = self.config.get('codesigning', 'certificate') + self._print('Checking for certificate...') + security = Popen(('security', 'find-certificate', '-c', certificate), + stdout=PIPE) + output, error = security.communicate() + code = security.wait() + if code != 0: + self._print('Could not find certificate \"%s\" in Keychain...', certificate) + self._print('Codesigning will not work without a certificate!!') + self._print(output) + else: + self._print('Codesigning app...') + codesign = Popen(('codesign', '--deep', '-s', certificate, self.dist_app_path)) + output, error = codesign.communicate() + code = codesign.wait() + if code != 0: + self._print(output) + raise Exception('Error running codesign') def create_dmg_file(self): """ @@ -730,6 +759,7 @@ class MacosxBuilder(object): if self.args.update_translations: self.update_translations() self.compile_translations() + self.code_sign() self.create_dmg_file() self._print('Done.')