1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00
This commit is contained in:
Raoul Snyman 2019-05-22 14:55:08 -07:00
commit a9691be825
37 changed files with 2817 additions and 2154 deletions

522
builders/builder.py Normal file
View File

@ -0,0 +1,522 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2004-2016 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Base class for the Windows and macOS builders.
"""
import os
import sys
from argparse import ArgumentParser
from configparser import ConfigParser
from shutil import copy, rmtree
from subprocess import Popen, PIPE
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' \
'This build system can produce either development or release builds. A development release uses the ' \
'code as-is in the specified branch directory. The release build exports a tag from bzr and uses the ' \
'exported code for building. The two modes are invoked by the presence or absence of the --release ' \
'option. If this option is omitted, a development build is built, while including the --release ' \
'option with a version number will produce a build of that exact version.'
def _which(program):
"""
Return absolute path to a command found on system PATH.
"""
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath and is_exe(os.path.abspath(program)):
return os.path.abspath(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):
"""
A Generic class to base other operating system specific builders on
"""
def __init__(self):
self.setup_args()
self.setup_system_paths()
self.read_config()
self.setup_paths()
self.setup_executables()
self.setup_extra()
def _print(self, text, *args):
"""
Print stuff out. Later we might want to use a log file.
"""
if len(args) > 0:
text = text % tuple(args)
print(text)
def _print_verbose(self, text, *args):
"""
Print output, obeying "verbose" mode.
"""
if self.args.verbose:
self._print(text, *args)
def _run_command(self, cmd, err_msg, exit_code=0):
"""
Run command in subprocess and print error message in case of Exception.
Return text from stdout.
"""
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
output, error = proc.communicate()
code = proc.wait()
if code != exit_code:
self._print(output)
self._print(error)
raise Exception(err_msg)
return output, error
def _bzr(self, command, work_path, args=[], err_msg='There was an error running bzr'):
"""
Update the code in the branch.
"""
os.chdir(work_path)
output, _ = self._run_command(['bzr', command] + args, err_msg)
return output
def get_platform(self):
"""
Return the platform we're building for
"""
return 'unspecified'
def get_config_defaults(self):
"""
Build some default values for the config file
"""
return {'here': os.path.dirname(self.config_path)}
def get_sphinx_build(self):
"""
Get the type of build we should be running for Sphinx. Defaults to html.
"""
return 'html'
def get_qt_translations_path(self):
"""
Return the path to Qt's translation files
"""
return ''
def add_extra_args(self, parser):
"""
Add extra arguments to the argument parser
"""
pass
def setup_args(self):
"""
Set up an argument parser and parse the command line arguments.
"""
parser = ArgumentParser(description=BUILDER_DESCRIPTION.format(platform=self.get_platform()))
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
help='Print out additional information')
parser.add_argument('-c', '--config', metavar='FILENAME', required=True,
help='Specify the path to the configuration file')
parser.add_argument('-b', '--branch', metavar='PATH', help='Specify the path to the branch you wish to build')
parser.add_argument('-r', '--release', metavar='VERSION', default=None,
help='Build a release version of OpenLP with the version specified')
parser.add_argument('-d', '--documentation', metavar='PATH', default=None,
help='Specify the path to the documentation branch')
parser.add_argument('-t', '--update-translations', action='store_true', default=False,
help='Update the translations from Transifex')
parser.add_argument('-u', '--transifex-user', metavar='USERNAME', default=None, help='Transifex username')
parser.add_argument('-p', '--transifex-pass', metavar='PASSWORD', default=None, help='Transifex password')
parser.add_argument('--skip-update', action='store_true', default=False,
help='Do NOT update the branch before building')
parser.add_argument('--skip-translations', action='store_true', default=False,
help='Do NOT update the language translation files')
parser.add_argument('--debug', action='store_true', default=False, help='Create a debug build')
parser.add_argument('--tag-override', metavar='<tag>-bzr<revision>', default=None,
help='Override tag and revision, should be in format <tag>-bzr<revision>')
self.add_extra_args(parser)
self.args = parser.parse_args()
def read_config(self):
"""
Read the configuration from the configuration file.
"""
self.config = ConfigParser(defaults=self.get_config_defaults())
self.config.read(self.config_path)
def setup_system_paths(self):
"""
Set up some system paths.
"""
self.python = sys.executable
self.script_path = os.path.dirname(os.path.abspath(__file__))
self.config_path = os.path.abspath(self.args.config)
self._print_verbose('System paths:')
self._print_verbose(' {:.<20}: {}'.format('python: ', self.python))
self._print_verbose(' {:.<20}: {}'.format('script: ', self.script_path))
self._print_verbose(' {:.<20}: {}'.format('config: ', self.config_path))
def setup_executables(self):
"""
Set up the paths to the executables we use.
"""
self._print_verbose('Executables:')
for executable in self.config.options('executables'):
path = self.config.get('executables', executable)
if not path.strip():
path = None
else:
path = _which(path)
setattr(self, '{exe}_exe'.format(exe=executable), path)
self._print_verbose(' {exe:.<20} {path}'.format(exe=executable + ': ', path=path))
def setup_paths(self):
"""
Set up a variety of paths that we use throughout the build process.
"""
self._print_verbose('Paths:')
for name in self.config.options('paths'):
path = os.path.abspath(self.config.get('paths', name))
setattr(self, '{name}_path'.format(name=name), path)
self._print_verbose(' {name:.<20} {path}'.format(name=name + ': ', path=path))
# Make any command line options override the config file
if self.args.branch:
self.branch_path = os.path.abspath(self.args.branch)
if self.args.documentation:
self.documentation_path = os.path.abspath(self.args.documentation)
if self.args.release:
self.version = self.args.release
self.work_path = os.path.abspath(os.path.join(self.branch_path, '..', 'OpenLP-' + self.version))
else:
self.version = None
self.work_path = self.branch_path
self.openlp_script = os.path.abspath(os.path.join(self.work_path, 'run_openlp.py'))
self.source_path = os.path.join(self.work_path, 'openlp')
self.manual_path = os.path.join(self.documentation_path, 'manual')
self.manual_build_path = os.path.join(self.manual_path, 'build')
self.i18n_utils = os.path.join(self.work_path, 'scripts', 'translation_utils.py')
self.i18n_path = os.path.join(self.work_path, 'resources', 'i18n')
self.build_path = os.path.join(self.work_path, 'build')
# Print out all the values
self._print_verbose(' {:.<20} {}'.format('openlp script: ', self.openlp_script))
self._print_verbose(' {:.<20} {}'.format('source: ', self.source_path))
self._print_verbose(' {:.<20} {}'.format('manual path: ', self.manual_path))
self._print_verbose(' {:.<20} {}'.format('manual build path: ', self.manual_build_path))
self._print_verbose(' {:.<20} {}'.format('i18n utils: ', self.i18n_utils))
self._print_verbose(' {:.<20} {}'.format('i18n path: ', self.i18n_path))
self._print_verbose(' {:.<20} {}'.format('build path: ', self.build_path))
self._print_verbose('Overrides:')
self._print_verbose(' {:.<20} {}'.format('branch **: ', self.branch_path))
self._print_verbose(' {:.<20} {}'.format('documentation **: ', self.documentation_path))
self._print_verbose(' {:.<20} {}'.format('version: ', self.version))
self._print_verbose(' {:.<20} {}'.format('work path: ', self.work_path))
def setup_extra(self):
"""
Extra setup to run
"""
pass
def update_code(self):
"""
Update the code in the branch.
"""
self._print('Reverting any changes to the code...')
self._bzr('revert', self.branch_path, err_msg='Error reverting the code')
self._print('Cleaning any extra files...')
self._bzr('clean-tree', self.branch_path, ['--quiet', '--force', '--ignored', '--unknown'],
err_msg='Error cleaning up extra files')
self._print('Updating the code...')
self._bzr('update', self.branch_path, err_msg='Error updating the code')
def export_release(self):
"""
Export a particular release
"""
if os.path.exists(self.work_path):
rmtree(self.work_path)
self._print('Exporting the release version...')
self._bzr('export', self.branch_path, ['-r', 'tag:' + self.version, self.work_path],
'Error exporting the code')
def get_extra_parameters(self):
"""
Return a list of any extra parameters we wish to use
"""
return []
def run_pyinstaller(self):
"""
Run PyInstaller on the branch to build an executable.
"""
self._print('Running PyInstaller...')
os.chdir(self.work_path)
if self.pyinstaller_exe.endswith('.py'):
cmd = [self.python, self.pyinstaller_exe]
else:
cmd = [self.pyinstaller_exe]
cmd.extend([
'--clean',
'--noconfirm',
'--windowed',
'--noupx',
'--additional-hooks-dir', self.hooks_path,
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'),
'-i', self.icon_path,
'-n', 'OpenLP',
*self.get_extra_parameters(), # Adds any extra parameters we wish to use
self.openlp_script
])
if self.args.verbose:
cmd.append('--log-level=DEBUG')
else:
cmd.append('--log-level=ERROR')
if self.args.debug:
cmd.append('-d')
self._print_verbose('... {}'.format(' '.join(cmd)))
output, error = self._run_command(cmd, 'Error running PyInstaller')
self._print_verbose(output)
self._print_verbose(error)
def write_version_file(self):
"""
Write the version number to a file for reading once installed.
"""
self._print('Writing version file...')
if not self.args.release:
if self.args.tag_override:
self.version = self.args.tag_override
else:
# This is a development build, get the tag and revision
output = self._bzr('tags', self.branch_path, err_msg='Error running bzr tags')
lines = output.splitlines()
if len(lines) == 0:
tag = '0.0.0'
revision = '0'
else:
tag, revision = lines[-1].split()
output = self._bzr('log', self.branch_path, ['--line', '-r', '-1'], 'Error running bzr log')
revision = output.split(':')[0]
self.version = '{tag}.dev{revision}'.format(tag=tag, revision=revision)
# Write the version to the version file
with open(os.path.join(self.dist_path, '.version'), 'w') as version_file:
version_file.write(str(self.version))
def copy_default_theme(self):
"""
Copy the default theme to the correct directory for OpenLP.
"""
self._print('Copying default theme...')
source = os.path.join(self.source_path, 'core', 'lib', 'json')
dest = os.path.join(self.dist_path, 'core', 'lib', 'json')
for root, _, files in os.walk(source):
for filename in files:
if filename.endswith('.json'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_plugins(self):
"""
Copy all the plugins to the correct directory so that OpenLP sees that
it has plugins.
"""
self._print('Copying plugins...')
source = os.path.join(self.source_path, 'plugins')
dest = os.path.join(self.dist_path, 'plugins')
for root, _, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_media_player(self):
"""
Copy the media players to the correct directory for OpenLP.
"""
self._print('Copying media player...')
source = os.path.join(self.source_path, 'core', 'ui', 'media')
dest = os.path.join(self.dist_path, 'core', 'ui', 'media')
for root, _, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_font_files(self):
"""
Copy OpenLP font files
"""
self._print('Copying OpenLP fonts files...')
src_dir = os.path.join(self.source_path, 'core', 'ui', 'fonts')
dst_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts')
font_files = ['OpenLP.ttf', 'openlp-charmap.json']
os.makedirs(dst_dir)
for font_file in font_files:
src = os.path.join(src_dir, font_file)
dst = os.path.join(dst_dir, font_file)
copy(src, dst)
def copy_display_files(self):
"""
Copy OpenLP display HTML files
"""
self._print('Copying OpenLP HTML display files...')
src_dir = os.path.join(self.source_path, 'core', 'display', 'html')
dst_dir = os.path.join(self.dist_path, 'core', 'display', 'html')
os.makedirs(dst_dir)
for display_file in os.listdir(src_dir):
src = os.path.join(src_dir, display_file)
dst = os.path.join(dst_dir, display_file)
copy(src, dst)
def copy_extra_files(self):
"""
Copy any extra files which are particular to a platform
"""
pass
def update_translations(self):
"""
Update the translations.
"""
self._print('Updating translations...')
username = None
password = None
if self.args.transifex_user:
username = self.args.transifex_user
if self.args.transifex_password:
password = self.args.transifex_pass
if (not username or not password) and not self.config.has_section('transifex'):
raise Exception('No section named "transifex" found.')
elif not username and not self.config.has_option('transifex', 'username'):
raise Exception('No option named "username" found.')
elif not password and not self.config.has_option('transifex', 'password'):
raise Exception('No option named "password" found.')
if not username:
username = self.config.get('transifex', 'username')
if not password:
password = self.config.get('transifex', 'password')
os.chdir(os.path.split(self.i18n_utils)[0])
self._run_command([self.python, self.i18n_utils, '-qdpu', '-U', username, '-P', password],
err_msg='Error running translation_utils.py')
def compile_translations(self):
"""
Compile the translations for Qt.
"""
self._print('Compiling translations...')
if not os.path.exists(os.path.join(self.dist_path, 'i18n')):
os.makedirs(os.path.join(self.dist_path, 'i18n'))
for filename in os.listdir(self.i18n_path):
if filename.endswith('.ts'):
self._print_verbose('... %s', filename)
source_path = os.path.join(self.i18n_path, filename)
dest_path = os.path.join(self.dist_path, 'i18n', filename.replace('.ts', '.qm'))
self._run_command((self.lrelease_exe, '-compress', '-silent', source_path, '-qm', dest_path),
err_msg='Error running lconvert on %s' % source_path)
self._print('Copying Qt translation files...')
source = self.get_qt_translations_path()
for filename in os.listdir(source):
if filename.startswith('qt') and filename.endswith('.qm'):
self._print_verbose('... %s', filename)
copy(os.path.join(source, filename), os.path.join(self.dist_path, 'i18n', filename))
def run_sphinx(self):
"""
Run Sphinx to build the manual
"""
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):
rmtree(self.manual_build_path)
os.chdir(self.manual_path)
sphinx_build = self.get_sphinx_build()
command = [self.sphinx_exe, '-b', sphinx_build, '-d', 'build/doctrees', 'source',
'build/{}'.format(sphinx_build)]
self._run_command(command, 'Error running Sphinx')
self.after_run_sphinx()
def after_run_sphinx(self):
"""
Run some extra commands after sphinx.
"""
pass
def build_package(self):
"""
Actually package the resultant build
"""
pass
def main(self):
"""
The main function to run the builder.
"""
self._print_verbose('OpenLP main script: ......%s', self.openlp_script)
self._print_verbose('Script path: .............%s', self.script_path)
self._print_verbose('Branch path: .............%s', self.branch_path)
self._print_verbose('')
if not self.args.skip_update:
self.update_code()
if self.args.release:
self.export_release()
self.run_pyinstaller()
self.write_version_file()
self.copy_default_theme()
self.copy_plugins()
self.copy_media_player()
self.copy_font_files()
self.copy_display_files()
if os.path.exists(self.manual_path):
self.run_sphinx()
else:
self._print('')
self._print('WARNING: Documentation trunk not found')
self._print(' Help file will not be included in build')
self._print('')
self.copy_extra_files()
if not self.args.skip_translations:
if self.args.update_translations:
self.update_translations()
self.compile_translations()
self.build_package()
self._print('Done.')
raise SystemExit()

417
builders/macosx-builder.py Normal file
View File

@ -0,0 +1,417 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2004-2016 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Mac OS X Build Script
--------------------
This script is used to build the Mac OS X app bundle and pack it into dmg file.
For this script to work out of the box, it depends on a number of things:
Python 3.4
PyQt5
You should already have this installed, OpenLP doesn't work without it. The
version the script expects is the packaged one available from River Bank
Computing.
PyEnchant
This script expects the precompiled, installable version of PyEnchant to be
installed. You can find this on the PyEnchant site.
Sphinx
This is used to build the documentation. The documentation trunk must be at
the same directory level as OpenLP trunk and named "documentation".
PyInstaller
PyInstaller should be a git clone of either
https://github.com/matysek/pyinstaller branch python3 or
https://github.com/pyinstaller/pyinstaller branch python3
Bazaar
You need the command line "bzr" client installed.
OpenLP
A checkout of the latest code, in a branch directory, which is in a Bazaar
shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name".
macosx-builder.py
This script, of course. It should be in the "osx-package" directory
at the same level as OpenLP trunk.
Mako
Mako Templates for Python. This package is required for building the
remote plugin.
Alembic
Required for upgrading the databases used in OpenLP.
MuPDF
Required for PDF support in OpenLP. Install using macports, or use the
mudrawbin option in the config file to point to the mudraw binary.
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
The configuration file contains settings of the version string to include
in the bundle as well as directory and file settings for different
purposes (e.g. PyInstaller location or installer background image)
To install everything you need to install MacPorts. Once MacPorts is installed
and up-to-date, run the following command::
$ sudo port install python34 py34-pyqt4 py34-sphinx py34-sqlalchemy \
py34-macholib py34-mako py34-alembic py34-enchant \
py34-beautifulsoup4 py34-lxml py34-nose
You may need to install chardet via pip::
$ sudo pip install chardet
"""
import glob
import os
from pathlib import Path
from shutil import copy, copytree, move, rmtree
from macholib.MachO import MachO
from macholib.util import in_system_path
from builder import Builder
class MacOSXBuilder(Builder):
"""
The :class:`MacosxBuilder` class encapsulates everything that is needed
to build a Mac OS X .dmg file.
"""
def _get_directory_size(self, directory):
"""
Return directory size - size of everything in the dir.
"""
dir_size = 0
for (path, dirs, files) in os.walk(directory):
for file in files:
filename = os.path.join(path, file)
dir_size += os.path.getsize(filename)
return dir_size
def _create_symlink(self, folder):
"""
Create the appropriate symlink in the MacOS folder pointing to the Resources folder.
"""
sibling = Path(str(folder).replace('MacOS', ''))
# PyQt5/Qt/qml/QtQml/Models.2
root = str(sibling).partition('Contents')[2].lstrip('/')
# ../../../../
backward = '../' * len(root.split('/'))
# ../../../../Resources/PyQt5/Qt/qml/QtQml/Models.2
good_path = f'{backward}Resources/{root}'
folder.symlink_to(good_path)
def _fix_qt_dll(self, dll):
"""
Fix the DLL lookup paths to use relative ones for Qt dependencies.
Inspiration: PyInstaller/depend/dylib.py:mac_set_relative_dylib_deps()
Currently one header is pointing to (we are in the Resources folder):
@loader_path/../../../../QtCore (it is referencing to the old MacOS folder)
It will be converted to:
@loader_path/../../../../../../MacOS/QtCore
"""
def match_func(pth):
"""
Callback function for MachO.rewriteLoadCommands() that is
called on every lookup path setted in the DLL headers.
By returning None for system libraries, it changes nothing.
Else we return a relative path pointing to the good file
in the MacOS folder.
"""
basename = os.path.basename(pth)
if not basename.startswith('Qt'):
return None
return f'@loader_path{good_path}/{basename}'
# Resources/PyQt5/Qt/qml/QtQuick/Controls.2/Fusion
root = str(dll.parent).partition('Contents')[2][1:]
# /../../../../../../..
backward = '/..' * len(root.split('/'))
# /../../../../../../../MacOS
good_path = f'{backward}/MacOS'
# Rewrite Mach headers with corrected @loader_path
dll = MachO(dll)
dll.rewriteLoadCommands(match_func)
with open(dll.filename, 'rb+') as f:
for header in dll.headers:
f.seek(0)
dll.write(f)
f.seek(0, 2)
f.flush()
def _find_problematic_qt_folders(self, folder):
"""
Recursively yields problematic folders (containing a dot in their name).
"""
for path in folder.iterdir():
if not path.is_dir() or path.is_symlink():
# Skip simlinks as they are allowed (even with a dot)
continue
if '.' in path.name:
yield path
else:
yield from self._find_problematic_qt_folders(path)
def _move_contents_to_resources(self, folder):
"""
Recursively move any non symlink file from a problematic folder to the sibling one in Resources.
"""
for path in folder.iterdir():
if path.is_symlink():
continue
if path.is_dir():
yield from self._move_contents_to_resources(path)
else:
sibling = Path(str(path).replace('MacOS', 'Resources'))
move(path, sibling)
yield sibling
def _fix_qt_paths(self):
"""
Fix the Qt paths
"""
app_path = Path(self.dist_app_path) / 'Contents' / 'MacOS'
for folder in self._find_problematic_qt_folders(app_path):
for problematic_file in self._move_contents_to_resources(folder):
self._fix_qt_dll(problematic_file)
rmtree(folder)
self._create_symlink(folder)
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)
self._print_verbose('... {bin_name} path {path}'.format(bin_name=bin_name, path=libname))
# Determine how many directories up is the directory with shared
# dynamic libraries. '../'
# E.g. ./qt4_plugins/images/ -> ./../../
parent_dir = ''
# Check if distname is not only base filename.
if os.path.dirname(distname):
parent_level = len(os.path.dirname(distname).split(os.sep))
parent_dir = parent_level * (os.pardir + os.sep)
def match_func(pth):
"""
For system libraries leave path unchanged.
"""
# Match non system dynamic libraries.
if not in_system_path(pth):
# Use relative path to dependend dynamic libraries bases on
# location of the executable.
pth = os.path.join('@loader_path', parent_dir, os.path.basename(pth))
self._print_verbose('... %s', pth)
return pth
# Rewrite mach headers with @loader_path.
dll = MachO(libname)
dll.rewriteLoadCommands(match_func)
# Write changes into file.
# Write code is based on macholib example.
try:
self._print_verbose('... writing new library paths')
with open(dll.filename, 'rb+') as dll_file:
for header in dll.headers:
dll_file.seek(0)
dll.write(dll_file)
dll_file.seek(0, 2)
except Exception:
pass
def _relink_mudraw(self):
"""
Relink mudraw to bundled libraries
"""
self._relink_mupdf('mudraw')
def _relink_mutool(self):
"""
Relink mudraw to bundled libraries
"""
self._relink_mupdf('mutool')
def _install_pyro4(self):
"""
Install Pyro4 into the vendor directory
"""
self._print('Installing Pyro4 for LibreOffice')
target = os.path.join(self.dist_path, 'plugins', 'presentations', 'lib', 'vendor')
self._run_command([self.python, '-m', 'pip', 'install', 'Pyro4', '-t', target, '--disable-pip-version-check',
'--no-compile'], err_msg='Error installing Pyro4')
egg_info_glob = glob(os.path.join(target, '*.egg-info'))
egg_info_glob.extend(glob(os.path.join(target, '*.dist-info')))
self._print_verbose('... glob: {}'.format(egg_info_glob))
for path in egg_info_glob:
rmtree(path, True)
def _copy_bundle_files(self):
"""
Copy Info.plist and OpenLP.icns to app bundle.
"""
copy(self.icon_path, os.path.join(self.dist_app_path, 'Contents', 'Resources',
os.path.basename(self.icon_path)))
# Add OpenLP version to Info.plist and put it to app bundle.
fr = open(self.bundle_info_path, 'r')
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info_path)), 'w')
text = fr.read()
text = text % {'openlp_version': self.version}
fw.write(text)
fr.close()
fw.close()
def _copy_macosx_files(self):
"""
Copy all the OSX-specific files.
"""
self._print('Copying extra files for Mac OS X...')
self._print_verbose('... LICENSE.txt')
copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... mudraw')
if hasattr(self, 'mudraw_exe') and self.mudraw_exe and os.path.isfile(self.mudraw_exe):
copy(self.mudraw_exe, os.path.join(self.dist_path, 'mudraw'))
self._relink_mudraw()
elif hasattr(self, 'mutool_exe') and self.mutool_exe and os.path.isfile(self.mutool_exe):
copy(self.mutool_exe, os.path.join(self.dist_path, 'mutool'))
self._relink_mutool()
copy(self.mutool_lib, os.path.join(self.dist_path, 'libjbig2dec.0.dylib'))
else:
self._print('... WARNING: mudraw and mutool not found')
def _code_sign(self):
certificate = self.config.get('codesigning', 'certificate')
self._print('Checking for certificate...')
self._run_command(['security', 'find-certificate', '-c', certificate],
'Could not find certificate "{certificate}" in keychain, '.format(certificate=certificate) +
'codesigning will not work without a certificate')
self._print('Codesigning app...')
self._run_command(['codesign', '--deep', '-s', certificate, self.dist_app_path], 'Error running codesign')
def _create_dmg(self):
"""
Create .dmg file.
"""
self._print('Creating dmg file...')
dmg_name = 'OpenLP-{version}.dmg'.format(version=self.version)
dmg_title = 'OpenLP {version}'.format(version=self.version)
self.dmg_file = os.path.join(self.work_path, 'dist', dmg_name)
# Remove dmg if it exists.
if os.path.exists(self.dmg_file):
os.remove(self.dmg_file)
# Get size of the directory in bytes, convert to MB, and add padding
size = self._get_directory_size(self.dist_app_path)
size = size / (1000 * 1000)
size += 10
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),
'-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],
'Unable to run dmgbuild')
# Dmg done.
self._print('Finished creating dmg file, resulting file: %s' % self.dmg_file)
def get_platform(self):
"""
Return the plaform we're building for
"""
return 'Mac OS X'
def get_sphinx_build(self):
"""
The type of build Sphinx should be doing
"""
return 'applehelp'
def get_qt_translations_path(self):
"""
Return the path to Qt translation files on macOS
"""
from PyQt5.QtCore import QCoreApplication
qt_library_path = QCoreApplication.libraryPaths()[0]
return os.path.join(os.path.dirname(qt_library_path), 'translations')
def setup_extra(self):
"""
Extra setup to run
"""
if hasattr(self, 'mutool_exe'):
self.mutool_lib = os.path.abspath(
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_path = os.path.join(self.work_path, 'dist', 'OpenLP.app', 'Contents', 'MacOS')
def copy_extra_files(self):
"""
Copy any extra files which are particular to a platform
"""
self._copy_bundle_files()
self._copy_macosx_files()
def after_run_sphinx(self):
"""
Run Sphinx to build an HTML Help project.
"""
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 build_package(self):
"""
Build the actual DMG
"""
self._fix_qt_paths()
self._code_sign()
self._create_dmg()
if __name__ == '__main__':
MacOSXBuilder().main()

449
builders/windows-builder.py Normal file
View File

@ -0,0 +1,449 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Windows Build Script
--------------------
This script is used to build the Windows binary and the accompanying installer.
For this script to work out of the box, it depends on a number of things:
Python 3.7
PyQt5
You should already have this installed, OpenLP doesn't work without it. The
version the script expects is the packaged one available from pypi.
PyEnchant
This script expects the precompiled, installable version of PyEnchant to be
installed. You can find this on the PyEnchant site.
WiX Toolset
The toolset should be installed into "C:\\%PROGRAMFILES%\\WiX Toolset v3.11"
or similar.
Sphinx
This is used to build the documentation. The documentation trunk must be at
the same directory level as OpenLP trunk and named "documentation".
HTML Help Workshop
This is used to create the help file.
PyInstaller
PyInstaller can be installed from pypi.
Bazaar
You need the command line "bzr" client installed.
OpenLP
A checkout of the latest code, in a branch directory, which is in a Bazaar
shared repository directory. This means your code should be in a directory
structure like this: "openlp\\branch-name".
windows-builder.py
This script, of course. It should be in the "windows-installer" directory
at the same level as OpenLP trunk.
Mako
Mako Templates for Python. This package is required for building the
remote plugin. It can be installed by going to your
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
MuPDF
Required for PDF support in OpenLP. Download the windows build from
mupdf.com, extract it, and set the mutoolbin option in the config file to
point to mutool.exe.
Portable App Builds
The following are required if you are planning to make a portable build of
OpenLP. The portable build conforms to the standards published by
PortableApps.com:
http://portableapps.com/development/portableapps.com_format
PortableApps.com Installer:
http://portableapps.com/apps/development/portableapps.com_installer
PortableApps.com Launcher:
http://portableapps.com/apps/development/portableapps.com_launcher
NSIS Portable (Unicode version):
http://portableapps.com/apps/development/nsis_portable
"""
import os
import glob
import sys
from distutils import dir_util
from hashlib import md5
from shutil import copy, move, rmtree
from lxml.etree import fromstring, parse, tostring
from lxml.builder import E, ElementMaker
from builder import Builder
class WindowsBuilder(Builder):
"""
The :class:`WindowsBuilder` class encapsulates everything that is needed
to build a Windows installer.
"""
def _walk_dirs(self, dir_dict, path):
"""
Walk a dictionary according to path
"""
parts = path.split(os.sep)
search_key = parts.pop(0)
if search_key in dir_dict.keys():
if not parts:
return dir_dict[search_key]
else:
return self._walk_dirs(dir_dict[search_key], os.sep.join(parts))
else:
return None
def _get_fragments_from_files(self, start_dir):
"""
Walk down a directory recursively and build up the XML for WiX
"""
start_base, start_path = os.path.split(start_dir)
element = E.DirectoryRef(Id='INSTALLDIR')
directories = {start_path: {'__dir__': element}}
components = []
FxE = ElementMaker(namespace='http://schemas.microsoft.com/wix/FirewallExtension',
nsmap={'fw': 'http://schemas.microsoft.com/wix/FirewallExtension'})
for root, _, files in os.walk(start_dir):
parent = os.sep.join(root.replace(os.path.join(start_base, ''), '').split(os.sep)[:-1])
if root == start_dir:
path = ''
else:
path = root.replace(os.path.join(start_dir, ''), '')
base = os.path.basename(root)
if root != start_dir:
dir_id = 'dir_{parent}_{base}'.format(parent=parent.replace(os.sep, '_'), base=base)
element = E.Directory(Id=dir_id, Name=base)
new_dir = {'__dir__': element}
parent_dir = self._walk_dirs(directories, parent)
parent_dir[base] = new_dir
parent_dir['__dir__'].append(element)
for fname in files:
source = os.path.join(path, fname) if path else fname
source_id = md5(source.encode('utf8')).hexdigest()
file_id = 'file_{source_id}'.format(source_id=source_id)
component_id = 'cmp_{source_id}'.format(source_id=source_id)
if self.arch == 'x64':
file_ = E.File(Id=file_id, KeyPath='yes', Source=source, ProcessorArchitecture='x64')
component = E.Component(file_, Id=component_id, Guid='*', Win64='yes')
else:
file_ = E.File(Id=file_id, KeyPath='yes', Source=source)
component = E.Component(file_, Id=component_id, Guid='*')
if source.endswith('OpenLP.exe'):
description = 'Firewall exception for OpenLP\'s remote interface (UDP)'
program = '[#file_e368869eb54b01e2288a3359b1cf51f8]'
component.append(FxE.FirewallException(Id='OpenLP_TCP', Name='OpenLP',
Description=description, IgnoreFailure='yes',
Program=program, Protocol='tcp', Scope='any'))
component.append(FxE.FirewallException(Id='OpenLP_UDP', Name='OpenLP',
Description=description, IgnoreFailure='yes',
Program=program, Protocol='udp', Scope='any'))
# Add the file association XML
config_dir = os.path.dirname(self.config_path)
with open(os.path.join(config_dir, 'file-associations.xml')) as assoc_file:
file_assoc = parse(assoc_file)
component.append(file_assoc.getroot())
element.append(component)
components.append(component)
files_fragment = E.Fragment(directories[start_path]['__dir__'])
comps_fragment = E.Fragment(E.ComponentGroup(*[E.ComponentRef(Id=c.attrib['Id']) for c in components],
Id='Files'))
return files_fragment, comps_fragment
def _create_wix_file(self):
"""
Create a WiX project file
"""
self._print('Creating WiX file...')
config_dir = os.path.dirname(self.config_path)
self._print_verbose('Reading base WiX file')
with open(os.path.join(config_dir, 'OpenLP-base.wxs'), 'rt') as base_file:
xml = base_file.read()
progfilefolder = 'ProgramFiles64Folder' if self.arch == 'x64' else 'ProgramFilesFolder'
windows_version = self.version.replace('-bzr', '.')
xml = xml % dict(dialog=os.path.join(config_dir, 'WizardMain.bmp'),
banner=os.path.join(config_dir, 'WizardBanner.bmp'),
platform=self.arch,
progfilefolder=progfilefolder,
version=windows_version)
tree = fromstring(xml.encode('utf8'))
self._print_verbose('Creating XML fragments from files and directories')
fragments = self._get_fragments_from_files(self.dist_path)
self._print_verbose('Inserting XML fragments into base WiX file')
for fragment in fragments:
tree.append(fragment)
self._print_verbose('Writing new WiX file')
with open(os.path.join(config_dir, 'OpenLP.wxs'), 'wb') as f:
f.write(tostring(tree, encoding='utf-8', xml_declaration=True, pretty_print=True))
def _run_wix_tools(self):
"""
Run the WiX toolset to create an installer
"""
self._print('Running WiX tools...')
if self.arch == 'x64':
version = '{}-x64'.format(self.version)
else:
version = self.version
msi_file = os.path.abspath(os.path.join(self.dist_path, '..', 'OpenLP-{}.msi'.format(version)))
if os.path.exists(msi_file):
self._print_verbose('Removing old MSI file')
os.unlink(msi_file)
config_dir = os.path.dirname(self.config_path)
os.chdir(self.dist_path)
self._run_command([self.candle_exe, '-ext', 'WiXUtilExtension', '-ext', 'WixUIExtension',
'-ext', 'WixFirewallExtension', os.path.join(config_dir, 'OpenLP.wxs')],
'Error running WiX tool: candle')
self._run_command([self.light_exe, '-ext', 'WiXUtilExtension', '-ext', 'WixUIExtension',
'-ext', 'WixFirewallExtension', 'OpenLP.wixobj', '-o', msi_file],
'Error running WiX tool: light')
def _create_portableapp_structure(self):
"""
Checks the PortableApp directory structure amd creates
missing subdirs
"""
self._print('... Checking PortableApps directory structure...')
launcher_path = os.path.join(self.portable_dest_path, 'App', 'Appinfo', 'Launcher')
if not os.path.exists(launcher_path):
os.makedirs(launcher_path)
settings_path = os.path.join(self.portable_dest_path, 'Data', 'Settings')
if not os.path.exists(settings_path):
os.makedirs(settings_path)
def _create_portableapps_appinfo_file(self):
"""
Create a Portabbleapps appinfo.ini file.
"""
self._print_verbose('... Creating PortableApps appinfo file ...')
config_dir = os.path.dirname(self.config_path)
if '-bzr' in self.version:
version, revision = self.version.split('-bzr')
version = version + '.0' * (2 - version.count('.'))
self.portable_version = version + '.' + revision
else:
self.portable_version = self.version + '.0' * (3 - self.version.count('.'))
with open(os.path.join(config_dir, 'appinfo.ini.default'), 'r') as input_file, \
open(os.path.join(self.portable_dest_path, 'App', 'Appinfo', 'appinfo.ini'), 'w') as output_file:
content = input_file.read()
content = content.replace('%(display_version)s', self.portable_version)
content = content.replace('%(package_version)s', self.portable_version)
content = content.replace('%(arch)s', self.arch)
output_file.write(content)
def _run_portableapp_builder(self):
"""
Creates a portable installer.
1 Copies the distribution to the portable apps directory
2 Builds the PortableApps Launcher
3 Builds the PortableApps Install
"""
self._print('Running PortableApps Builder...')
self._print_verbose('... Clearing old files')
# Remove previous contents of portableapp build directory.
if os.path.exists(self.portable_dest_path):
rmtree(self.portable_dest_path)
self._print_verbose('... Creating PortableApps build directory')
# Copy the contents of the OpenLPPortable directory to the portable
# build directory.
dir_util.copy_tree(self.portable_source_path, self.portable_dest_path)
self._create_portableapp_structure()
self._create_portableapps_appinfo_file()
# Copy distribution files to portableapp build directory.
self._print_verbose('... Copying distribution files')
portable_app_path = os.path.join(self.portable_dest_path, 'App', 'OpenLP')
dir_util.copy_tree(self.dist_path, portable_app_path)
# Copy help files to portableapp build directory.
if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')):
self._print_verbose('... Copying help files')
dir_util.copy_tree(self.helpfile_path, os.path.join(portable_app_path, 'help'))
else:
self._print('... WARNING: Windows help file not found')
# Build the launcher.
self._print_verbose('... Building PortableApps Launcher')
self._run_command([self.portablelauncher_exe, self.portable_dest_path],
'Error creating PortableApps Launcher')
# Build the portable installer.
self._print_verbose('... Building PortableApps Installer')
self._run_command([self.portableinstaller_exe, self.portable_dest_path],
'Error running PortableApps Installer')
portable_exe_name = 'OpenLPPortable_{ver}-{arch}.paf.exe'.format(ver=self.portable_version, arch=self.arch)
portable_exe_path = os.path.abspath(os.path.join(self.portable_dest_path, '..', portable_exe_name))
self._print_verbose('... Portable Build: {}'.format(portable_exe_path))
if os.path.exists(portable_exe_path):
move(portable_exe_path, os.path.join(self.dist_path, '..', portable_exe_name))
self._print('PortableApp build complete')
else:
raise Exception('PortableApp failed to build')
def get_platform(self):
"""
Return the platform we're building for
"""
return 'Windows'
def get_config_defaults(self):
"""
Build some default values for the config file
"""
config_defaults = super().get_config_defaults()
config_defaults.update({
'pyroot': self.python_root,
'progfiles': self.program_files,
'progfilesx86': self.program_files_x86,
'sitepackages': self.site_packages,
'projects': os.path.abspath(os.path.join(self.script_path, '..', '..'))
})
return config_defaults
def get_sphinx_build(self):
"""
Tell Sphinx we want to build HTML help
"""
return "htmlhelp"
def get_qt_translations_path(self):
"""
Return the path to Qt translation files on macOS
"""
return os.path.join(self.site_packages, 'PyQt5', 'Qt', 'translations')
def add_extra_args(self, parser):
"""
Add extra arguments to the command line argument parser
"""
parser.add_argument('--portable', action='store_true', default=False,
help='Build a PortableApps.com build of OpenLP too')
def setup_system_paths(self):
"""
Set up some system paths.
"""
super().setup_system_paths()
self.python_root = os.path.dirname(self.python)
self.site_packages = os.path.join(self.python_root, 'Lib', 'site-packages')
self.program_files = os.getenv('PROGRAMFILES')
self.program_files_x86 = os.getenv('PROGRAMFILES(x86)')
self._print_verbose(' {:.<20}: {}'.format('site packages: ', self.site_packages))
self._print_verbose(' {:.<20}: {}'.format('program files: ', self.program_files))
self._print_verbose(' {:.<20}: {}'.format('program files x86: ', self.program_files_x86))
def setup_paths(self):
"""
Set up a variety of paths that we use throughout the build process.
"""
super().setup_paths()
self.dist_path = os.path.join(self.work_path, 'dist', 'OpenLP')
self.helpfile_path = os.path.join(self.manual_build_path, 'htmlhelp')
self.winres_path = os.path.join(self.branch_path, 'resources', 'windows')
def setup_extra(self):
"""
Extra setup to run
"""
# Detect python instance bit size
self.arch = 'x86' if sys.maxsize == 0x7fffffff else 'x64'
def copy_extra_files(self):
"""
Copy all the Windows-specific files.
"""
self._print('Copying extra files for Windows...')
self._print_verbose('... OpenLP.ico')
copy(self.icon_path, os.path.join(self.dist_path, 'OpenLP.ico'))
self._print_verbose('... LICENSE.txt')
copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... service_file.ico')
config_dir = os.path.dirname(self.config_path)
copy(os.path.join(config_dir, 'service_file.ico'), os.path.join(self.dist_path, 'service_file.ico'))
if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')):
self._print_verbose('... OpenLP.chm')
copy(os.path.join(self.helpfile_path, 'OpenLP.chm'), os.path.join(self.dist_path, 'OpenLP.chm'))
else:
self._print('... WARNING: Windows help file not found')
try:
# Check if PyMuPDF is installed
import fitz # noqa
HAS_PYMUPDF = True
except ImportError:
HAS_PYMUPDF = False
if not HAS_PYMUPDF:
self._print_verbose('... mutool.exe')
if self.mutool_exe and os.path.isfile(self.mutool_exe):
copy(os.path.join(self.mutool_exe), os.path.join(self.dist_path, 'mutool.exe'))
else:
self._print('... WARNING: mutool.exe not found')
vlc_path = os.path.join(self.program_files, 'VideoLAN', 'VLC')
for fname in ['libvlc.dll', 'libvlccore.dll']:
self._print_verbose('... {}'.format(fname))
copy(os.path.join(vlc_path, fname), os.path.join(self.dist_path, fname))
def after_run_sphinx(self):
"""
Run HTML Help Workshop to convert the Sphinx output into a manual.
"""
self._print('Running HTML Help Workshop...')
os.chdir(os.path.join(self.manual_build_path, 'htmlhelp'))
self._run_command([self.htmlhelp_exe, 'OpenLP.chm'], 'Error running HTML Help Workshop', exit_code=1)
def build_package(self):
"""
Build the installer
"""
self._create_wix_file()
self._run_wix_tools()
if self.args.portable:
self._run_portableapp_builder()
def get_extra_parameters(self):
"""
Return a list of any extra parameters we wish to use
"""
parameters = []
dll_path = '{pf}\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{arch}\\*.dll'.format(pf=self.program_files_x86,
arch=self.arch)
# Finds the UCRT DDLs available from the Windows 10 SDK
for binary in glob.glob(dll_path):
parameters.append('--add-binary')
parameters.append(binary + ";.")
return parameters
if __name__ == '__main__':
WindowsBuilder().main()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

View File

@ -21,7 +21,27 @@
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openlp.osz</string>
<string>org.openlp.service</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtension</key>
<array>
<string>oszl</string>
</array>
<key>CFBundleTypeIconFiles</key>
<array>
<string>OpenLP.icns</string>
</array>
<key>CFBundleTypeName</key>
<string>OpenLP Service</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openlp.servicelite</string>
</array>
</dict>
<dict>
@ -41,7 +61,7 @@
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openlp.otz</string>
<string>org.openlp.theme</string>
</array>
</dict>
</array>

View File

@ -1,285 +1,626 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. Definitions.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
"This License" refers to version 3 of the GNU General Public License.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
1. Source Code.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The Corresponding Source for a work in source code form is that
same work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
2. Basic Permissions.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Use with the GNU Affero General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
14. Revised Versions of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
NO WARRANTY
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
END OF TERMS AND CONDITIONS
16. Limitation of Liability.
How to Apply These Terms to Your New Programs
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

BIN
osx/OpenLP-Background.tiff Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,18 +1,19 @@
[executables]
sphinx = sphinx-build-3.4
pyinstaller = %(projects)s/../pyinstaller/pyinstaller.py
sphinx = sphinx-build-3.5
pyinstaller = /opt/local/Library/Frameworks/Python.framework/Versions/3.5/bin/pyinstaller
lrelease = /opt/local/libexec/qt5/bin/lrelease
dmgbuild = dmgbuild
mudrawbin = mudraw
mutoolbin = mutool
[paths]
branch = %(projects)s/trunk
documentation = %(projects)s/documentation
app_icon = %(here)s/OpenLP.icns
branch = path/to/openlp/trunk
documentation = path/to/openlp/documentation
icon = %(here)s/OpenLP.icns
bundle_info = %(here)s/Info.plist
hooks = %(here)s/../pyinstaller-hooks
dmg_settings = %(here)s/dmg-settings.py
dmg_settings = %(here)s/settings.py
license = %(here)s/LICENSE.txt
[transifex]
username =

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1,27 +0,0 @@
import os
# This is the settings file for building the DMG. Run dmgbuild like so:
# $ dmgbuild -s dmg-settings.py -D size=<size>,app=<path/to/OpenLP.app> "OpenLP" OpenLP-{version}.dmg
HERE = os.getcwd()
format = 'UDZO'
size = defines.get('size', '600M')
files = [defines.get('app', '/Applications/OpenLP.app')]
symlinks = { 'Applications': '/Applications' }
badge_icon = defines.get('icon', 'OpenLP.icns')
icon_locations = {
'OpenLP.app': (160, 200),
'Applications': (550, 200)
}
background = os.path.join(HERE, 'dmg-background.png')
window_rect = ((100, 100), (700, 460))
default_view = 'icon-view'
show_icon_preview = False
arrange_by = None
scroll_position = (0, 0)
grid_offset = (0, 0)
grid_spacing = 100
label_pos = 'bottom' # or 'right'
text_size = 16
icon_size = 128

View File

@ -1,764 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2015 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Mac OS X Build Script
--------------------
This script is used to build the Mac OS X app bundle and pack it into dmg file.
For this script to work out of the box, it depends on a number of things:
Python 3.4
PyQt5
You should already have this installed, OpenLP doesn't work without it. The
version the script expects is the packaged one available from River Bank
Computing.
PyEnchant
This script expects the precompiled, installable version of PyEnchant to be
installed. You can find this on the PyEnchant site.
Sphinx
This is used to build the documentation. The documentation trunk must be at
the same directory level as OpenLP trunk and named "documentation".
PyInstaller
PyInstaller should be a git clone of either
https://github.com/matysek/pyinstaller branch python3 or
https://github.com/pyinstaller/pyinstaller branch python3
Bazaar
You need the command line "bzr" client installed.
OpenLP
A checkout of the latest code, in a branch directory, which is in a Bazaar
shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name".
macosx-builder.py
This script, of course. It should be in the "osx-package" directory
at the same level as OpenLP trunk.
Mako
Mako Templates for Python. This package is required for building the
remote plugin.
Alembic
Required for upgrading the databases used in OpenLP.
Pyro4
Required for the macOS LibreOffice integration. Install the version from
MacPorts.
MuPDF
Required for PDF support in OpenLP. Install using macports, or use the
mudrawbin option in the config file to point to the mudraw binary.
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
The configuration file contains settings of the version string to include
in the bundle as well as directory and file settings for different
purposes (e.g. PyInstaller location or installer background image)
To install everything you need to install MacPorts. Once MacPorts is installed
and up-to-date, run the following command::
$ sudo port install python34 py34-pyqt4 py34-sphinx py34-sqlalchemy \
py34-macholib py34-mako py34-alembic py34-enchant \
py34-beautifulsoup4 py34-lxml py34-nose
You may need to install chardet via pip::
$ sudo pip install chardet
"""
import os
import plistlib
import signal
import subprocess
import sys
from glob import glob
from shutil import copy, copytree, rmtree
from subprocess import Popen, PIPE
from configparser import ConfigParser
from argparse import ArgumentParser
from macholib.MachO import MachO
from macholib.util import flipwritable, in_system_path
def _which(command):
"""
Return absolute path to a command found on system PATH.
"""
if command.startswith('/'):
return command
for path in os.environ["PATH"].split(os.pathsep):
if os.access(os.path.join(path, command), os.X_OK):
return "%s/%s" % (path, command)
class MacosxBuilder(object):
"""
The :class:`MacosxBuilder` class encapsulates everything that is needed
to build a Mac OS X .dmg file.
"""
def __init__(self):
self.setup_args()
self.setup_system_paths()
self.read_config()
self.setup_executables()
self.setup_paths()
def _print(self, text, *args):
"""
Print stuff out. Later we might want to use a log file.
"""
if len(args) > 0:
text = text % tuple(args)
print(text)
def _print_verbose(self, text, *args):
"""
Print output, obeying "verbose" mode.
"""
if self.args.verbose:
self._print(text, *args)
def _run_command(self, cmd, err_msg):
"""
Run command in subprocess and print error message in case of Exception.
Return text from stdout.
"""
proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
output, error = proc.communicate()
code = proc.wait()
if code != 0:
self._print(output)
self._print(error)
raise Exception(err_msg)
return output
def _get_directory_size(self, directory):
"""
Return directory size - size of everything in the dir.
"""
dir_size = 0
for (path, dirs, files) in os.walk(directory):
for file in files:
filename = os.path.join(path, file)
dir_size += os.path.getsize(filename)
return dir_size
def _get_mountpoints(self):
"""
Return list of mounted disks on Mac.
"""
# Get the output in plist format.
paths = []
output = self._run_command([self.hdiutil, 'info', '-plist'], 'Detecting mount points failed.')
pl = plistlib.readPlistFromBytes(output)
for image in pl['images']:
for se in image['system-entities']:
if se.get('mount-point'):
paths.append(se.get('mount-point'))
return paths
def setup_args(self):
"""
Set up an argument parser and parse the command line arguments.
"""
parser = ArgumentParser()
parser.add_argument('-b', '--branch', metavar='BRANCH', dest='branch',
help='Specify the path to the branch you wish to build.')
parser.add_argument('--devel', dest='devel', action='store_true', default=False,
help='Development build does not have set icons for .dmg file '
'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',
help='Specify the path to the documentation branch.')
parser.add_argument('-c', '--config', metavar='CONFIG', dest='config',
help='Specify the path to the configuration file.',
default=os.path.abspath(os.path.join('.', 'config.ini.default')))
parser.add_argument('-u', '--skip-update', dest='skip_update', action='store_true', default=False,
help='Do NOT update the branch before building.')
parser.add_argument('-t', '--skip-translations', dest='skip_translations', action='store_true', default=False,
help='Do NOT update the language translation files.')
parser.add_argument('--transifex', dest='update_translations', action='store_true', default=False,
help='Update the language translation from Transifex.')
parser.add_argument('--transifex-user', dest='transifex_user', help='Transifex username.')
parser.add_argument('--transifex-pass', dest='transifex_pass', help='Transifex password.')
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
help='Print out additional information.')
parser.add_argument('-p', '--with-pyro', action='store_true', default=False,
help='Build OpenLP with Pyro4 (for LibreOffice). Defaults to False')
self.args = parser.parse_args()
def read_config(self):
"""
Read the configuration from the configuration file.
"""
self.config = ConfigParser(defaults={
'here': self.script_path,
'projects': os.path.abspath(os.path.join(self.script_path, '..', '..')), })
config_file = os.path.abspath(self.args.config)
if not os.path.exists(config_file):
self._print('Config file does not exist: %s' % config_file)
raise SystemExit()
self.config.read(config_file)
def setup_system_paths(self):
"""
Set up some system paths.
"""
self.script_path = os.path.dirname(os.path.abspath(__file__))
self.python = sys.executable
def setup_executables(self):
"""
Set up the paths to the executables we use.
"""
self.sphinx = _which(self.config.get('executables', 'sphinx'))
self.pyinstaller = os.path.abspath(self.config.get('executables', 'pyinstaller'))
self.lrelease = self.config.get('executables', 'lrelease')
self.dmgbuild = _which(self.config.get('executables', 'dmgbuild'))
self.mudraw_bin = _which(self.config.get('executables', 'mudrawbin'))
self.mutool_bin = _which(self.config.get('executables', 'mutoolbin'))
if self.mutool_bin:
self.mutool_lib = os.path.abspath(
os.path.join(os.path.dirname(self.mutool_bin), '..', 'lib', 'libjbig2dec.0.dylib'))
def setup_paths(self):
"""
Set up a variety of paths that we use throughout the build process.
"""
if self.args.branch:
self.branch_path = os.path.abspath(self.args.branch)
else:
self.branch_path = self.config.get('paths', 'branch')
if self.args.docs:
self.docs_path = os.path.abspath(self.args.docs)
else:
self.docs_path = self.config.get('paths', 'documentation')
if self.args.release:
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.app_icon = os.path.abspath(self.config.get('paths', 'app_icon'))
self.bundle_info = os.path.abspath(self.config.get('paths', 'bundle_info'))
self.i18n_utils = os.path.join(self.work_path, 'scripts', 'translation_utils.py')
self.source_path = os.path.join(self.work_path, 'openlp')
self.manual_path = os.path.join(self.docs_path, 'manual')
self.manual_build_path = os.path.join(self.manual_path, 'build')
self.i18n_path = os.path.join(self.work_path, 'resources', 'i18n')
self.build_path = os.path.join(self.work_path, 'build')
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.dmg_settings = os.path.abspath(self.config.get('paths', 'dmg_settings'))
# Path to Qt translation files.
from PyQt5.QtCore import QCoreApplication
qt_plug_dir = str(list(QCoreApplication.libraryPaths())[0])
self.qt_translations_path = os.path.join(os.path.dirname(qt_plug_dir), 'translations')
def update_code(self):
"""
Update the code in the branch.
"""
os.chdir(self.branch_path)
self._print('Reverting any changes to the code...')
bzr = Popen(('bzr', 'revert'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
self._print(output)
raise Exception('Error reverting the code')
self._print('Cleaning any extra files...')
bzr = Popen(['bzr', 'clean-tree', '--quiet', '--force', '--ignored', '--unknown'], stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
self._print(output)
raise Exception('Error cleaning extra files')
self._print('Updating the code...')
bzr = Popen(('bzr', 'update'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
self._print(output)
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):
"""
Run PyInstaller on the branch to build an executable.
"""
self._print('Running PyInstaller...')
os.chdir(self.work_path)
cmd = [self.python,
self.pyinstaller,
'--clean',
'--noconfirm',
'--windowed',
'--noupx',
'--additional-hooks-dir', self.hooks_path,
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'),
'-i', self.app_icon,
'-n', 'OpenLP',
self.openlp_script]
if not self.args.verbose:
cmd.append('--log-level=ERROR')
else:
cmd.append('--log-level=DEBUG')
if self.args.devel:
cmd.append('-d')
pyinstaller = Popen(cmd)
code = pyinstaller.wait()
if code != 0:
raise Exception('Error running PyInstaller')
def write_version_file(self):
"""
Write the version number to a file for reading once installed.
"""
self._print('Writing version file...')
os.chdir(self.branch_path)
bzr = Popen(('bzr', 'tags'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr tags')
lines = output.splitlines()
if len(lines) == 0:
tag = '0.0.0'
revision = '0'
else:
tag, revision = lines[-1].decode('utf-8').split()
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
output, error = bzr.communicate()
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr log')
latest = output.decode('utf-8').split(':')[0]
self.version_string = '%s-bzr%s' % (tag, latest)
self.version_tag = tag
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
# Release version does not contain revision in .dmg name.
if self.args.devel:
version_file.write(str(self.version_string))
else:
version_file.write(str(self.version_tag))
version_file.close()
def copy_default_theme(self):
"""
Copy the default theme to the correct directory for OpenLP.
"""
self._print('Copying default theme...')
source = os.path.join(self.source_path, 'core', 'lib', 'json')
dest = os.path.join(self.dist_path, 'core', 'lib', 'json')
for root, dirs, files in os.walk(source):
for filename in files:
if filename.endswith('.json'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_plugins(self):
"""
Copy all the plugins to the correct directory so that OpenLP sees that
it has plugins.
"""
self._print('Copying plugins...')
source = os.path.join(self.source_path, 'plugins')
dest = os.path.join(self.dist_path, 'plugins')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_media_player(self):
"""
Copy the media players to the correct directory for OpenLP.
"""
self._print('Copying media player...')
source = os.path.join(self.source_path, 'core', 'ui', 'media')
dest = os.path.join(self.dist_path, 'core', 'ui', 'media')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def install_pyro4(self):
"""
Install Pyro4 for the macOS Impress module
"""
self._print('Installing Pyro4 for LibreOffice...')
target = os.path.join(self.dist_path, 'plugins', 'presentations', 'lib', 'vendor')
command = [
self.python,
'-m',
'pip',
'install',
'Pyro4==4.38',
'-t',
target,
'--disable-pip-version-check',
'--no-compile'
]
pip = Popen(command)
code = pip.wait()
if code != 0:
raise Exception('Error running pip')
egg_info_glob = glob(target + '/*.egg-info')
egg_info_glob.extend(glob(target + '/*.dist-info'))
self._print_verbose('... glob: %s' % egg_info_glob)
for path in egg_info_glob:
rmtree(path, True)
def copy_mac_bundle_files(self):
"""
Copy Info.plist and OpenLP.icns to app bundle.
"""
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.
fr = open(self.bundle_info, 'r')
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w')
text = fr.read()
if self.args.devel:
text = text % {'openlp_version': self.version_string}
else:
text = text % {'openlp_version': self.version_tag}
fw.write(text)
fr.close()
fw.close()
def copy_macosx_files(self):
"""
Copy all the OSX-specific files.
"""
self._print('Copying extra files for Mac OS X...')
self._print_verbose('... LICENSE.txt')
copy(os.path.join(self.script_path, 'LICENSE.txt'), os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... mudraw')
if self.mudraw_bin and os.path.isfile(self.mudraw_bin):
copy(self.mudraw_bin, os.path.join(self.dist_path, 'mudraw'))
self.relink_mudraw()
elif self.mutool_bin and os.path.isfile(self.mutool_bin):
copy(self.mutool_bin, os.path.join(self.dist_path, 'mutool'))
self.relink_mutool()
copy(self.mutool_lib, os.path.join(self.dist_path, 'libjbig2dec.0.dylib'))
else:
self._print('... WARNING: mudraw and mutool not found')
def relink_mudraw(self):
"""
Relink mudraw to bundled libraries
"""
self.relink_mupdf('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)
self._print_verbose('... {bin_name} path {path}'.format(bin_name=bin_name, path=libname))
# Determine how many directories up is the directory with shared
# dynamic libraries. '../'
# E.g. ./qt4_plugins/images/ -> ./../../
parent_dir = ''
# Check if distname is not only base filename.
if os.path.dirname(distname):
parent_level = len(os.path.dirname(distname).split(os.sep))
parent_dir = parent_level * (os.pardir + os.sep)
def match_func(pth):
"""
For system libraries leave path unchanged.
"""
# Match non system dynamic libraries.
if not in_system_path(pth):
# Use relative path to dependend dynamic libraries bases on
# location of the executable.
pth = os.path.join('@loader_path', parent_dir, os.path.basename(pth))
self._print_verbose('... %s', pth)
return pth
# Rewrite mach headers with @loader_path.
dll = MachO(libname)
dll.rewriteLoadCommands(match_func)
# Write changes into file.
# Write code is based on macholib example.
try:
self._print_verbose('... writing new library paths')
f = open(dll.filename, 'rb+')
for header in dll.headers:
f.seek(0)
dll.write(f)
f.seek(0, 2)
f.flush()
f.close()
except Exception:
pass
def update_translations(self):
"""
Update the translations.
"""
self._print('Updating translations...')
if not self.config.has_section('transifex'):
raise Exception('No section named "transifex" found.')
if not self.config.has_option('transifex', 'username'):
raise Exception('No option named "username" found.')
if not self.config.has_option('transifex', 'password'):
raise Exception('No option named "password" found.')
if self.args.transifex_user:
username = self.args.transifex_user
else:
username = self.config.get('transifex', 'username')
if self.args.transifex_pass:
password = self.args.transifex_pass
else:
password = self.config.get('transifex', 'password')
os.chdir(os.path.split(self.i18n_utils)[0])
translation_utils = Popen([self.python, self.i18n_utils, '-qdpu', '-U', username, '-P', password])
code = translation_utils.wait()
if code != 0:
raise Exception('Error running translation_utils.py')
def compile_translations(self):
"""
Compile the translations for Qt.
"""
self._print('Compiling translations...')
files = os.listdir(self.i18n_path)
if not os.path.exists(os.path.join(self.dist_path, 'i18n')):
os.makedirs(os.path.join(self.dist_path, 'i18n'))
for file in files:
if file.endswith('.ts'):
self._print_verbose('... %s', file)
source_path = os.path.join(self.i18n_path, file)
dest_path = os.path.join(self.dist_path, 'i18n', file.replace('.ts', '.qm'))
lconvert = Popen((self.lrelease, '-compress', '-silent', source_path, '-qm', dest_path))
code = lconvert.wait()
if code != 0:
raise Exception('Error running lconvert on %s' % source_path)
self._print('Copying qm files...')
source = self.qt_translations_path
files = os.listdir(source)
for filename in files:
if filename.startswith('qt_') and filename.endswith('.qm'):
self._print_verbose('... %s', filename)
copy(os.path.join(source, filename), os.path.join(self.dist_path, 'i18n', filename))
def run_sphinx(self):
"""
Run Sphinx to build an HTML Help project.
"""
self._print('Deleting previous manual build... %s', self.manual_build_path)
if os.path.exists(self.manual_build_path):
rmtree(self.manual_build_path)
self._print('Running Sphinx...')
os.chdir(self.manual_path)
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):
"""
Create .dmg file.
"""
self._print('Creating dmg file...')
# Release version does not contain revision in .dmg name.
if self.args.devel:
dmg_name = 'OpenLP-' + str(self.version_string) + '.dmg'
dmg_title = 'OpenLP {version}'.format(version=self.version_string)
else:
dmg_name = 'OpenLP-' + str(self.version_tag) + '.dmg'
dmg_title = 'OpenLP {version}'.format(version=self.version_tag)
self.dmg_file = os.path.join(self.work_path, 'dist', dmg_name)
# Remove dmg if it exists.
if os.path.exists(self.dmg_file):
os.remove(self.dmg_file)
# Create empty dmg file.
size = self._get_directory_size(self.dist_app_path) # in bytes.
size = size / (1000 * 1000) # Convert to megabytes.
size += 10 # Additional space in .dmg for other files.
self._print('... %s' % self.script_path)
os.chdir(self.script_path)
self._run_command([self.dmgbuild, '-s', self.dmg_settings, '-D', 'size={size}M'.format(size=size),
'-D', 'icon={icon_path}'.format(icon_path=self.app_icon),
'-D', 'app={dist_app_path}'.format(dist_app_path=self.dist_app_path), dmg_title, self.dmg_file],
'Unable to run dmgbuild')
# Jenkins integration.
# Continuous integration server needs to know the filename of dmg.
# Write java property file. For uploading dmg to openlp.
if self.args.devel:
fpath = os.path.join(self.branch_path, 'openlp.properties')
self._print('... writing property file for jenkins: %s' % fpath)
f = open(fpath, 'w')
f.write('OPENLP_DMGNAME=' + os.path.basename(self.dmg_file) + '\n')
f.close()
# Dmg done.
self._print('Finished creating dmg file, resulting file: %s' % self.dmg_file)
def main(self):
"""
The main function to run the Mac OS X builder.
"""
self._print_verbose('OpenLP main script: ......%s', self.openlp_script)
self._print_verbose('Script path: .............%s', self.script_path)
self._print_verbose('Branch path: .............%s', self.branch_path)
self._print_verbose('Source path: .............%s', self.source_path)
self._print_verbose('"dist.app" path: .........%s', self.dist_app_path)
self._print_verbose('"dist" path: .............%s', self.dist_path)
self._print_verbose('"hooks" path: ............%s', self.hooks_path)
self._print_verbose('PyInstaller: .............%s', self.pyinstaller)
self._print_verbose('dmgbuild: ................%s', self.dmgbuild)
self._print_verbose('Documentation branch path:%s', self.docs_path)
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('')
if not self.args.skip_update:
self.update_code()
if self.args.release:
self.export_release()
self.run_pyinstaller()
self.write_version_file()
self.copy_mac_bundle_files()
self.copy_default_theme()
self.copy_plugins()
self.copy_media_player()
if self.args.with_pyro:
self.install_pyro4()
# TODO creating help on Mac
if os.path.exists(self.manual_path):
self.run_sphinx()
else:
self._print('')
self._print('WARNING: Documentation trunk not found. Mac OS X')
self._print(' Help file will not be included in build')
self._print('')
self.copy_macosx_files()
if not self.args.skip_translations:
if self.args.update_translations:
self.update_translations()
self.compile_translations()
self.code_sign()
self.create_dmg_file()
self._print('Done.')
raise SystemExit()
if __name__ == '__main__':
MacosxBuilder().main()

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

View File

@ -9,19 +9,17 @@ format = 'UDBZ'
size = '600M'
files = [defines.get('app', '/Applications/OpenLP.app')]
symlinks = { 'Applications': '/Applications' }
badge_icon = os.path.join(HERE, 'openlp-logo-new.icns')
badge_icon = os.path.join(HERE, 'OpenLP.icns')
icon_locations = {
'OpenLP.app': (160, 200),
'Applications': (550, 200)
'OpenLP.app': (130, 110),
'Applications': (400, 110)
}
background = os.path.join(HERE, 'dmg-background-new.png')
window_rect = ((100, 100), (700, 457))
background = os.path.join(HERE, 'OpenLP-Background.tiff')
window_rect = ((100, 100), (530, 360))
default_view = 'icon-view'
show_icon_preview = False
arrange_by = None
scroll_position = (0, 0)
grid_offset = (0, 0)
grid_spacing = 100
label_pos = 'bottom' # or 'right'
text_size = 16
icon_size = 128

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2015 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
hiddenimports = ['sqlalchemy.ext.baked']

View File

@ -1,285 +1,626 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
TERMS AND CONDITIONS
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
0. Definitions.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
"This License" refers to version 3 of the GNU General Public License.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
A "covered work" means either the unmodified Program or a work based
on the Program.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
1. Source Code.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
The Corresponding Source for a work in source code form is that
same work.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
2. Basic Permissions.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
13. Use with the GNU Affero General Public License.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
14. Revised Versions of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
NO WARRANTY
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
15. Disclaimer of Warranty.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
END OF TERMS AND CONDITIONS
16. Limitation of Liability.
How to Apply These Terms to Your New Programs
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

152
windows/OpenLP-base.wxs Normal file
View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<?define ProductName="OpenLP"?>
<?define ProductCode="*"?>
<?define ProductVersion="%(version)s"?>
<?define Manufacturer="OpenLP Developers"?>
<?define Description="Open Source Worship Presentation Software"?>
<?define Comments="OpenLP is open source under the GNU General Public License"?>
<?define UpgradeCode="8C5881AC-8F1E-4937-BB99-B823FABF18F0"?>
<?define Platform="%(platform)s"?>
<Product Name="$(var.ProductName)" Manufacturer="$(var.Manufacturer)" Id="$(var.ProductCode)"
UpgradeCode="$(var.UpgradeCode)" Language="1033" Codepage="1252" Version="$(var.ProductVersion)">
<Package Id="*" Keywords="Installer" Description="$(var.Description)" Comments="$(var.Comments)"
Manufacturer="$(var.Manufacturer)" InstallerVersion="251" Languages="1033" Compressed="yes"
SummaryCodepage="1252" Platform="$(var.Platform)"/>
<Condition Message="You need to be an administrator to install this product.">Privileged</Condition>
<Media Id="1" Cabinet="openlp.cab" EmbedCab="yes" CompressionLevel="high"/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<Property Id="ARPPRODUCTICON" Value="OpenLP.ico" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch $(var.ProductName)" />
<Property Id="WixShellExecTarget" Value="[#file_e368869eb54b01e2288a3359b1cf51f8]" />
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<UIRef Id="WixUI_Common" />
<UI Id="WixUI_OpenLP">
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">NOT Installed</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">Installed AND PATCH</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<WixVariable Id="WixUIDialogBmp" Value="%(dialog)s" />
<WixVariable Id="WixUIBannerBmp" Value="%(banner)s" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="%(progfilefolder)s">
<Directory Id="INSTALLDIR" Name="$(var.ProductName)"/>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="$(var.ProductName)">
<Component Id="ProgramMenuDir" Guid="{7AABE54C-5B03-4049-AA85-E18B787A19C7}">
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\$(var.ProductName)\$(var.ProductName)" Type="string" Value="" KeyPath="yes" />
<Shortcut Id="ApplicationStartMenuShortcut"
Name="$(var.ProductName)"
Description="$(var.Description)"
Target="[#file_e368869eb54b01e2288a3359b1cf51f8]"
Icon="OpenLP.ico"
WorkingDirectory="RootDirectory"/>
<Shortcut Id="DebugStartMenuShortcut"
Name="$(var.ProductName) (Debug)"
Description="Run OpenLP with debug logging enabled"
Target="[#file_e368869eb54b01e2288a3359b1cf51f8]"
Arguments="--log-level debug"
Icon="OpenLP.ico"
WorkingDirectory="RootDirectory"/>
<Shortcut Id="HelpStartMenuShortcut"
Name="$(var.ProductName) Help"
Description="Help file for $(var.ProductName)"
Target="[#file_436f15ee9b174c85745878fe09b6d47e]"
WorkingDirectory="RootDirectory"/>
<util:InternetShortcut Id="OpenLPWebSite"
Name="$(var.ProductName) on the Web"
Target="http://openlp.org/"/>
<util:InternetShortcut Id="OpenLPForums"
Name="Get support for $(var.ProductName)"
Target="http://forums.openlp.org/"/>
<Shortcut Id="UninstallProduct"
Name="Uninstall $(var.ProductName)"
Target="[SystemFolder]msiexec.exe"
Arguments="/x [ProductCode]"
Description="Removes $(var.ProductName) from your computer" />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Directory Id="RootDirectory" Name="$(var.ProductName)" />
</DirectoryRef>
<Feature Id="Complete" Title="Complete" Description="The $(var.ProductName) program files" Level="0"
ConfigurableDirectory="INSTALLDIR" AllowAdvertise="no" InstallDefault="local" Absent="disallow">
<ComponentGroupRef Id="Files"/>
<ComponentRef Id="ProgramMenuDir"/>
</Feature>
<Icon Id="OpenLP.ico" SourceFile="OpenLP.ico"/>
<Icon Id="service_file.ico" SourceFile="service_file.ico"/>
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes"
Property="NEWPRODUCTFOUND" />
<UpgradeVersion Minimum="2.4.6" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no"
Property="UPGRADEFOUND" />
</Upgrade>
<InstallExecuteSequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts Before='InstallInitialize' />
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
</InstallUISequence>
<CustomAction Id='PreventDowngrading' Error='Newer version already installed' />
<Property Id='INNO_UNINSTALLER_64'>
<RegistrySearch Id='LocateInnoUninstaller64' Type='file' Root='HKLM'
Key='SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{AA7699FA-B2D2-43F4-8A70-D497D03C9485}_is1'
Name='UninstallString'>
<FileSearch Id='InnoUninstallerExe64' Name='unins000.exe' />
</RegistrySearch>
</Property>
<Property Id='INNO_UNINSTALLER_32'>
<RegistrySearch Id='LocateInnoUninstaller32' Type='file' Root='HKLM'
Key='SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AA7699FA-B2D2-43F4-8A70-D497D03C9485}_is1'
Name='UninstallString'>
<FileSearch Id='InnoUninstallerExe32' Name='unins000.exe' />
</RegistrySearch>
</Property>
<CustomAction Id="ca.RemoveInno64" Property="INNO_UNINSTALLER_64" ExeCommand="/SILENT" Return="check" />
<CustomAction Id="ca.RemoveInno32" Property="INNO_UNINSTALLER_32" ExeCommand="/SILENT" Return="check" />
<InstallExecuteSequence>
<Custom Action="ca.RemoveInno64" Before="InstallFiles">INNO_UNINSTALLER_64</Custom>
<Custom Action="ca.RemoveInno32" Before="InstallFiles"><![CDATA[INNO_UNINSTALLER_32 AND NOT INNO_UNINSTALLER_64]]></Custom>
</InstallExecuteSequence>
</Product>
</Wix>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 119 KiB

View File

@ -1,185 +0,0 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define AppName "OpenLP"
#define AppVerName "OpenLP %(display_version)s"
#define AppVersion "%(display_version)s"
#define AppPublisher "OpenLP Developers"
#define AppURL "http://openlp.org/"
#define AppExeName "OpenLP.exe"
#define FileHandle FileOpen("%(branch)s\dist\OpenLP\.version")
#define FileLine FileRead(FileHandle)
#define RealVersion FileLine
#expr FileClose(FileHandle)
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppID={{AA7699FA-B2D2-43F4-8A70-D497D03C9485}
AppName={#AppName}
AppVerName={cm:NameAndVersion,{#AppName},{#AppVersion}}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
DefaultDirName={pf}\{#AppName}
DefaultGroupName={#AppName}
AllowNoIcons=true
LicenseFile=LICENSE.txt
OutputDir=%(branch)s\dist\
OutputBaseFilename=OpenLP-{#RealVersion}-setup
Compression=lzma/Max
SolidCompression=true
SetupIconFile=OpenLP.ico
VersionInfoVersion={#AppVersion}
WizardImageFile=WizImageBig.bmp
WizardSmallImageFile=WizImageSmall.bmp
ChangesAssociations=true
[Languages]
Name: english; MessagesFile: compiler:Default.isl
Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl
Name: catalan; MessagesFile: compiler:Languages\Catalan.isl
Name: czech; MessagesFile: compiler:Languages\Czech.isl
Name: danish; MessagesFile: compiler:Languages\Danish.isl
Name: dutch; MessagesFile: compiler:Languages\Dutch.isl
Name: finnish; MessagesFile: compiler:Languages\Finnish.isl
Name: french; MessagesFile: compiler:Languages\French.isl
Name: german; MessagesFile: compiler:Languages\German.isl
Name: hebrew; MessagesFile: compiler:Languages\Hebrew.isl
Name: hungarian; MessagesFile: compiler:Languages\Hungarian.isl
Name: italian; MessagesFile: compiler:Languages\Italian.isl
Name: japanese; MessagesFile: compiler:Languages\Japanese.isl
Name: norwegian; MessagesFile: compiler:Languages\Norwegian.isl
Name: polish; MessagesFile: compiler:Languages\Polish.isl
Name: portuguese; MessagesFile: compiler:Languages\Portuguese.isl
Name: russian; MessagesFile: compiler:Languages\Russian.isl
Name: slovenian; MessagesFile: compiler:Languages\Slovenian.isl
Name: spanish; MessagesFile: compiler:Languages\Spanish.isl
[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; OnlyBelowVersion: 0, 6.1
[Files]
Source: %(branch)s\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
; DLL used to check if the target program is running at install time
Source: psvince.dll; flags: dontcopy
; psvince is installed in {app} folder, so it will be loaded at
; uninstall time to check if the target program is running
Source: psvince.dll; DestDir: {app}
[Icons]
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug
Name: {group}\{#AppName} Help; Filename: {app}\{#AppName}.chm; Check: FileExists(ExpandConstant('{app}\{#AppName}.chm'))
Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL}
Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: quicklaunchicon
[Run]
Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent
[Registry]
Root: HKCR; Subkey: .osz; ValueType: string; ValueName: ; ValueData: OpenLP; Flags: uninsdeletevalue
Root: HKCR; Subkey: OpenLP; ValueType: string; ValueName: ; ValueData: OpenLP Service; Flags: uninsdeletekey
Root: HKCR; Subkey: OpenLP\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\OpenLP.exe,0
Root: HKCR; Subkey: OpenLP\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\OpenLP.exe"" ""%1"""
[UninstallDelete]
; Remove support directory created when program is run:
Type: filesandordirs; Name: {app}\support
; Remove program directory if empty:
Name: {app}; Type: dirifempty
[Code]
// Function to call psvince.dll at install time
function IsModuleLoadedInstall(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall setuponly';
// Function to call psvince.dll at uninstall time
function IsModuleLoadedUninstall(modulename: AnsiString ): Boolean;
external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ;
function GetUninstallString(): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
function IsUpgrade(): Boolean;
begin
Result := (GetUninstallString() <> '');
end;
// Return Values:
// 1 - uninstall string is empty
// 2 - error executing the UnInstallString
// 3 - successfully executed the UnInstallString
function UnInstallOldVersion(): Integer;
var
sUnInstallString: String;
iResultCode: Integer;
begin
Result := 0;
sUnInstallString := GetUninstallString();
if sUnInstallString <> '' then
begin
sUnInstallString := RemoveQuotes(sUnInstallString);
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end
else
Result := 1;
end;
function InitializeSetup(): Boolean;
begin
Result := true;
while IsModuleLoadedInstall( 'OpenLP.exe' ) and Result do
begin
if MsgBox( 'Openlp is currently running, please close it to continue the install.',
mbError, MB_OKCANCEL ) = IDCANCEL then
begin
Result := false;
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if (CurStep=ssInstall) then
begin
if (IsUpgrade()) then
begin
UnInstallOldVersion();
end;
end;
end;
function InitializeUninstall(): Boolean;
begin
Result := true;
while IsModuleLoadedUninstall( 'OpenLP.exe' ) and Result do
begin
if MsgBox( 'Openlp is currently running, please close it to continue the uninstall.',
mbError, MB_OKCANCEL ) = IDCANCEL then
begin
Result := false;
end;
end;
// Unload psvince.dll, otherwise it is not deleted
UnloadDLL(ExpandConstant('{app}\psvince.dll'));
end;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

BIN
windows/WizardBanner.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
windows/WizardMain.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 601 KiB

View File

@ -18,7 +18,7 @@ Freeware=true
CommercialUse=true
[Version]
DisplayVersion=%(display_version)s
DisplayVersion=%(display_version)s-%(arch)s
PackageVersion=%(package_version)s
[Control]
@ -27,6 +27,8 @@ Start=OpenLPPortable.exe
[Associations]
FileType=osz
FileType=oszl
[FileTypeIcons]
osz=app
oszl=app

View File

@ -0,0 +1,23 @@
[executables]
sphinx = %(pyroot)s\Scripts\sphinx-build.exe
pyinstaller = %(pyroot)s\Scripts\pyinstaller.exe
htmlhelp = %(progfiles)s\HTML Help Workshop\hhc.exe
lrelease = C:\Qt\5.12\msvc2017\bin\lrelease.exe
portablelauncher = %(here)s\..\..\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe
portableinstaller = %(here)s\..\..\PortableApps.comInstaller\PortableApps.comInstaller.exe
mutool = %(here)s\..\..\mupdf-1.14.0-windows\mutool.exe
candle = %(progfilesx86)s\WiX Toolset v3.11\bin\candle.exe
light = %(progfilesx86)s\WiX Toolset v3.11\bin\light.exe
[paths]
branch = %(projects)s\openlp-branch
documentation = %(projects)s\documentation
icon = %(here)s\OpenLP.ico
hooks = %(here)s\..\pyinstaller-hooks
license = %(here)s\LICENSE.txt
portable_source = %(here)s\OpenLPPortable
portable_dest = %(projects)s\OpenLPPortable
[transifex]
username =
password =

View File

@ -1,21 +1,22 @@
[executables]
innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe
sphinx = %(pyroot)s\Scripts\sphinx-build.exe
pyinstaller = %(here)s\..\pyinstaller\pyinstaller.py
vcbuild = %(progfiles)s\Microsoft Visual Studio 9.0\VC\vcpackages\vcbuild.exe
htmlhelp = %(progfiles)s\HTML Help Workshop\hhc.exe
psvince = %(here)s\psvince.dll
lrelease = %(sitepackages)s\PyQt5\bin\lrelease.exe
portablelauncher = %(progfiles)s\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe
portableinstaller = %(progfiles)s\PortableApps.comInstaller\PortableApps.comInstaller.exe
mudrawbin = %(here)s\..\mupdf-1.8-windows\mudraw.exe
mutool = %(here)s\..\mupdf-1.9a-windows\mutool.exe
candle = %(progfiles)s\WiX Toolset v3.11\bin\candle.exe
light = %(progfiles)s\WiX Toolset v3.11\bin\light.exe
[paths]
branch = %(projects)s\trunk
documentation = %(projects)s\documentation
win32icon = %(here)s\OpenLP.ico
hooks = %(here)s\..\pyinstaller-hooks
portable = %(projects)s\OpenLPPortable
icon = %(here)s\windows\OpenLP.ico
hooks = %(here)s\pyinstaller-hooks
license = %(here)s\LICENSE.txt
portable_source = %(here)s\windows\OpenLPPortable
portable_dest = %(projects)s\OpenLPPortable
[transifex]
username =

View File

@ -0,0 +1,10 @@
<ProgId Id="OpenLP.Service" Description="OpenLP Service File" Icon="service_file.ico" Advertise="yes">
<Extension Id="osz">
<Verb Id="Open" Command="Open" Argument=" &quot;%1&quot;" />
<MIME Advertise="yes" ContentType="application/-x-openlp-service" Default="yes" />
</Extension>
<Extension Id="oszl">
<Verb Id="Open" Command="Open" Argument=" &quot;%1&quot;" />
<MIME Advertise="yes" ContentType="application/-x-openlp-service-lite" Default="yes" />
</Extension>
</ProgId>

Binary file not shown.

BIN
windows/service_file.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -1,649 +0,0 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2015 OpenLP Developers #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Windows Build Script
--------------------
This script is used to build the Windows binary and the accompanying installer.
For this script to work out of the box, it depends on a number of things:
Python 3.4
PyQt5
You should already have this installed, OpenLP doesn't work without it. The
version the script expects is the packaged one available from River Bank
Computing.
PyEnchant
This script expects the precompiled, installable version of PyEnchant to be
installed. You can find this on the PyEnchant site.
Inno Setup 5
Inno Setup should be installed into "C:\%PROGRAMFILES%\Inno Setup 5"
Sphinx
This is used to build the documentation. The documentation trunk must be at
the same directory level as OpenLP trunk and named "documentation".
HTML Help Workshop
This is used to create the help file.
PyInstaller
PyInstaller should be a git clone of either
https://github.com/matysek/pyinstaller branch python3 or
https://github.com/pyinstaller/pyinstaller branch python3
Bazaar
You need the command line "bzr" client installed.
OpenLP
A checkout of the latest code, in a branch directory, which is in a Bazaar
shared repository directory. This means your code should be in a directory
structure like this: "openlp\branch-name".
Visual C++ 2008 Express Edition
This is to build pptviewlib.dll, the library for controlling the
PowerPointViewer.
windows-builder.py
This script, of course. It should be in the "windows-installer" directory
at the same level as OpenLP trunk.
psvince.dll
This dll is used during the actual install of OpenLP to check if OpenLP is
running on the users machine prior to the setup. If OpenLP is running,
the install will fail. The dll can be obtained from here:
http://www.vincenzo.net/isxkb/index.php?title=PSVince)
The dll is presently included with this script.
Mako
Mako Templates for Python. This package is required for building the
remote plugin. It can be installed by going to your
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
SQLAlchemy Migrate
Required for the databases used in OpenLP. The package can be
obtained here:
http://code.google.com/p/sqlalchemy-migrate/
MuPDF
Required for PDF support in OpenLP. Download the windows build from
mupdf.com, extract it, and set the mudrawbin option in the config file to
point to mudraw.exe
Portable App Builds
The following are required if you are planning to make a portable build of
OpenLP. The portable build conforms to the standards published by
PortableApps.com:
http://portableapps.com/development/portableapps.com_format
PortableApps.com Installer:
http://portableapps.com/apps/development/portableapps.com_installer
PortableApps.com Launcher:
http://portableapps.com/apps/development/portableapps.com_launcher
NSIS Portable (Unicode version):
http://portableapps.com/apps/development/nsis_portable
"""
import os
import sys
from shutil import copy, rmtree, move
from distutils import dir_util
from subprocess import Popen, PIPE
from configparser import ConfigParser
from argparse import ArgumentParser
class WindowsBuilder(object):
"""
The :class:`WindowsBuilder` class encapsulates everything that is needed
to build a Windows installer.
"""
def __init__(self):
self.setup_args()
self.setup_system_paths()
self.read_config()
self.setup_executables()
self.setup_paths()
self.version = ''
def _print(self, text, *args):
"""
Print stuff out. Later we might want to use a log file.
"""
if len(args) > 0:
text = text % tuple(args)
print(text)
def _print_verbose(self, text, *args):
"""
Print output, obeying "verbose" mode.
"""
if self.args.verbose:
self._print(text, *args)
def setup_args(self):
"""
Set up an argument parser and parse the command line arguments.
"""
parser = ArgumentParser()
parser.add_argument('-b', '--branch', metavar='BRANCH', dest='branch',
help='Specify the path to the branch you wish to build.', default=None)
parser.add_argument('-d', '--documentation', metavar='DOCS', dest='docs', default=None,
help='Specify the path to the documentation branch.')
parser.add_argument('-c', '--config', metavar='CONFIG', dest='config',
help='Specify the path to the configuration file.',
default=os.path.abspath(os.path.join('.', 'config.ini')))
parser.add_argument('-u', '--skip-update', dest='skip_update', action='store_true', default=False,
help='Do NOT update the branch before building.')
parser.add_argument('-p', '--portable', metavar='PORTABLE', dest='portable', default=None,
help='Specify the path to build the portable installation.')
parser.add_argument('-t', '--skip-translations', dest='skip_translations', action='store_true', default=False,
help='Do NOT update the language translation files.')
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
help='Print out additional information.')
self.args = parser.parse_args()
def read_config(self):
"""
Read the configuration from the configuration file.
"""
self.config = ConfigParser(defaults={
'pyroot': self.python_root,
'progfiles': self.program_files,
'sitepackages': self.site_packages,
'here': self.script_path,
'projects': os.path.abspath(os.path.join(self.script_path, '..', '..')),
})
self.config.read(os.path.abspath(self.args.config))
def setup_system_paths(self):
"""
Set up some system paths.
"""
self.script_path = os.path.dirname(os.path.abspath(__file__))
self.python = sys.executable
self.python_root = os.path.dirname(self.python)
self.site_packages = os.path.join(self.python_root, 'Lib', 'site-packages')
self.program_files = os.getenv('PROGRAMFILES')
def setup_executables(self):
"""
Set up the paths to the executables we use.
"""
self.innosetup = os.path.abspath(self.config.get('executables', 'innosetup'))
self.sphinx = os.path.abspath(self.config.get('executables', 'sphinx'))
self.pyinstaller = os.path.abspath(self.config.get('executables', 'pyinstaller'))
self.vcbuild = os.path.abspath(self.config.get('executables', 'vcbuild'))
self.hhc = os.path.abspath(self.config.get('executables', 'htmlhelp'))
self.psvince = os.path.abspath(self.config.get('executables', 'psvince'))
self.portableinstaller = os.path.abspath(self.config.get('executables', 'portableinstaller'))
self.portablelauncher = os.path.abspath(self.config.get('executables', 'portablelauncher'))
self.mudraw_bin = os.path.abspath(self.config.get('executables', 'mudrawbin'))
if os.path.exists(os.path.join(self.site_packages, 'PyQt5', 'bin')):
# Older versions of the PyQt5 Windows installer put their binaries
# in the "bin" directory
self.lrelease = os.path.join(self.site_packages, 'PyQt5', 'bin', 'lrelease.exe')
else:
# Newer versions of the PyQt5 Windows installer put their binaries
# in the base directory of the installation
self.lrelease = os.path.join(self.site_packages, 'PyQt5', 'lrelease.exe')
def setup_paths(self):
"""
Set up a variety of paths that we use throughout the build process.
"""
if self.args.branch:
branch_path = self.args.branch
else:
branch_path = self.config.get('paths', 'branch')
self.branch_path = os.path.abspath(branch_path)
if self.args.docs:
docs_path = self.args.docs
else:
docs_path = self.config.get('paths', 'documentation')
self.docs_path = os.path.abspath(docs_path)
if self.args.portable:
portable_path = self.args.portable
else:
try:
portable_path = self.config.get('paths', 'portable')
except:
portable_path = ''
if portable_path:
self.portable_path = os.path.abspath(portable_path)
self.args.portable = self.portable_path
else:
self.portable_path = ''
self.openlp_script = os.path.abspath(os.path.join(branch_path, 'openlp.py'))
self.hooks_path = os.path.abspath(self.config.get('paths', 'hooks'))
self.win32_icon = os.path.abspath(self.config.get('paths', 'win32icon'))
self.i18n_utils = os.path.join(self.branch_path, 'scripts', 'translation_utils.py')
self.source_path = os.path.join(self.branch_path, 'openlp')
self.manual_path = os.path.join(self.docs_path, 'manual')
self.manual_build_path = os.path.join(self.manual_path, 'build')
self.helpfile_path = os.path.join(self.manual_build_path, 'htmlhelp')
self.i18n_path = os.path.join(self.branch_path, 'resources', 'i18n')
self.winres_path = os.path.join(self.branch_path, 'resources', 'windows')
self.build_path = os.path.join(self.branch_path, 'build')
self.dist_path = os.path.join(self.branch_path, 'dist', 'OpenLP')
self.dist_path_pyinst_arg = os.path.join(self.branch_path, 'dist')
self.pptviewlib_path = os.path.join(self.source_path, 'plugins', 'presentations', 'lib', 'pptviewlib')
def update_code(self):
"""
Update the code in the branch.
"""
os.chdir(self.branch_path)
self._print('Reverting any changes to the code...')
bzr = Popen(('bzr', 'revert'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
self._print(output)
raise Exception('Error reverting the code')
self._print('Updating the code...')
bzr = Popen(('bzr', 'update'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
self._print(output)
raise Exception('Error updating the code')
def run_pyinstaller(self):
"""
Run PyInstaller on the branch to build an executable.
"""
self._print('Running PyInstaller...')
os.chdir(self.branch_path)
cmd = [self.python,
self.pyinstaller,
'--clean',
'--noconfirm',
'--windowed',
'--noupx',
'--additional-hooks-dir', self.hooks_path,
'--distpath', self.dist_path_pyinst_arg,
'-i', self.win32_icon,
'-p', self.branch_path,
'-n', 'OpenLP',
self.openlp_script]
if not self.args.verbose:
cmd.append('--log-level=ERROR')
else:
cmd.append('--log-level=DEBUG')
pyinstaller = Popen(cmd)
code = pyinstaller.wait()
if code != 0:
raise Exception('Error running PyInstaller')
def write_version_file(self):
"""
Write the version number to a file for reading once installed.
"""
self._print('Writing version file...')
os.chdir(self.branch_path)
bzr = Popen(('bzr', 'tags'), stdout=PIPE)
output = bzr.communicate()[0]
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr tags')
lines = output.splitlines()
if len(lines) == 0:
tag = '0.0.0'
revision = '0'
else:
tag, revision = lines[-1].decode('utf-8').split()
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
output, error = bzr.communicate()
code = bzr.wait()
if code != 0:
raise Exception('Error running bzr log')
latest = output.decode('utf-8').split(':')[0]
version_string = latest == revision and tag or '%s-bzr%s' % (tag, latest)
# Save decimal version in case we need to do a portable build.
self.version = latest == revision and tag or '%s.%s' % (tag, latest)
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
version_file.write(str(version_string))
version_file.close()
def copy_default_theme(self):
"""
Copy the default theme to the correct directory for OpenLP.
"""
self._print('Copying default theme...')
source = os.path.join(self.source_path, 'core', 'lib', 'json')
dest = os.path.join(self.dist_path, 'core', 'lib', 'json')
for root, dirs, files in os.walk(source):
for filename in files:
if filename.endswith('.json'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_plugins(self):
"""
Copy all the plugins to the correct directory so that OpenLP sees that
it has plugins.
"""
self._print('Copying plugins...')
source = os.path.join(self.source_path, 'plugins')
dest = os.path.join(self.dist_path, 'plugins')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_media_player(self):
"""
Copy the media players to the correct directory for OpenLP.
"""
self._print('Copying media player...')
source = os.path.join(self.source_path, 'core', 'ui', 'media')
dest = os.path.join(self.dist_path, 'core', 'ui', 'media')
for root, dirs, files in os.walk(source):
for filename in files:
if not filename.endswith('.pyc'):
dest_path = os.path.join(dest, root[len(source) + 1:])
if not os.path.exists(dest_path):
os.makedirs(dest_path)
self._print_verbose('... %s', filename)
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
def copy_windows_files(self):
"""
Copy all the Windows-specific files.
"""
self._print('Copying extra files for Windows...')
self._print_verbose('... OpenLP.ico')
copy(os.path.join(self.script_path, 'OpenLP.ico'), os.path.join(self.dist_path, 'OpenLP.ico'))
self._print_verbose('... LICENSE.txt')
copy(os.path.join(self.script_path, 'LICENSE.txt'), os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... psvince.dll')
copy(self.psvince, os.path.join(self.dist_path, 'psvince.dll'))
if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')):
self._print_verbose('... OpenLP.chm')
copy(os.path.join(self.helpfile_path, 'OpenLP.chm'), os.path.join(self.dist_path, 'OpenLP.chm'))
else:
self._print('... WARNING: Windows help file not found')
self._print_verbose('... mudraw.exe')
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.exe'))
else:
self._print('... WARNING: mudraw.exe not found')
def update_translations(self):
"""
Update the translations.
"""
self._print('Updating translations...')
if not self.config.has_section('transifex'):
raise Exception('No section named "transifex" found.')
if not self.config.has_option('transifex', 'username'):
raise Exception('No option named "username" found.')
if not self.config.has_option('transifex', 'password'):
raise Exception('No option named "password" found.')
username = self.config.get('transifex', 'username')
password = self.config.get('transifex', 'password')
os.chdir(os.path.dirname(self.i18n_utils))
translation_utils = Popen([self.python, self.i18n_utils, '-qdpu', '-U', username, '-P', password])
code = translation_utils.wait()
if code != 0:
raise Exception('Error running translation_utils.py')
def compile_translations(self):
"""
Compile the translations for Qt.
"""
self._print('Compiling translations...')
files = os.listdir(self.i18n_path)
if not os.path.exists(os.path.join(self.dist_path, 'i18n')):
os.makedirs(os.path.join(self.dist_path, 'i18n'))
for file in files:
if file.endswith('.ts'):
self._print_verbose('... %s', file)
source_path = os.path.join(self.i18n_path, file)
dest_path = os.path.join(self.dist_path, 'i18n', file.replace('.ts', '.qm'))
lconvert = Popen((self.lrelease, '-compress', '-silent', source_path, '-qm', dest_path))
code = lconvert.wait()
if code != 0:
raise Exception('Error running lconvert on %s' % source_path)
self._print('Copying qm files...')
source = os.path.join(self.site_packages, 'PyQt5', 'translations')
files = os.listdir(source)
for filename in files:
if filename.startswith('qt_') and filename.endswith('.qm') and len(filename) == 8:
self._print_verbose('... %s', filename)
copy(os.path.join(source, filename), os.path.join(self.dist_path, 'i18n', filename))
def run_sphinx(self):
"""
Run Sphinx to build an HTML Help project.
"""
self._print('Deleting previous help manual build... %s', self.manual_build_path)
if os.path.exists(self.manual_build_path):
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)
output, error = sphinx.communicate()
code = sphinx.wait()
if code != 0:
self._print(output)
raise Exception('Error running Sphinx')
def run_htmlhelp(self):
"""
Run HTML Help Workshop to convert the Sphinx output into a manual.
"""
self._print('Running HTML Help Workshop...')
os.chdir(os.path.join(self.manual_build_path, 'htmlhelp'))
hhc = Popen((self.hhc, 'OpenLP.chm'), stdout=PIPE)
output, error = hhc.communicate()
code = hhc.wait()
if code != 1:
self._print('Exit code:', code)
self._print(output)
raise Exception('Error running HTML Help Workshop')
def create_innosetup_file(self):
"""
Create an InnoSetup file pointing to the branch being built.
"""
self._print('Creating Inno Setup file...')
input = open(os.path.join(self.script_path, 'OpenLP.iss.default'), 'r').read()
output = input.replace('%(branch)s', self.branch_path)
output = output.replace('%(display_version)s', self.version)
outfile = open(os.path.join(self.script_path, 'OpenLP.iss'), 'w')
outfile.write(output)
outfile.close()
def check_portableapp_directory(self):
"""
Checks the PortableApp directory structure amd creates
missing subdirs
"""
self._print(' Checking PortableApps directory structure...')
launcher_path = os.path.join(self.portable_path, 'App', 'Appinfo', 'Launcher')
if not os.path.exists(launcher_path):
os.makedirs(launcher_path)
settings_path = os.path.join(self.portable_path, 'Data', 'Settings')
if not os.path.exists(settings_path):
os.makedirs(settings_path)
def create_portableapps_appinfo_file(self):
"""
Create a Portabbleapps appinfo.ini file.
"""
self._print(' Creating PortableApps appinfo file ...')
portable_version = self.version + '.0' * (3 - self.version.count('.'))
input = open(os.path.join(self.script_path, 'appinfo.ini.default'), 'r').read()
output = input.replace('%(display_version)s', self.version)
output = output.replace('%(package_version)s', portable_version)
outfile = open(os.path.join(self.portable_path, 'App', 'Appinfo', 'appinfo.ini'), 'w')
outfile.write(output)
outfile.close()
def run_innosetup(self):
"""
Run InnoSetup to create an installer.
"""
self._print('Running Inno Setup...')
os.chdir(self.script_path)
innosetup = Popen((self.innosetup, os.path.join(self.script_path, 'OpenLP.iss'), '/q'))
code = innosetup.wait()
if code != 0:
raise Exception('Error running Inno Setup')
def run_portableapp_builder(self):
"""
Creates a portable installer.
1 Copies the distribution to the portable apps directory
2 Builds the PortableApps Launcher
3 Builds the PortableApps Install
"""
self._print('Running PortableApps Builder...')
self._print(' Clearing old files')
# Remove previous contents of portableapp build directory.
if os.path.exists(self.portable_path):
rmtree(self.portable_path)
self._print(' Creating PortableApps build directory')
# Copy the contents of the OpenLPPortable directory to the portable
# build directory.
dir_util.copy_tree(os.path.join(self.script_path, 'OpenLPPortable'), self.portable_path)
self.check_portableapp_directory()
self.create_portableapps_appinfo_file()
# Copy distribution files to portableapp build directory.
self._print(' Copying distribution files')
portable_app_path = os.path.join(self.portable_path, 'App', 'OpenLP')
dir_util.copy_tree(self.dist_path, portable_app_path)
# Copy help files to portableapp build directory.
if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')):
self._print(' Copying help files')
dir_util.copy_tree(self.helpfile_path, os.path.join(portable_app_path, 'help'))
else:
self._print('... WARNING: Windows help file not found')
# Build the launcher.
self._print(' Building PortableApps Launcher')
portableapps = Popen((self.portablelauncher, self.portable_path), stdout=PIPE)
code = portableapps.wait()
if code != 0:
raise Exception('Error creating PortableAppa Launcher')
# Build the portable installer.
self._print(' Building PortableApps Installer')
portableapps = Popen((self.portableinstaller, self.portable_path), stdout=PIPE)
code = portableapps.wait()
if code != 0:
raise Exception('Error running PortableApps Installer')
portable_app = os.path.abspath(os.path.join(self.portable_path, '..',
'OpenLPPortable_%s.paf.exe' % self.version))
if os.path.exists(portable_app):
move(portable_app, os.path.abspath(os.path.join(self.dist_path, '..')))
self._print(' PortableApp build complete')
else:
raise Exception('PortableApp failed to build')
def build_pptviewlib(self):
"""
Build the PowerPoint Viewer DLL using Visual Studio.
"""
self._print('Building PPTVIEWLIB.DLL...')
if not os.path.exists(self.vcbuild):
self._print('... WARNING: vcbuild.exe was not found, skipping building pptviewlib.dll')
return
vcbuild = Popen((self.vcbuild, '/rebuild', os.path.join(self.pptviewlib_path, 'pptviewlib.vcproj'),
'Release|Win32'))
code = vcbuild.wait()
if code != 0:
raise Exception('Error building pptviewlib.dll')
copy(os.path.join(self.pptviewlib_path, 'Release', 'pptviewlib.dll'), self.pptviewlib_path)
def main(self):
"""
The main function to run the Windows builder.
"""
self._print_verbose('OpenLP main script: ......%s', self.openlp_script)
self._print_verbose('Script path: .............%s', os.path.dirname(os.path.abspath(__file__)))
self._print_verbose('Branch path: .............%s', self.branch_path)
self._print_verbose('Source path: .............%s', self.source_path)
self._print_verbose('Dist path: ...............%s', self.dist_path)
self._print_verbose('Portable path: ...........%s', self.portable_path)
self._print_verbose('PyInstaller: .............%s', self.pyinstaller)
self._print_verbose('Documentation branch path:%s', self.docs_path)
self._print_verbose('Help file build path: ....%s', self.helpfile_path)
self._print_verbose('Inno Setup path: .........%s', self.innosetup)
self._print_verbose('PortableApp Launcher......%s', self.portablelauncher)
self._print_verbose('PortableApp Installer.....%s', self.portableinstaller)
self._print_verbose('Windows resources: .......%s', self.winres_path)
self._print_verbose('VCBuild path: ............%s', self.vcbuild)
self._print_verbose('PPTVIEWLIB path: .........%s', self.pptviewlib_path)
self._print_verbose('Mudraw binary ............%s', self.mudraw_bin)
self._print_verbose('')
if not self.args.skip_update:
self.update_code()
self.build_pptviewlib()
self.run_pyinstaller()
self.write_version_file()
self.copy_default_theme()
self.copy_plugins()
self.copy_media_player()
if os.path.exists(self.manual_path):
self.run_sphinx()
self.run_htmlhelp()
else:
self._print('')
self._print('WARNING: Documentation trunk not found. Windows')
self._print(' Help file will not be included in build')
self._print('')
self.copy_windows_files()
if not self.args.skip_translations:
self.update_translations()
self.compile_translations()
self.create_innosetup_file()
self.run_innosetup()
if self.args.portable:
self.run_portableapp_builder()
self._print('Done.')
if __name__ == '__main__':
WindowsBuilder().main()