diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..aa079ec --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +max-line-length=120 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8319c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.pyc +config.ini diff --git a/builders/builder.py b/builders/builder.py index e36101b..596de87 100644 --- a/builders/builder.py +++ b/builders/builder.py @@ -149,6 +149,8 @@ class Builder(object): 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('-x', '--export', dest='can_export', action='store_true', default=False, + help='Export when building a release. Defaults to false, ignored for non-release builds') 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, @@ -214,9 +216,11 @@ class Builder(object): 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 + if self.args.release and self.args.can_export: + self.work_path = os.path.abspath(os.path.join(self.branch_path, '..', 'OpenLP-' + self.version)) + else: self.work_path = self.branch_path self.openlp_script = os.path.abspath(os.path.join(self.work_path, 'openlp', '__main__.py')) self.source_path = os.path.join(self.work_path, 'openlp') @@ -492,7 +496,7 @@ class Builder(object): self._print_verbose('') if not self.args.skip_update: self.update_code() - if self.args.release: + if self.args.release and self.args.can_export: self.export_release() self.run_pyinstaller() self.write_version_file() diff --git a/builders/macosx-builder.py b/builders/macosx-builder.py index e48ef69..77a7c0f 100644 --- a/builders/macosx-builder.py +++ b/builders/macosx-builder.py @@ -135,7 +135,7 @@ class MacOSXBuilder(Builder): folder.symlink_to(good_path) - def _fix_qt_dll(self, dll): + def _fix_qt_dll(self, dll_file): """ Fix the DLL lookup paths to use relative ones for Qt dependencies. Inspiration: PyInstaller/depend/dylib.py:mac_set_relative_dylib_deps() @@ -158,15 +158,19 @@ class MacOSXBuilder(Builder): return None return f'@loader_path{good_path}/{basename}' + # Skip it if it's not a dylib file + if dll_file.suffix != '.dylib': + return + # Resources/PyQt5/Qt/qml/QtQuick/Controls.2/Fusion - root = str(dll.parent).partition('Contents')[2][1:] + root = str(dll_file.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 = MachO(dll_file) dll.rewriteLoadCommands(match_func) with open(dll.filename, 'rb+') as f: for header in dll.headers: @@ -183,7 +187,7 @@ class MacOSXBuilder(Builder): if not path.is_dir() or path.is_symlink(): # Skip simlinks as they are allowed (even with a dot) continue - if '.' in path.name: + if path.name == 'qml': yield path else: yield from self._find_problematic_qt_folders(path) @@ -199,6 +203,7 @@ class MacOSXBuilder(Builder): yield from self._move_contents_to_resources(path) else: sibling = Path(str(path).replace('MacOS', 'Resources')) + sibling.parent.mkdir(parents=True, exist_ok=True) move(path, sibling) yield sibling @@ -213,9 +218,9 @@ class MacOSXBuilder(Builder): rmtree(folder) self._create_symlink(folder) - def _relink_mupdf(self, bin_name): + def _relink_binary(self, bin_name): """ - Relink mupdf to bundled libraries + Relink bundled libraries """ self._print('Linking {bin_name} with bundled libraries...'.format(bin_name=bin_name)) libname = os.path.join(self.dist_path, bin_name) @@ -263,13 +268,13 @@ class MacOSXBuilder(Builder): """ Relink mudraw to bundled libraries """ - self._relink_mupdf('mudraw') + self._relink_binary('mudraw') def _relink_mutool(self): """ Relink mudraw to bundled libraries """ - self._relink_mupdf('mutool') + self._relink_binary('mutool') def _install_pyro4(self): """ @@ -296,6 +301,7 @@ class MacOSXBuilder(Builder): for fname in ['libvlc.dylib', 'libvlccore.dylib']: self._print_verbose('... {}'.format(fname)) copy(os.path.join(vlc_path, 'lib', fname), os.path.join(vlc_dest, fname)) + self._relink_binary(os.path.join('vlc', fname)) if os.path.exists(os.path.join(vlc_dest, 'plugins')): rmtree(os.path.join(vlc_dest, 'plugins')) self._print_verbose('... copying VLC plugins') @@ -404,7 +410,8 @@ class MacOSXBuilder(Builder): Copy any extra files which are particular to a platform """ self._print('Copying extra files for macOS...') - self._copy_vlc_files() + # Exclude VLC for now, at least + # self._copy_vlc_files() self._copy_bundle_files() self._copy_macosx_files() diff --git a/osx/settings.py b/osx/settings.py index f584922..379e84e 100644 --- a/osx/settings.py +++ b/osx/settings.py @@ -29,7 +29,7 @@ import os HERE = os.getcwd() format = 'UDBZ' -size = '600M' +size = '850M' files = [defines.get('app', '/Applications/OpenLP.app')] symlinks = { 'Applications': '/Applications' } badge_icon = os.path.join(HERE, 'OpenLP.icns') diff --git a/pyinstaller-hooks/hook-openlp.py b/pyinstaller-hooks/hook-openlp.py index 659d2bc..a932da1 100644 --- a/pyinstaller-hooks/hook-openlp.py +++ b/pyinstaller-hooks/hook-openlp.py @@ -29,5 +29,6 @@ hiddenimports = [ 'openlp.plugins.custom.customplugin', 'openlp.plugins.songusage.songusageplugin', 'openlp.plugins.remotes.remoteplugin', - 'openlp.plugins.alerts.alertsplugin' + 'openlp.plugins.alerts.alertsplugin', + 'openlp.plugins.planningcenter.planningcenterplugin' ] diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 134f83a..6bd4aa5 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -1,7 +1,7 @@ [executables] sphinx = %(pyroot)s\Scripts\sphinx-build.exe pyinstaller = %(pyroot)s\Scripts\pyinstaller.exe -htmlhelp = %(progfiles)s\HTML Help Workshop\hhc.exe +htmlhelp = %(progfilesx86)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