mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 21:12:50 +00:00
Modify OS X builder to build specific release versions
bzr-revno: 16
This commit is contained in:
commit
ee9075cc14
@ -68,17 +68,10 @@ macosx-builder.py
|
|||||||
|
|
||||||
Mako
|
Mako
|
||||||
Mako Templates for Python. This package is required for building the
|
Mako Templates for Python. This package is required for building the
|
||||||
remote plugin. It can be installed by going to your
|
remote plugin.
|
||||||
python_directory\scripts\.. and running "easy_install Mako". If you do not
|
|
||||||
have easy_install, the Mako package can be obtained here:
|
|
||||||
|
|
||||||
http://www.makotemplates.org/download.html
|
Alembic
|
||||||
|
Required for upgrading the databases used in OpenLP.
|
||||||
SQLAlchemy Migrate
|
|
||||||
Required for the databases used in OpenLP. The package can be
|
|
||||||
obtained here:
|
|
||||||
|
|
||||||
http://code.google.com/p/sqlalchemy-migrate/
|
|
||||||
|
|
||||||
MuPDF
|
MuPDF
|
||||||
Required for PDF support in OpenLP. Install using macports, or use the
|
Required for PDF support in OpenLP. Install using macports, or use the
|
||||||
@ -89,32 +82,22 @@ MachOLib
|
|||||||
used by Mac OS X. Used to relink the mudraw binary from MuPDF to the bundled
|
used by Mac OS X. Used to relink the mudraw binary from MuPDF to the bundled
|
||||||
libraries. Install using macports or pip.
|
libraries. Install using macports or pip.
|
||||||
|
|
||||||
MachOLib
|
|
||||||
Python library to analyze and edit Mach-O headers, the executable format
|
|
||||||
used by Mac OS X. Used to relink the mudraw binary from MuPDF to the bundled
|
|
||||||
libraries. Install using macports or pip.
|
|
||||||
|
|
||||||
config.ini.default
|
config.ini.default
|
||||||
The configuration file contains settings of the version string to include
|
The configuration file contains settings of the version string to include
|
||||||
in the bundle as well as directory and file settings for different
|
in the bundle as well as directory and file settings for different
|
||||||
purposes (e.g. PyInstaller location or installer background image)
|
purposes (e.g. PyInstaller location or installer background image)
|
||||||
|
|
||||||
To start the build process do a
|
To install everything you need to install MacPorts. Once MacPorts is installed
|
||||||
|
and up-to-date, run the following command::
|
||||||
|
|
||||||
make
|
$ sudo port install python34 py34-pyqt4 py34-sphinx py34-sqlalchemy \
|
||||||
|
py34-macholib py34-mako py34-alembic py34-enchant \
|
||||||
|
py34-beautifulsoup4 py34-lxml py34-nose
|
||||||
|
|
||||||
The result should be a {openlp_dmgname}.dmg
|
You may need to install chardet via pip::
|
||||||
file in the same directory. If something went wrong - this sometimes happen
|
|
||||||
with the graphical commands in the Apple script - do a
|
|
||||||
|
|
||||||
make clean
|
$ sudo pip install chardet
|
||||||
|
|
||||||
and start the build process again. If you want to execute only parts of the
|
|
||||||
build process you can specify different make targets
|
|
||||||
|
|
||||||
make view -- runs the Apple scripts to set the icons
|
|
||||||
make package -- creates the dmg file and copies the application files
|
|
||||||
make bundle -- compresses the dmg file and sets the dmg file icon
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -220,6 +203,8 @@ class MacosxBuilder(object):
|
|||||||
parser.add_argument('--devel', dest='devel', action='store_true', default=False,
|
parser.add_argument('--devel', dest='devel', action='store_true', default=False,
|
||||||
help='Development build does not have set icons for .dmg file '
|
help='Development build does not have set icons for .dmg file '
|
||||||
'and .dmg filename contains bzr revision number.')
|
'and .dmg filename contains bzr revision number.')
|
||||||
|
parser.add_argument('--release', dest='release', metavar='VERSION',
|
||||||
|
help='Build a release version of OpenLP with the version specified')
|
||||||
parser.add_argument('-d', '--documentation', metavar='DOCS', dest='docs',
|
parser.add_argument('-d', '--documentation', metavar='DOCS', dest='docs',
|
||||||
help='Specify the path to the documentation branch.')
|
help='Specify the path to the documentation branch.')
|
||||||
parser.add_argument('-c', '--config', metavar='CONFIG', dest='config',
|
parser.add_argument('-c', '--config', metavar='CONFIG', dest='config',
|
||||||
@ -277,16 +262,22 @@ class MacosxBuilder(object):
|
|||||||
self.docs_path = os.path.abspath(self.args.docs)
|
self.docs_path = os.path.abspath(self.args.docs)
|
||||||
else:
|
else:
|
||||||
self.docs_path = self.config.get('paths', 'documentation')
|
self.docs_path = self.config.get('paths', 'documentation')
|
||||||
self.openlp_script = os.path.abspath(os.path.join(self.branch_path, 'openlp.py'))
|
if self.args.release:
|
||||||
self.hooks_path = os.path.abspath(os.path.join(self.branch_path, self.config.get('paths', 'hooks')))
|
self.version_number = self.args.release
|
||||||
|
self.work_path = os.path.abspath(os.path.join(self.branch_path, '..', 'OpenLP-' + self.version_number))
|
||||||
|
else:
|
||||||
|
self.version_number = None
|
||||||
|
self.work_path = self.branch_path
|
||||||
|
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.mac_icon = os.path.abspath(self.config.get('paths', 'macicon'))
|
self.mac_icon = os.path.abspath(self.config.get('paths', 'macicon'))
|
||||||
self.bundle_info = os.path.abspath(self.config.get('paths', 'bundleinfo'))
|
self.bundle_info = os.path.abspath(self.config.get('paths', 'bundleinfo'))
|
||||||
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.branch_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.branch_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.branch_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.branch_path, 'build')
|
||||||
self.dist_app_path = os.path.join(self.branch_path, 'dist', 'OpenLP.app')
|
self.dist_app_path = os.path.join(self.branch_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.branch_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS')
|
||||||
@ -317,12 +308,27 @@ class MacosxBuilder(object):
|
|||||||
self._print(output)
|
self._print(output)
|
||||||
raise Exception('Error updating the code')
|
raise Exception('Error updating the code')
|
||||||
|
|
||||||
|
def export_release(self):
|
||||||
|
"""
|
||||||
|
Export a particular release
|
||||||
|
"""
|
||||||
|
if os.path.exists(self.work_path):
|
||||||
|
rmtree(self.work_path)
|
||||||
|
os.chdir(self.branch_path)
|
||||||
|
self._print('Exporting the release version...')
|
||||||
|
bzr = Popen(('bzr', 'export', '-r', 'tag:' + self.version_number, self.work_path), stdout=PIPE)
|
||||||
|
output = bzr.communicate()[0]
|
||||||
|
code = bzr.wait()
|
||||||
|
if code != 0:
|
||||||
|
self._print(output)
|
||||||
|
raise Exception('Error exporting the code')
|
||||||
|
|
||||||
def run_pyinstaller(self):
|
def run_pyinstaller(self):
|
||||||
"""
|
"""
|
||||||
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...')
|
||||||
os.chdir(self.branch_path)
|
os.chdir(self.work_path)
|
||||||
pyinstaller = Popen((self.python,
|
pyinstaller = Popen((self.python,
|
||||||
self.pyinstaller,
|
self.pyinstaller,
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
@ -333,7 +339,7 @@ class MacosxBuilder(object):
|
|||||||
'--log-level=ERROR',
|
'--log-level=ERROR',
|
||||||
# '--distpath', self.branch_path,
|
# '--distpath', self.branch_path,
|
||||||
# '-i', self.mac_icon,
|
# '-i', self.mac_icon,
|
||||||
'-p', self.branch_path,
|
'-p', self.work_path,
|
||||||
'-n', 'OpenLP',
|
'-n', 'OpenLP',
|
||||||
self.openlp_script),
|
self.openlp_script),
|
||||||
stdout=PIPE)
|
stdout=PIPE)
|
||||||
@ -436,7 +442,6 @@ class MacosxBuilder(object):
|
|||||||
text = fr.read()
|
text = fr.read()
|
||||||
text = text % {'openlp_version': self.version_string}
|
text = text % {'openlp_version': self.version_string}
|
||||||
fw.write(text)
|
fw.write(text)
|
||||||
|
|
||||||
fr.close()
|
fr.close()
|
||||||
fw.close()
|
fw.close()
|
||||||
|
|
||||||
@ -703,6 +708,8 @@ class MacosxBuilder(object):
|
|||||||
self._print_verbose('')
|
self._print_verbose('')
|
||||||
if not self.args.skip_update:
|
if not self.args.skip_update:
|
||||||
self.update_code()
|
self.update_code()
|
||||||
|
if self.args.release:
|
||||||
|
self.export_release()
|
||||||
self.run_pyinstaller()
|
self.run_pyinstaller()
|
||||||
self.write_version_file()
|
self.write_version_file()
|
||||||
self.copy_mac_bundle_files()
|
self.copy_mac_bundle_files()
|
||||||
|
Loading…
Reference in New Issue
Block a user