From e88f99966e35074f506324b5452de2117726d27e Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 15 May 2019 15:39:12 -0700 Subject: [PATCH] No need to find 32-bit Program Files because OpenLP is 64-bit; Only copy MuPDF if PyMuPDF is not installed; Use the proper Program Files directory for VLC --- builders/windows-builder.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 565c95d..04fc297 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -357,11 +357,7 @@ 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') + 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)) @@ -398,12 +394,19 @@ class WindowsBuilder(Builder): 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('... 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('C:\\', 'Program Files', 'VideoLAN', 'VLC') + 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))