mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 21:12:50 +00:00
Fix up the rest of the macOS builder
This commit is contained in:
parent
dbd59b9a3c
commit
05dde36a9e
@ -31,22 +31,30 @@ from subprocess import Popen, PIPE
|
|||||||
|
|
||||||
BUILDER_DESCRIPTION = 'Build OpenLP for {platform}. Options are provided on both the command line and a ' \
|
BUILDER_DESCRIPTION = 'Build OpenLP for {platform}. Options are provided on both the command line and a ' \
|
||||||
'configuration file. Options in the configuration file are overridden by the command line options.\n\n' \
|
'configuration file. Options in the configuration file are overridden by the command line options.\n\n' \
|
||||||
'This build system can produce either development or release builds. A development release uses the code ' \
|
'This build system can produce either development or release builds. A development release uses the ' \
|
||||||
'as-is in the specified branch directory. The release build exports a tag from bzr and uses the exported ' \
|
'code as-is in the specified branch directory. The release build exports a tag from bzr and uses the ' \
|
||||||
'code for building. The two modes are invoked by the presence or absence of the --release option. If this ' \
|
'exported code for building. The two modes are invoked by the presence or absence of the --release ' \
|
||||||
'option is omitted, a development build is built, while including the --release option with a version ' \
|
'option. If this option is omitted, a development build is built, while including the --release ' \
|
||||||
'number will produce a build of that exact version.'
|
'option with a version number will produce a build of that exact version.'
|
||||||
|
|
||||||
|
|
||||||
def _which(command):
|
def _which(program):
|
||||||
"""
|
"""
|
||||||
Return absolute path to a command found on system PATH.
|
Return absolute path to a command found on system PATH.
|
||||||
"""
|
"""
|
||||||
if command.startswith('/'):
|
def is_exe(fpath):
|
||||||
return command
|
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
|
||||||
for path in os.environ["PATH"].split(os.pathsep):
|
|
||||||
if os.access(os.path.join(path, command), os.X_OK):
|
fpath, fname = os.path.split(program)
|
||||||
return "%s/%s" % (path, command)
|
if fpath and is_exe(program):
|
||||||
|
return program
|
||||||
|
else:
|
||||||
|
for path in os.environ['PATH'].split(os.pathsep):
|
||||||
|
path = path.strip('"')
|
||||||
|
exe_file = os.path.join(path, program)
|
||||||
|
if is_exe(exe_file):
|
||||||
|
return exe_file
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Builder(object):
|
class Builder(object):
|
||||||
@ -168,7 +176,11 @@ class Builder(object):
|
|||||||
"""
|
"""
|
||||||
self._print_verbose('Executables:')
|
self._print_verbose('Executables:')
|
||||||
for option in self.config.options('executables'):
|
for option in self.config.options('executables'):
|
||||||
value = _which(self.config.get('executables', option))
|
value = self.config.get('executables', option)
|
||||||
|
if not value.strip():
|
||||||
|
value = None
|
||||||
|
else:
|
||||||
|
value = _which(value)
|
||||||
setattr(self, '{option}_exe'.format(option=option), value)
|
setattr(self, '{option}_exe'.format(option=option), value)
|
||||||
self._print_verbose(' {option:.<30}: {value}'.format(option=option + ' ', value=value))
|
self._print_verbose(' {option:.<30}: {value}'.format(option=option + ' ', value=value))
|
||||||
|
|
||||||
@ -233,6 +245,7 @@ class Builder(object):
|
|||||||
Run PyInstaller on the branch to build an executable.
|
Run PyInstaller on the branch to build an executable.
|
||||||
"""
|
"""
|
||||||
self._print('Running PyInstaller...')
|
self._print('Running PyInstaller...')
|
||||||
|
copy(os.path.join(self.work_path, 'openlp.py'), self.openlp_script)
|
||||||
os.chdir(self.work_path)
|
os.chdir(self.work_path)
|
||||||
cmd = [self.python,
|
cmd = [self.python,
|
||||||
self.pyinstaller_exe,
|
self.pyinstaller_exe,
|
||||||
@ -249,7 +262,7 @@ class Builder(object):
|
|||||||
cmd.append('--log-level=ERROR')
|
cmd.append('--log-level=ERROR')
|
||||||
else:
|
else:
|
||||||
cmd.append('--log-level=DEBUG')
|
cmd.append('--log-level=DEBUG')
|
||||||
if self.args.devel:
|
if not self.args.release:
|
||||||
cmd.append('-d')
|
cmd.append('-d')
|
||||||
self._run_command(cmd, 'Error running PyInstaller')
|
self._run_command(cmd, 'Error running PyInstaller')
|
||||||
|
|
||||||
@ -381,10 +394,10 @@ class Builder(object):
|
|||||||
"""
|
"""
|
||||||
Run Sphinx to build the manual
|
Run Sphinx to build the manual
|
||||||
"""
|
"""
|
||||||
self._print('Deleting previous help manual build... %s', self.manual_build_path)
|
self._print('Running Sphinx...')
|
||||||
|
self._print_verbose(' Deleting previous help manual build... %s', self.manual_build_path)
|
||||||
if os.path.exists(self.manual_build_path):
|
if os.path.exists(self.manual_build_path):
|
||||||
rmtree(self.manual_build_path)
|
rmtree(self.manual_build_path)
|
||||||
self._print('Running Sphinx...')
|
|
||||||
os.chdir(self.manual_path)
|
os.chdir(self.manual_path)
|
||||||
sphinx_build = self.get_sphinx_build()
|
sphinx_build = self.get_sphinx_build()
|
||||||
command = [self.sphinx_exe, '-b', sphinx_build, '-d', 'build/doctrees', 'source', 'build/{}'.format(sphinx_build)]
|
command = [self.sphinx_exe, '-b', sphinx_build, '-d', 'build/doctrees', 'source', 'build/{}'.format(sphinx_build)]
|
||||||
@ -420,8 +433,6 @@ class Builder(object):
|
|||||||
self.copy_default_theme()
|
self.copy_default_theme()
|
||||||
self.copy_plugins()
|
self.copy_plugins()
|
||||||
self.copy_media_player()
|
self.copy_media_player()
|
||||||
self.copy_extra_files()
|
|
||||||
# TODO creating help on Mac
|
|
||||||
if os.path.exists(self.manual_path):
|
if os.path.exists(self.manual_path):
|
||||||
self.run_sphinx()
|
self.run_sphinx()
|
||||||
else:
|
else:
|
||||||
@ -429,13 +440,12 @@ class Builder(object):
|
|||||||
self._print('WARNING: Documentation trunk not found')
|
self._print('WARNING: Documentation trunk not found')
|
||||||
self._print(' Help file will not be included in build')
|
self._print(' Help file will not be included in build')
|
||||||
self._print('')
|
self._print('')
|
||||||
self.copy_macosx_files()
|
self.copy_extra_files()
|
||||||
if not self.args.skip_translations:
|
if not self.args.skip_translations:
|
||||||
if self.args.update_translations:
|
if self.args.update_translations:
|
||||||
self.update_translations()
|
self.update_translations()
|
||||||
self.compile_translations()
|
self.compile_translations()
|
||||||
self.code_sign()
|
self.build_package()
|
||||||
self.create_dmg_file()
|
|
||||||
|
|
||||||
self._print('Done.')
|
self._print('Done.')
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
|
@ -119,14 +119,20 @@ class MacosxBuilder(Builder):
|
|||||||
dir_size += os.path.getsize(filename)
|
dir_size += os.path.getsize(filename)
|
||||||
return dir_size
|
return dir_size
|
||||||
|
|
||||||
|
def get_sphinx_build(self):
|
||||||
|
"""
|
||||||
|
The type of build Sphinx should be doing
|
||||||
|
"""
|
||||||
|
return 'applehelp'
|
||||||
|
|
||||||
def setup_paths(self):
|
def setup_paths(self):
|
||||||
"""
|
"""
|
||||||
Extra setup to run
|
Extra setup to run
|
||||||
"""
|
"""
|
||||||
super().setup_paths()
|
super().setup_paths()
|
||||||
if hasattr(self, 'mutoolbin'):
|
if hasattr(self, 'mutool_exe'):
|
||||||
self.mutoollib = os.path.abspath(
|
self.mutool_lib = os.path.abspath(
|
||||||
os.path.join(os.path.dirname(self.mutoolbin), '..', 'lib', 'libjbig2dec.0.dylib'))
|
os.path.join(os.path.dirname(self.mutool_exe), '..', 'lib', 'libjbig2dec.0.dylib'))
|
||||||
self.dist_app_path = os.path.join(self.work_path, 'dist', 'OpenLP.app')
|
self.dist_app_path = os.path.join(self.work_path, 'dist', 'OpenLP.app')
|
||||||
self.dist_path = os.path.join(self.work_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS')
|
self.dist_path = os.path.join(self.work_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS')
|
||||||
|
|
||||||
@ -157,15 +163,15 @@ class MacosxBuilder(Builder):
|
|||||||
"""
|
"""
|
||||||
self._print('Copying extra files for Mac OS X...')
|
self._print('Copying extra files for Mac OS X...')
|
||||||
self._print_verbose('... LICENSE.txt')
|
self._print_verbose('... LICENSE.txt')
|
||||||
copy(os.path.join(self.script_path, 'LICENSE.txt'), os.path.join(self.dist_path, 'LICENSE.txt'))
|
copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt'))
|
||||||
self._print_verbose('... mudraw')
|
self._print_verbose('... mudraw')
|
||||||
if hasattr(self, 'mudrawbin') and os.path.isfile(self.mudrawbin):
|
if hasattr(self, 'mudraw_exe') and self.mudraw_exe and os.path.isfile(self.mudraw_exe):
|
||||||
copy(self.mudrawbin, os.path.join(self.dist_path, 'mudraw'))
|
copy(self.mudraw_exe, os.path.join(self.dist_path, 'mudraw'))
|
||||||
self.relink_mudraw()
|
self.relink_mudraw()
|
||||||
elif hasattr(self, 'mutoolbin') and os.path.isfile(self.mutoolbin):
|
elif hasattr(self, 'mutool_exe') and self.mutool_exe and os.path.isfile(self.mutool_exe):
|
||||||
copy(self.mutoolbin, os.path.join(self.dist_path, 'mutool'))
|
copy(self.mutool_exe, os.path.join(self.dist_path, 'mutool'))
|
||||||
self.relink_mutool()
|
self.relink_mutool()
|
||||||
copy(self.mutoollib, os.path.join(self.dist_path, 'libjbig2dec.0.dylib'))
|
copy(self.mutool_lib, os.path.join(self.dist_path, 'libjbig2dec.0.dylib'))
|
||||||
else:
|
else:
|
||||||
self._print('... WARNING: mudraw and mutool not found')
|
self._print('... WARNING: mudraw and mutool not found')
|
||||||
|
|
||||||
@ -274,7 +280,7 @@ class MacosxBuilder(Builder):
|
|||||||
size += 10
|
size += 10
|
||||||
|
|
||||||
self._print('... %s' % self.script_path)
|
self._print('... %s' % self.script_path)
|
||||||
os.chdir(self.script_path)
|
os.chdir(os.path.dirname(self.dmg_settings_path))
|
||||||
self._run_command([self.dmgbuild_exe, '-s', self.dmg_settings_path, '-D', 'size={size}M'.format(size=size),
|
self._run_command([self.dmgbuild_exe, '-s', self.dmg_settings_path, '-D', 'size={size}M'.format(size=size),
|
||||||
'-D', 'icon={icon_path}'.format(icon_path=self.icon_path),
|
'-D', 'icon={icon_path}'.format(icon_path=self.icon_path),
|
||||||
'-D', 'app={dist_app_path}'.format(dist_app_path=self.dist_app_path), dmg_title, self.dmg_file],
|
'-D', 'app={dist_app_path}'.format(dist_app_path=self.dist_app_path), dmg_title, self.dmg_file],
|
||||||
|
0
builders/windows-builder.py
Executable file → Normal file
0
builders/windows-builder.py
Executable file → Normal file
Loading…
Reference in New Issue
Block a user