Update Windows and macOS builders to copy VLC plugins

This commit is contained in:
Raoul Snyman 2019-07-03 23:23:21 -07:00
parent 2f90f0ea4a
commit bd2abb355b
2 changed files with 35 additions and 11 deletions

View File

@ -285,26 +285,41 @@ class MacOSXBuilder(Builder):
for path in egg_info_glob: for path in egg_info_glob:
rmtree(path, True) 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, 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'), vlc_dest)
def _copy_bundle_files(self): def _copy_bundle_files(self):
""" """
Copy Info.plist and OpenLP.icns to app bundle. 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', copy(self.icon_path, os.path.join(self.dist_app_path, 'Contents', 'Resources',
os.path.basename(self.icon_path))) os.path.basename(self.icon_path)))
# Add OpenLP version to Info.plist and put it to app bundle. self._print_verbose('... Info.plist')
fr = open(self.bundle_info_path, 'r') # Add OpenLP version to Info.plist and add it to app bundle.
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info_path)), 'w') with open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info_path)), 'w') as fw, \
text = fr.read() open(self.bundle_info_path, 'r') as fr:
text = text % {'openlp_version': self.version} text = fr.read()
fw.write(text) text = text % {'openlp_version': self.version}
fr.close() fw.write(text)
fw.close()
def _copy_macosx_files(self): def _copy_macosx_files(self):
""" """
Copy all the OSX-specific files. Copy all the OSX-specific files.
""" """
self._print('Copying extra files for Mac OS X...')
self._print_verbose('... LICENSE.txt') self._print_verbose('... LICENSE.txt')
copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt')) copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt'))
self._print_verbose('... mudraw') self._print_verbose('... mudraw')
@ -388,6 +403,8 @@ class MacOSXBuilder(Builder):
""" """
Copy any extra files which are particular to a platform 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_bundle_files()
self._copy_macosx_files() self._copy_macosx_files()

View File

@ -100,7 +100,7 @@ import glob
import sys import sys
from distutils import dir_util from distutils import dir_util
from hashlib import md5 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.etree import fromstring, parse, tostring
from lxml.builder import E, ElementMaker from lxml.builder import E, ElementMaker
@ -410,9 +410,16 @@ class WindowsBuilder(Builder):
else: else:
self._print('... WARNING: mutool.exe not found') self._print('... WARNING: mutool.exe not found')
vlc_path = os.path.join(self.program_files, 'VideoLAN', 'VLC') 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']: for fname in ['libvlc.dll', 'libvlccore.dll']:
self._print_verbose('... {}'.format(fname)) 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'), vlc_dest)
def after_run_sphinx(self): def after_run_sphinx(self):
""" """