From beb92f149ba495c8b345726bccd917077f02e963 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 25 Sep 2017 21:58:43 +0200 Subject: [PATCH 01/47] Try to update packaging. --- windows/config-appveyor.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 8161e61..a0ab12b 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -1,11 +1,12 @@ [executables] innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe sphinx = %(pyroot)s\Scripts\sphinx-build.exe -pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py +#pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py +pyinstaller = %(pyroot)s\Script\pyinstaller 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 = C:\Qt\5.5\msvc2013\bin\lrelease.exe +lrelease = C:\Qt\5.9\msvc2015\bin\lrelease.exe portablelauncher = %(here)s\..\..\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe portableinstaller = %(here)s\..\..\PortableApps.comInstaller\PortableApps.comInstaller.exe mutool = %(here)s\..\..\mupdf-1.9a-windows\mutool.exe From c42ac962b1948f8ac3a8be4ef0215be4268c3651 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 25 Sep 2017 22:31:41 +0200 Subject: [PATCH 02/47] update settings --- windows/config-appveyor.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index a0ab12b..231f44a 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -2,7 +2,7 @@ innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe sphinx = %(pyroot)s\Scripts\sphinx-build.exe #pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py -pyinstaller = %(pyroot)s\Script\pyinstaller +pyinstaller = %(pyroot)s\Script\pyinstaller-script.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 From 468f1a22c88ecea07cb4eef5e536f817c9e5c224 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 25 Sep 2017 22:59:43 +0200 Subject: [PATCH 03/47] hardcode python script path --- windows/config-appveyor.ini | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 231f44a..1437fb9 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -1,8 +1,10 @@ [executables] innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe -sphinx = %(pyroot)s\Scripts\sphinx-build.exe +#sphinx = %(pyroot)s\Scripts\sphinx-build.exe +sphinx = C:\python36\Scripts\sphinx-build.exe #pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py -pyinstaller = %(pyroot)s\Script\pyinstaller-script.py +#pyinstaller = %(pyroot)s\Script\pyinstaller-script.py +pyinstaller = C:\python36\Script\pyinstaller-script.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 From 40116f03f048622af4d549afba2be3ce8293c431 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 20:24:18 +0200 Subject: [PATCH 04/47] Load paths before executables. --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 6aec400..0a12ff6 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -65,8 +65,8 @@ class Builder(object): self.setup_args() self.setup_system_paths() self.read_config() - self.setup_executables() self.setup_paths() + self.setup_executables() self.setup_extra() def _print(self, text, *args): From 4d8962b7e59ef37966b8b99b0816652825b3152d Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 20:30:22 +0200 Subject: [PATCH 05/47] clean up config file --- windows/config-appveyor.ini | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 1437fb9..96db2b5 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -1,10 +1,7 @@ [executables] innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe -#sphinx = %(pyroot)s\Scripts\sphinx-build.exe -sphinx = C:\python36\Scripts\sphinx-build.exe -#pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py -#pyinstaller = %(pyroot)s\Script\pyinstaller-script.py -pyinstaller = C:\python36\Script\pyinstaller-script.py +sphinx = %(pyroot)s\Scripts\sphinx-build.exe +pyinstaller = %(pyroot)s\Script\pyinstaller-script.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 From d6784e38cb4e88eb9b2149d2b637b82e1d9e768d Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 21:34:59 +0200 Subject: [PATCH 06/47] try some things --- builders/builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 0a12ff6..0e6c53b 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -43,7 +43,7 @@ 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) + return os.path.isfile(fpath) #and (os.access(fpath, os.X_OK) or fpath.endswith('.py')) fpath, fname = os.path.split(program) if fpath and is_exe(os.path.abspath(program)): @@ -189,6 +189,7 @@ class Builder(object): self._print_verbose('Executables:') for executable in self.config.options('executables'): path = self.config.get('executables', executable) + print(executable + " : " + path) if not path.strip(): path = None else: @@ -203,6 +204,7 @@ class Builder(object): self._print_verbose('Paths:') for name in self.config.options('paths'): path = os.path.abspath(self.config.get('paths', name)) + print(executable + " : " + path) 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 From 6ecb97abe77d5817dff2ebe422c5aab418a23f1b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 21:39:33 +0200 Subject: [PATCH 07/47] fix copy/paste error --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 0e6c53b..cbdbbf9 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -204,7 +204,7 @@ class Builder(object): self._print_verbose('Paths:') for name in self.config.options('paths'): path = os.path.abspath(self.config.get('paths', name)) - print(executable + " : " + path) + print(name + " : " + path) 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 From 42741cbfb2a2de571166ce4674c537c153338c2b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 21:58:20 +0200 Subject: [PATCH 08/47] forgot a s. --- windows/config-appveyor.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 96db2b5..d2a7628 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -1,7 +1,7 @@ [executables] innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe sphinx = %(pyroot)s\Scripts\sphinx-build.exe -pyinstaller = %(pyroot)s\Script\pyinstaller-script.py +pyinstaller = %(pyroot)s\Scripts\pyinstaller-script.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 From 9ae3703f76d1beb33be6ef800940276a2c3ebca4 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 22:06:28 +0200 Subject: [PATCH 09/47] Revert some changes. --- builders/builder.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index cbdbbf9..6aec400 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -43,7 +43,7 @@ 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) or fpath.endswith('.py')) + 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)): @@ -65,8 +65,8 @@ class Builder(object): self.setup_args() self.setup_system_paths() self.read_config() - self.setup_paths() self.setup_executables() + self.setup_paths() self.setup_extra() def _print(self, text, *args): @@ -189,7 +189,6 @@ class Builder(object): self._print_verbose('Executables:') for executable in self.config.options('executables'): path = self.config.get('executables', executable) - print(executable + " : " + path) if not path.strip(): path = None else: @@ -204,7 +203,6 @@ class Builder(object): self._print_verbose('Paths:') for name in self.config.options('paths'): path = os.path.abspath(self.config.get('paths', name)) - print(name + " : " + path) 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 From 0ad2a6186abe30e8aa76f10e4f869d0333f60bca Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 26 Sep 2017 23:58:42 +0200 Subject: [PATCH 10/47] Try to include new ucrt distributables in win build. --- builders/builder.py | 8 ++++++++ builders/windows-builder.py | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 6aec400..d740e16 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -262,6 +262,12 @@ class Builder(object): self._bzr('export', self.branch_path, ['-r', 'tag:' + self.version, self.work_path], 'Error exporting the code') + def get_binaries(self): + """ + Return a list of the binaries to include + """ + return [] + def run_pyinstaller(self): """ Run PyInstaller on the branch to build an executable. @@ -269,6 +275,7 @@ class Builder(object): self._print('Running PyInstaller...') copy(os.path.join(self.work_path, 'openlp.py'), self.openlp_script) os.chdir(self.work_path) + # Create the binary list cmd = [self.python, self.pyinstaller_exe, '--clean', @@ -279,6 +286,7 @@ class Builder(object): '--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'), '-i', self.icon_path, '-n', 'OpenLP', + *get_binaries(), # Adds any binaries we wish to include self.openlp_script] if self.args.verbose: cmd.append('--log-level=DEBUG') diff --git a/builders/windows-builder.py b/builders/windows-builder.py index a0086f3..5b873a9 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -26,12 +26,11 @@ 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 +Python 3.6 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. + version the script expects is the packaged one available from pypi. PyEnchant This script expects the precompiled, installable version of PyEnchant to be @@ -48,8 +47,7 @@ HTML Help Workshop This is used to create the help file. PyInstaller - PyInstaller should be a git clone of - https://github.com/matysek/pyinstaller branch develop + PyInstaller can be installed from pypi. Bazaar You need the command line "bzr" client installed. @@ -340,6 +338,16 @@ class WindowsBuilder(Builder): if self.args.portable: self._run_portableapp_builder() + def get_binaries(self): + """ + Return a list of the binaries to include + """ + binaries = [] + for binary in glob.glob('C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\*.dll'): + binaries.append('--add-binary') + binaries.append(binary + ";.") + return binaries + if __name__ == '__main__': WindowsBuilder().main() From 1b12ae51e1bf1ce406739046ae4b597d15acab20 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Sep 2017 22:15:53 +0200 Subject: [PATCH 11/47] Fix idention. --- builders/windows-builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 5b873a9..7ccd5d4 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -346,7 +346,7 @@ class WindowsBuilder(Builder): for binary in glob.glob('C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\*.dll'): binaries.append('--add-binary') binaries.append(binary + ";.") - return binaries + return binaries if __name__ == '__main__': From d13c07c58e30d2cfe4e4955d738535d9bc715909 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Sep 2017 22:26:18 +0200 Subject: [PATCH 12/47] Try some backslash escaping --- builders/windows-builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 7ccd5d4..4b648ba 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -343,7 +343,8 @@ class WindowsBuilder(Builder): Return a list of the binaries to include """ binaries = [] - for binary in glob.glob('C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x86\*.dll'): + # Finds the UCRT DDLs available from the Windows SDK + for binary in glob.glob('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x86\\*.dll'): binaries.append('--add-binary') binaries.append(binary + ";.") return binaries From 770caefae7473f9db45192d4af9c1f75bf934d93 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Sep 2017 22:33:01 +0200 Subject: [PATCH 13/47] Fix idention. --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index d740e16..851c589 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -266,7 +266,7 @@ class Builder(object): """ Return a list of the binaries to include """ - return [] + return [] def run_pyinstaller(self): """ From 645a55b3b3cb8f8f9cd8a43eaff3ebfe77ca4812 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Sep 2017 22:39:45 +0200 Subject: [PATCH 14/47] fix method call --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 851c589..d1e7734 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -286,7 +286,7 @@ class Builder(object): '--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'), '-i', self.icon_path, '-n', 'OpenLP', - *get_binaries(), # Adds any binaries we wish to include + *self.get_binaries(), # Adds any binaries we wish to include self.openlp_script] if self.args.verbose: cmd.append('--log-level=DEBUG') From 2df10e780d3255f4003075991305f89b980e8ee4 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 27 Sep 2017 22:53:43 +0200 Subject: [PATCH 15/47] forgot to import glob --- builders/windows-builder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 4b648ba..3e7f656 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -113,6 +113,7 @@ Portable App Builds """ import os +import glob from distutils import dir_util from shutil import copy, move, rmtree From d05247ea479c7f903b8e0f37269c7c6245849157 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 28 Sep 2017 21:25:51 +0200 Subject: [PATCH 16/47] Change method name --- builders/builder.py | 7 +++---- builders/windows-builder.py | 14 +++++++------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index d1e7734..5226da4 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -262,9 +262,9 @@ class Builder(object): self._bzr('export', self.branch_path, ['-r', 'tag:' + self.version, self.work_path], 'Error exporting the code') - def get_binaries(self): + def get_extra_parameters(self): """ - Return a list of the binaries to include + Return a list of any extra parameters we wish to use """ return [] @@ -275,7 +275,6 @@ class Builder(object): self._print('Running PyInstaller...') copy(os.path.join(self.work_path, 'openlp.py'), self.openlp_script) os.chdir(self.work_path) - # Create the binary list cmd = [self.python, self.pyinstaller_exe, '--clean', @@ -286,7 +285,7 @@ class Builder(object): '--runtime-hook', os.path.join(self.hooks_path, 'rthook_ssl.py'), '-i', self.icon_path, '-n', 'OpenLP', - *self.get_binaries(), # Adds any binaries we wish to include + *self.get_extra_parameters(), # Adds any extra parameters we wish to use self.openlp_script] if self.args.verbose: cmd.append('--log-level=DEBUG') diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 3e7f656..1562789 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -339,16 +339,16 @@ class WindowsBuilder(Builder): if self.args.portable: self._run_portableapp_builder() - def get_binaries(self): + def get_extra_parameters(self): """ - Return a list of the binaries to include + Return a list of any extra parameters we wish to use """ - binaries = [] - # Finds the UCRT DDLs available from the Windows SDK + parameters = [] + # Finds the UCRT DDLs available from the Windows 10 SDK for binary in glob.glob('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x86\\*.dll'): - binaries.append('--add-binary') - binaries.append(binary + ";.") - return binaries + parameters.append('--add-binary') + parameters.append(binary + ";.") + return parameters if __name__ == '__main__': From afcc047ee3e4cfd96272513198b4f46b2f38bfe6 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Thu, 12 Jul 2018 21:41:00 +0200 Subject: [PATCH 17/47] Add an option for providing tag and revision to avoid using bzr. --- builders/builder.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 6aec400..9670c69 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -160,6 +160,8 @@ class Builder(object): 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='-bzr', default=None, + help='Override tag and revision, should be in format -bzr') self.add_extra_args(parser) self.args = parser.parse_args() @@ -297,17 +299,20 @@ class Builder(object): """ self._print('Writing version file...') if not self.args.release: - # 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' + if self.args.tag_override: + self.version = self.args.tag_override 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}-bzr{revision}'.format(tag=tag, revision=revision) + # 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}-bzr{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)) From 57caf4e5bbdaea080cf8ad05df147ae258df6738 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 26 Oct 2018 23:08:24 -0700 Subject: [PATCH 18/47] Fix builder script to use new OpenLP run script name. --- builders/builder.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 9670c69..31252bc 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -218,7 +218,7 @@ class Builder(object): else: self.version = None self.work_path = self.branch_path - self.openlp_script = os.path.abspath(os.path.join(self.work_path, 'openlp-run.py')) + 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') @@ -269,7 +269,6 @@ class Builder(object): Run PyInstaller on the branch to build an executable. """ self._print('Running PyInstaller...') - copy(os.path.join(self.work_path, 'openlp.py'), self.openlp_script) os.chdir(self.work_path) cmd = [self.python, self.pyinstaller_exe, @@ -428,7 +427,8 @@ class Builder(object): 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)] + 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() @@ -477,5 +477,3 @@ class Builder(object): self._print('Done.') raise SystemExit() - - From 499847bbcdc0ac35cf776d71ff467e439154fcae Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 27 Oct 2018 10:35:03 -0700 Subject: [PATCH 19/47] Fix Qt paths so that code signing works --- builders/macosx-builder.py | 114 ++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 9 deletions(-) diff --git a/builders/macosx-builder.py b/builders/macosx-builder.py index 8213434..01afda8 100644 --- a/builders/macosx-builder.py +++ b/builders/macosx-builder.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 ############################################################################### # OpenLP - Open Source Lyrics Projection # @@ -94,15 +94,15 @@ You may need to install chardet via pip:: """ import os -import plistlib -import signal -from shutil import copy, copytree +from pathlib import Path +from shutil import copy, copytree, move, rmtree from macholib.MachO import MachO -from macholib.util import flipwritable, in_system_path +from macholib.util import in_system_path from builder import Builder + class MacOSXBuilder(Builder): """ The :class:`MacosxBuilder` class encapsulates everything that is needed @@ -119,6 +119,99 @@ class MacOSXBuilder(Builder): 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 @@ -181,7 +274,8 @@ class MacOSXBuilder(Builder): """ 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))) + 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') @@ -237,9 +331,10 @@ class MacOSXBuilder(Builder): 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') + '-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) @@ -299,6 +394,7 @@ class MacOSXBuilder(Builder): """ Build the actual DMG """ + self._fix_qt_paths() self._code_sign() self._create_dmg() From 16a8037d44b2b256d5f435a582b1794901d70f1f Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 1 Dec 2018 23:07:08 -0700 Subject: [PATCH 20/47] Use new version number format --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 31252bc..e3cc5ee 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -311,7 +311,7 @@ class Builder(object): 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}-bzr{revision}'.format(tag=tag, revision=revision) + 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)) From ba1564c7be68f7c7ffe47a45d3c1fb56a410b46b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 21:43:26 +0100 Subject: [PATCH 21/47] try some new values --- windows/config-appveyor.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index da9fbc5..b3ed60c 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -7,8 +7,8 @@ psvince = %(here)s\psvince.dll 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 = %(project)s\openlp-branch\mutool.exe -mediainfo = %(project)s\openlp-branch\MediaInfo.exe +mutool = %(here)s\..\..openlp-branch\mutool.exe +mediainfo = %(here)s\..\..openlp-branch\MediaInfo.exe [paths] branch = %(projects)s\openlp-branch From aace963ea60a1cfefbea6976df0a53821bb906bc Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 21:50:35 +0100 Subject: [PATCH 22/47] remove pptlibview build --- builders/windows-builder.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index b893d3b..9ef30f8 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -277,7 +277,6 @@ class WindowsBuilder(Builder): 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') - self.pptviewlib_path = os.path.join(self.source_path, 'plugins', 'presentations', 'lib', 'pptviewlib') def copy_extra_files(self): """ @@ -318,7 +317,6 @@ class WindowsBuilder(Builder): """ Build the installer """ - self._build_pptviewlib() self._create_innosetup_file() self._run_innosetup() if self.args.portable: From eb4711d70da7cd87becbe4c7bc2421122c9a1f27 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 22:12:24 +0100 Subject: [PATCH 23/47] try some new values --- windows/config-appveyor.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index b3ed60c..76d8f76 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -7,8 +7,8 @@ psvince = %(here)s\psvince.dll 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\..\..openlp-branch\mutool.exe -mediainfo = %(here)s\..\..openlp-branch\MediaInfo.exe +mutool = %(here)s\..openlp-branch\mutool.exe +mediainfo = %(here)s\..openlp-branch\MediaInfo.exe [paths] branch = %(projects)s\openlp-branch From 75abfc27d9712db9859504b80aa5c3ec22f28839 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 22:34:14 +0100 Subject: [PATCH 24/47] debug print --- builders/builder.py | 1 + windows/config-appveyor.ini | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 72e3d4d..66fdd79 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -90,6 +90,7 @@ class Builder(object): Return text from stdout. """ + _print(cmd) proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) output, error = proc.communicate() code = proc.wait() diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 76d8f76..9dd0298 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -7,8 +7,8 @@ psvince = %(here)s\psvince.dll 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\..openlp-branch\mutool.exe -mediainfo = %(here)s\..openlp-branch\MediaInfo.exe +mutool = %(here)s\..\..\mupdf-1.14.0-windows\mutool.exe +mediainfo = %(here)s\..\..\MediaInfo\MediaInfo.exe [paths] branch = %(projects)s\openlp-branch From fb4a66d47bd8bc3a784f7de9f1da95fa4f0785c2 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 22:41:41 +0100 Subject: [PATCH 25/47] debug print --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 66fdd79..37f5958 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -90,7 +90,7 @@ class Builder(object): Return text from stdout. """ - _print(cmd) + print(cmd) proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) output, error = proc.communicate() code = proc.wait() From 888a61ec2bb71e174dbebbcc5bf9e2be249f2e23 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 23:06:24 +0100 Subject: [PATCH 26/47] try to load paths before exe --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 37f5958..ff8a20e 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -63,10 +63,10 @@ class Builder(object): """ def __init__(self): self.setup_args() + self.setup_paths() self.setup_system_paths() self.read_config() self.setup_executables() - self.setup_paths() self.setup_extra() def _print(self, text, *args): From 6fc4e61f9fead4c7e7d84476f491a4c5cffdd23a Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 15 Feb 2019 23:12:48 +0100 Subject: [PATCH 27/47] try to load config earlier --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index ff8a20e..b0f91e8 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -63,9 +63,9 @@ class Builder(object): """ def __init__(self): self.setup_args() + self.read_config() self.setup_paths() self.setup_system_paths() - self.read_config() self.setup_executables() self.setup_extra() From 3ae58f56df1414a711d4c8605d1ee138aebe09dd Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 16 Feb 2019 21:19:52 +0100 Subject: [PATCH 28/47] reorder initialization --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index b0f91e8..92d52b8 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -62,8 +62,8 @@ class Builder(object): A Generic class to base other operating system specific builders on """ def __init__(self): - self.setup_args() self.read_config() + self.setup_args() self.setup_paths() self.setup_system_paths() self.setup_executables() From 936fa3fc7860276b855a34e14b4ad6eea21a2eb5 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 16 Feb 2019 21:34:36 +0100 Subject: [PATCH 29/47] reorder initialization again --- builders/builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 92d52b8..9e5233f 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -62,10 +62,10 @@ class Builder(object): A Generic class to base other operating system specific builders on """ def __init__(self): - self.read_config() self.setup_args() - self.setup_paths() self.setup_system_paths() + self.read_config() + self.setup_paths() self.setup_executables() self.setup_extra() From 64a22bd80cef96fdf8c245573d05b1526c628555 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 16 Feb 2019 22:01:03 +0100 Subject: [PATCH 30/47] some debug print --- builders/windows-builder.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 9ef30f8..07b9319 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -268,6 +268,8 @@ class WindowsBuilder(Builder): 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._print_verbose(' {:.<20}: {}'.format('site packages: ', self.site_packages)) + self._print_verbose(' {:.<20}: {}'.format('program files: ', self.program_files)) def setup_paths(self): """ From ccc6b44e2cdb44c318ef0dfb3684e1a0c04eec4b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 16 Feb 2019 22:13:16 +0100 Subject: [PATCH 31/47] support program files path on x64 --- builders/windows-builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 07b9319..f9321df 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -267,7 +267,9 @@ class WindowsBuilder(Builder): 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 = os.getenv('PROGRAMFILES(x86)') + if not self.program_files: + self.program_files = os.getenv('PROGRAMFILES') self._print_verbose(' {:.<20}: {}'.format('site packages: ', self.site_packages)) self._print_verbose(' {:.<20}: {}'.format('program files: ', self.program_files)) From b2cb30f31babe025ff70b5c26ef66dca51f5ee6a Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 21:26:29 +0100 Subject: [PATCH 32/47] remove debug print again --- builders/builder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index 9e5233f..3441ddc 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -90,7 +90,6 @@ class Builder(object): Return text from stdout. """ - print(cmd) proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True) output, error = proc.communicate() code = proc.wait() From 80eef6fc5b769ce2334cd53bd62487284955e3f5 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 22:12:05 +0100 Subject: [PATCH 33/47] include font in package --- builders/builder.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/builders/builder.py b/builders/builder.py index 3441ddc..f5e4d57 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -372,6 +372,15 @@ class Builder(object): self._print_verbose('... %s', filename) copy(os.path.join(root, filename), os.path.join(dest_path, filename)) + def copy_font(self): + """ + Copy OpenLP font file + """ + self._print('Copying OpenLP font...') + source = os.path.join(self.source_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') + dest = os.path.join(self.dist_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') + copy(source, dest) + def copy_extra_files(self): """ Copy any extra files which are particular to a platform @@ -468,6 +477,7 @@ class Builder(object): self.copy_default_theme() self.copy_plugins() self.copy_media_player() + self.copy_font() if os.path.exists(self.manual_path): self.run_sphinx() else: From 815ef71a54dad0d6a1a9f31880ed0751f244e9c4 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 22:23:18 +0100 Subject: [PATCH 34/47] create folder before copying font --- builders/builder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index f5e4d57..d2af1ad 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -378,7 +378,9 @@ class Builder(object): """ self._print('Copying OpenLP font...') source = os.path.join(self.source_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') - dest = os.path.join(self.dist_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') + dest_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') + dest = os.path.join(self.dest_dir, 'OpenLP.ttf') + os.makedirs(dest_dir) copy(source, dest) def copy_extra_files(self): From 78a7c9bcda9fd4b24a8018335744ceac7ac4c530 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sun, 17 Feb 2019 22:28:05 +0100 Subject: [PATCH 35/47] fix c/p error --- builders/builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/builder.py b/builders/builder.py index d2af1ad..047ddb8 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -379,7 +379,7 @@ class Builder(object): self._print('Copying OpenLP font...') source = os.path.join(self.source_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') dest_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') - dest = os.path.join(self.dest_dir, 'OpenLP.ttf') + dest = os.path.join(dest_dir, 'OpenLP.ttf') os.makedirs(dest_dir) copy(source, dest) From 2827fdf90bdf01449cade06d1c3f756ddd89d6b8 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 18 Feb 2019 20:48:44 +0100 Subject: [PATCH 36/47] copy font and display files --- builders/builder.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 047ddb8..3201c47 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -372,16 +372,33 @@ class Builder(object): self._print_verbose('... %s', filename) copy(os.path.join(root, filename), os.path.join(dest_path, filename)) - def copy_font(self): + def copy_font_files(self): """ - Copy OpenLP font file + Copy OpenLP font files """ - self._print('Copying OpenLP font...') - source = os.path.join(self.source_path, 'core', 'ui', 'fonts', 'OpenLP.ttf') - dest_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') - dest = os.path.join(dest_dir, 'OpenLP.ttf') - os.makedirs(dest_dir) - copy(source, dest) + self._print('Copying OpenLP fonts files...') + src_dir = os.path.join(self.source_path, 'core', 'display', 'html') + dst_dir = os.path.join(self.dist_path, 'core', 'display', 'html') + 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(dest_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', 'ui', 'fonts') + dst_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') + html_files = ['OpenLP.ttf', 'openlp-charmap.json'] + os.makedirs(dst_dir) + for display_file in os.listdir(src_dir) + src = os.path.join(src_dir, display_file) + dst = os.path.join(dest_dir, display_file) + copy(src, dst) def copy_extra_files(self): """ @@ -479,7 +496,8 @@ class Builder(object): self.copy_default_theme() self.copy_plugins() self.copy_media_player() - self.copy_font() + self.copy_font_files() + self.copy_display_files() if os.path.exists(self.manual_path): self.run_sphinx() else: From fdc1afa8e81adb1ae76ccce88c95f0f517b41e38 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 18 Feb 2019 20:59:28 +0100 Subject: [PATCH 37/47] fix syntax error --- builders/builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 3201c47..3d2c51e 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -381,7 +381,7 @@ class Builder(object): dst_dir = os.path.join(self.dist_path, 'core', 'display', 'html') font_files = ['OpenLP.ttf', 'openlp-charmap.json'] os.makedirs(dst_dir) - for font_file in font_files + for font_file in font_files: src = os.path.join(src_dir, font_file) dst = os.path.join(dest_dir, font_file) copy(src, dst) @@ -395,7 +395,7 @@ class Builder(object): dst_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') html_files = ['OpenLP.ttf', 'openlp-charmap.json'] os.makedirs(dst_dir) - for display_file in os.listdir(src_dir) + for display_file in os.listdir(src_dir): src = os.path.join(src_dir, display_file) dst = os.path.join(dest_dir, display_file) copy(src, dst) From 03c3ea43191864ba02b4d4590f0f727f93e83e98 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 18 Feb 2019 21:04:40 +0100 Subject: [PATCH 38/47] fix typo --- builders/builder.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 3d2c51e..4edfbef 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -383,7 +383,7 @@ class Builder(object): os.makedirs(dst_dir) for font_file in font_files: src = os.path.join(src_dir, font_file) - dst = os.path.join(dest_dir, font_file) + dst = os.path.join(dst_dir, font_file) copy(src, dst) def copy_display_files(self): @@ -397,7 +397,7 @@ class Builder(object): os.makedirs(dst_dir) for display_file in os.listdir(src_dir): src = os.path.join(src_dir, display_file) - dst = os.path.join(dest_dir, display_file) + dst = os.path.join(dst_dir, display_file) copy(src, dst) def copy_extra_files(self): From b049edfb4885e82b7fe4946ea0c5d72e021aabba Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 18 Feb 2019 21:10:59 +0100 Subject: [PATCH 39/47] fix c/p error --- builders/builder.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builders/builder.py b/builders/builder.py index 4edfbef..0139c4b 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -377,8 +377,8 @@ class Builder(object): Copy OpenLP font files """ self._print('Copying OpenLP fonts files...') - src_dir = os.path.join(self.source_path, 'core', 'display', 'html') - dst_dir = os.path.join(self.dist_path, 'core', 'display', 'html') + 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: @@ -391,9 +391,8 @@ class Builder(object): Copy OpenLP display HTML files """ self._print('Copying OpenLP HTML display files...') - src_dir = os.path.join(self.source_path, 'core', 'ui', 'fonts') - dst_dir = os.path.join(self.dist_path, 'core', 'ui', 'fonts') - html_files = ['OpenLP.ttf', 'openlp-charmap.json'] + 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) From f95a43be24cd9ba2310c7ee7d9a82f08c0a11e06 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Tue, 5 Mar 2019 20:55:59 +0100 Subject: [PATCH 40/47] Make the windows builder more bit-aware --- builders/windows-builder.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index f9321df..054a2c6 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -110,6 +110,7 @@ Portable App Builds import os import glob +import sys from distutils import dir_util from shutil import copy, move, rmtree @@ -267,6 +268,8 @@ class WindowsBuilder(Builder): super().setup_system_paths() self.python_root = os.path.dirname(self.python) self.site_packages = os.path.join(self.python_root, 'Lib', 'site-packages') + # Default program_files to 'Program Files (x86)' - the folder for 32-bit programs on 64-bit systems, if that + # does not exists the host system is 32-bit so fallback to 'Program Files'. self.program_files = os.getenv('PROGRAMFILES(x86)') if not self.program_files: self.program_files = os.getenv('PROGRAMFILES') @@ -331,8 +334,11 @@ class WindowsBuilder(Builder): Return a list of any extra parameters we wish to use """ parameters = [] + # Detect python instance bit size + arch = 'x86' if sys.maxsize == 0x7fffffff else 'x64' + dll_path = '{pf}\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{arch}\\*.dll'.format(pf=self.program_files, arch=arch) # Finds the UCRT DDLs available from the Windows 10 SDK - for binary in glob.glob('C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x64\\*.dll'): + for binary in glob.glob(dll_path): parameters.append('--add-binary') parameters.append(binary + ";.") return parameters From 39a14d029daef147860bb51ed247007258bed24b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 8 Mar 2019 22:20:20 +0100 Subject: [PATCH 41/47] Fix copying Qt translations and add x86 or x64 to the bundled files. --- builders/windows-builder.py | 16 ++++++++++++---- windows/OpenLP.iss.default | 3 ++- windows/appinfo.ini.default | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 054a2c6..fbc658c 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -134,6 +134,7 @@ class WindowsBuilder(Builder): content = input_file.read() content = content.replace('%(branch)s', self.branch_path) content = content.replace('%(display_version)s', self.version.replace('-bzr', '.')) + content = content.replace('%(arch)s', self.arch) output_file.write(content) def _run_innosetup(self): @@ -176,6 +177,7 @@ class WindowsBuilder(Builder): 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): @@ -252,7 +254,7 @@ class WindowsBuilder(Builder): """ Return the path to Qt translation files on macOS """ - return os.path.join(self.site_packages, 'PyQt5', 'translations') + return os.path.join(self.site_packages, 'PyQt5', 'Qt', 'translations') def add_extra_args(self, parser): """ @@ -285,6 +287,13 @@ class WindowsBuilder(Builder): 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. @@ -334,9 +343,8 @@ class WindowsBuilder(Builder): Return a list of any extra parameters we wish to use """ parameters = [] - # Detect python instance bit size - arch = 'x86' if sys.maxsize == 0x7fffffff else 'x64' - dll_path = '{pf}\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{arch}\\*.dll'.format(pf=self.program_files, arch=arch) + dll_path = '{pf}\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\{arch}\\*.dll'.format(pf=self.program_files, + arch=self.arch) # Finds the UCRT DDLs available from the Windows 10 SDK for binary in glob.glob(dll_path): parameters.append('--add-binary') diff --git a/windows/OpenLP.iss.default b/windows/OpenLP.iss.default index b8b6af9..688fc34 100644 --- a/windows/OpenLP.iss.default +++ b/windows/OpenLP.iss.default @@ -7,6 +7,7 @@ #define AppPublisher "OpenLP Developers" #define AppURL "http://openlp.org/" #define AppExeName "OpenLP.exe" +#define Arch "%(arch)" #define FileHandle FileOpen("%(branch)s\dist\OpenLP\.version") #define FileLine FileRead(FileHandle) @@ -30,7 +31,7 @@ DefaultGroupName={#AppName} AllowNoIcons=true LicenseFile=LICENSE.txt OutputDir=%(branch)s\dist\ -OutputBaseFilename=OpenLP-{#RealVersion}-setup +OutputBaseFilename=OpenLP-{#RealVersion}-{#Arch}-setup Compression=lzma/Max SolidCompression=true SetupIconFile=OpenLP.ico diff --git a/windows/appinfo.ini.default b/windows/appinfo.ini.default index 8b4c920..8bb12c3 100644 --- a/windows/appinfo.ini.default +++ b/windows/appinfo.ini.default @@ -18,8 +18,8 @@ Freeware=true CommercialUse=true [Version] -DisplayVersion=%(display_version)s -PackageVersion=%(package_version)s +DisplayVersion=%(display_version)s-%(arch)s +PackageVersion=%(package_version)s-%(arch)s [Control] Icons=1 From 03971e7e22d29bf5341f32428de4e0a5e9572f86 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 10 Mar 2019 09:33:37 -0700 Subject: [PATCH 42/47] Fix macOS builder to set up `mutool_lib` in `setup_extra` rather than overriding `setup_paths`, which was causing issues. --- builders/macosx-builder.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/builders/macosx-builder.py b/builders/macosx-builder.py index 01afda8..a175814 100644 --- a/builders/macosx-builder.py +++ b/builders/macosx-builder.py @@ -359,11 +359,10 @@ class MacOSXBuilder(Builder): qt_library_path = QCoreApplication.libraryPaths()[0] return os.path.join(os.path.dirname(qt_library_path), 'translations') - def setup_paths(self): + def setup_extra(self): """ Extra setup to run """ - super().setup_paths() if hasattr(self, 'mutool_exe'): self.mutool_lib = os.path.abspath( os.path.join(os.path.dirname(self.mutool_exe), '..', 'lib', 'libjbig2dec.0.dylib')) From d583f9a3cb65fdfcea95887211180c82ac396c60 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 11 Mar 2019 14:11:56 +0100 Subject: [PATCH 43/47] Try to fix portable apps version. Also added oszl as file type. --- windows/OpenLP.iss.default | 1 + windows/appinfo.ini.default | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/windows/OpenLP.iss.default b/windows/OpenLP.iss.default index 688fc34..fe5ac87 100644 --- a/windows/OpenLP.iss.default +++ b/windows/OpenLP.iss.default @@ -87,6 +87,7 @@ Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags [Registry] Root: HKCR; Subkey: .osz; ValueType: string; ValueName: ; ValueData: OpenLP; Flags: uninsdeletevalue +Root: HKCR; Subkey: .oszl; 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""" diff --git a/windows/appinfo.ini.default b/windows/appinfo.ini.default index 8bb12c3..238e6ac 100644 --- a/windows/appinfo.ini.default +++ b/windows/appinfo.ini.default @@ -19,7 +19,7 @@ CommercialUse=true [Version] DisplayVersion=%(display_version)s-%(arch)s -PackageVersion=%(package_version)s-%(arch)s +PackageVersion=%(package_version)s [Control] Icons=1 @@ -27,6 +27,8 @@ Start=OpenLPPortable.exe [Associations] FileType=osz +FileType=oszl [FileTypeIcons] osz=app +oszl=app From 9381311d7de44b40fb4d138a254779e2ed142893 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Mon, 11 Mar 2019 14:46:12 +0100 Subject: [PATCH 44/47] Add a missing s --- windows/OpenLP.iss.default | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/windows/OpenLP.iss.default b/windows/OpenLP.iss.default index fe5ac87..0543626 100644 --- a/windows/OpenLP.iss.default +++ b/windows/OpenLP.iss.default @@ -7,7 +7,7 @@ #define AppPublisher "OpenLP Developers" #define AppURL "http://openlp.org/" #define AppExeName "OpenLP.exe" -#define Arch "%(arch)" +#define Arch "%(arch)s" #define FileHandle FileOpen("%(branch)s\dist\OpenLP\.version") #define FileLine FileRead(FileHandle) From 933325e9d1269a82ce06a74974476671dd35db59 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 13 Mar 2019 21:21:15 +0100 Subject: [PATCH 45/47] Try to fix appveyor build of portable installer --- builders/windows-builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index fbc658c..7fc4a07 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -216,8 +216,9 @@ class WindowsBuilder(Builder): self._print_verbose('... Building PortableApps Installer') self._run_command([self.portableinstaller_exe, self.portable_dest_path], 'Error running PortableApps Installer') - portable_exe_name = 'OpenLPPortable_%s.paf.exe' % self.portable_version + 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(self._run_command(['dir', os.path.abspath(os.path.join(self.portable_dest_path, '..'))])) 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)) From 293571a69a8f98f211d8334b239e3969fee724ae Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 13 Mar 2019 21:39:11 +0100 Subject: [PATCH 46/47] Add missing param --- builders/windows-builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 7fc4a07..94ebdcc 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -218,12 +218,12 @@ class WindowsBuilder(Builder): '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(self._run_command(['dir', os.path.abspath(os.path.join(self.portable_dest_path, '..'))])) 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: + self._print(self._run_command(['dir', os.path.abspath(os.path.join(self.portable_dest_path, '..'))], 'Could not dir')) raise Exception('PortableApp failed to build') def get_platform(self): From 215fbc23ccfe305142e2d2aee40b2a8e67eeeb1b Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Wed, 13 Mar 2019 22:00:05 +0100 Subject: [PATCH 47/47] remove debug print --- builders/windows-builder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 94ebdcc..4defe06 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -223,7 +223,6 @@ class WindowsBuilder(Builder): move(portable_exe_path, os.path.join(self.dist_path, '..', portable_exe_name)) self._print('PortableApp build complete') else: - self._print(self._run_command(['dir', os.path.abspath(os.path.join(self.portable_dest_path, '..'))], 'Could not dir')) raise Exception('PortableApp failed to build') def get_platform(self):