1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00

Update the packaging scripts to work on windows (and appveyor) with the new webengine bacnkend.

bzr-revno: 41
This commit is contained in:
Tomas Groth 2019-03-07 20:28:24 +01:00
commit b32cc6d693
4 changed files with 67 additions and 30 deletions

View File

@ -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):
@ -264,6 +264,12 @@ class Builder(object):
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.
@ -280,6 +286,7 @@ class Builder(object):
'--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')
@ -365,6 +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_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
@ -461,6 +495,8 @@ class Builder(object):
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:

View File

@ -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.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 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.
@ -59,10 +57,6 @@ OpenLP
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.
@ -115,6 +109,8 @@ Portable App Builds
"""
import os
import glob
import sys
from distutils import dir_util
from shutil import copy, move, rmtree
@ -126,17 +122,6 @@ class WindowsBuilder(Builder):
The :class:`WindowsBuilder` class encapsulates everything that is needed
to build a Windows installer.
"""
def _build_pptviewlib(self):
"""
Build the PowerPoint Viewer DLL using Visual Studio.
"""
self._print('Building PPTVIEWLIB.DLL...')
if not os.path.exists(self.vcbuild_exe):
self._print('... WARNING: vcbuild.exe was not found, skipping building pptviewlib.dll')
return
self._run_command([self.vcbuild_exe, '/rebuild', os.path.join(self.pptviewlib_path, 'pptviewlib.vcproj'),
'Release|Win32'], 'Error building pptviewlib.dll')
copy(os.path.join(self.pptviewlib_path, 'Release', 'pptviewlib.dll'), self.pptviewlib_path)
def _create_innosetup_file(self):
"""
@ -283,7 +268,13 @@ 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')
# 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')
self._print_verbose(' {:.<20}: {}'.format('site packages: ', self.site_packages))
self._print_verbose(' {:.<20}: {}'.format('program files: ', self.program_files))
def setup_paths(self):
"""
@ -293,7 +284,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):
"""
@ -334,12 +324,25 @@ class WindowsBuilder(Builder):
"""
Build the installer
"""
self._build_pptviewlib()
self._create_innosetup_file()
self._run_innosetup()
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 = []
# 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(dll_path):
parameters.append('--add-binary')
parameters.append(binary + ";.")
return parameters
if __name__ == '__main__':
WindowsBuilder().main()

View File

@ -1,18 +1,17 @@
[executables]
innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe
sphinx = %(pyroot)s\Scripts\sphinx-build.exe
pyinstaller = %(here)s\..\..\PyInstaller-3.2\pyinstaller.py
vcbuild = %(progfiles)s\Microsoft Visual Studio 9.0\VC\vcpackages\vcbuild.exe
pyinstaller = %(pyroot)s\Scripts\pyinstaller-script.py
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.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.9a-windows\mutool.exe
mutool = %(here)s\..\..\mupdf-1.14.0-windows\mutool.exe
mediainfo = %(here)s\..\..\MediaInfo\MediaInfo.exe
[paths]
branch = %(projects)s\trunk
branch = %(projects)s\openlp-branch
documentation = %(projects)s\documentation
icon = %(here)s\OpenLP.ico
hooks = %(here)s\..\pyinstaller-hooks

View File

@ -2,7 +2,6 @@
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