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

This commit is contained in:
Raoul Snyman 2019-05-15 15:39:12 -07:00
parent cccbb6d246
commit e88f99966e
1 changed files with 14 additions and 11 deletions

View File

@ -357,10 +357,6 @@ 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._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')
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('C:\\', 'Program Files', 'VideoLAN', 'VLC')
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))