diff --git a/builders/macosx-builder.py b/builders/macosx-builder.py index f8969a0..ed2dfe4 100644 --- a/builders/macosx-builder.py +++ b/builders/macosx-builder.py @@ -285,26 +285,41 @@ class MacOSXBuilder(Builder): for path in egg_info_glob: rmtree(path, True) + def _copy_vlc_files(self): + """ + Copy the VLC files into the app bundle + """ + vlc_path = '/Applications/VLC.app/Contents/MacOS/' + vlc_dest = os.path.join(self.dist_path, 'vlc') + if not os.path.exists(vlc_dest): + os.makedirs(vlc_dest) + 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)) + if os.path.exists(os.path.join(vlc_dest, 'plugins')): + rmtree(os.path.join(vlc_dest, 'plugins')) + self._print_verbose('... copying VLC plugins') + copytree(os.path.join(vlc_path, 'plugins'), os.path.join(vlc_dest, 'plugins')) + def _copy_bundle_files(self): """ Copy Info.plist and OpenLP.icns to app bundle. """ + self._print_verbose('... OpenLP.icns') 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') - text = fr.read() - text = text % {'openlp_version': self.version} - fw.write(text) - fr.close() - fw.close() + self._print_verbose('... Info.plist') + # Add OpenLP version to Info.plist and add it to app bundle. + with open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info_path)), 'w') as fw, \ + open(self.bundle_info_path, 'r') as fr: + text = fr.read() + text = text % {'openlp_version': self.version} + fw.write(text) def _copy_macosx_files(self): """ Copy all the OSX-specific files. """ - self._print('Copying extra files for Mac OS X...') self._print_verbose('... LICENSE.txt') copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt')) self._print_verbose('... mudraw') @@ -388,6 +403,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() self._copy_bundle_files() self._copy_macosx_files() diff --git a/builders/windows-builder.py b/builders/windows-builder.py index a1c5b7f..5d2b482 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -100,7 +100,7 @@ import glob import sys from distutils import dir_util from hashlib import md5 -from shutil import copy, move, rmtree +from shutil import copy, copytree, move, rmtree from lxml.etree import fromstring, parse, tostring from lxml.builder import E, ElementMaker @@ -410,9 +410,16 @@ class WindowsBuilder(Builder): else: self._print('... WARNING: mutool.exe not found') vlc_path = os.path.join(self.program_files, 'VideoLAN', 'VLC') + vlc_dest = os.path.join(self.dist_path, 'vlc') + if not os.path.exists(vlc_dest): + os.makedirs(vlc_dest) 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)) + copy(os.path.join(vlc_path, fname), os.path.join(vlc_dest, fname)) + if os.path.exists(os.path.join(vlc_dest, 'plugins')): + rmtree(os.path.join(vlc_dest, 'plugins')) + self._print_verbose('... copying VLC plugins') + copytree(os.path.join(vlc_path, 'plugins'), os.path.join(vlc_dest, 'plugins')) def after_run_sphinx(self): """