mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 21:12:50 +00:00
Fix python3 issues and include the default theme json file
This commit is contained in:
parent
b66db894fd
commit
c0cbc8a014
@ -118,7 +118,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from shutil import copy, rmtree
|
from shutil import copy, rmtree
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
from configparser import SafeConfigParser as ConfigParser
|
from configparser import ConfigParser
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ class MacosxBuilder(object):
|
|||||||
# Get the output in plist format.
|
# Get the output in plist format.
|
||||||
paths = []
|
paths = []
|
||||||
output = self._run_command([self.hdiutil, 'info', '-plist'], 'Detecting mount points failed.')
|
output = self._run_command([self.hdiutil, 'info', '-plist'], 'Detecting mount points failed.')
|
||||||
pl = plistlib.readPlistFromString(output)
|
pl = plistlib.readPlistFromBytes(output)
|
||||||
for image in pl['images']:
|
for image in pl['images']:
|
||||||
for se in image['system-entities']:
|
for se in image['system-entities']:
|
||||||
if se.get('mount-point'):
|
if se.get('mount-point'):
|
||||||
@ -322,8 +322,8 @@ class MacosxBuilder(object):
|
|||||||
'--additional-hooks-dir', self.hooks_path,
|
'--additional-hooks-dir', self.hooks_path,
|
||||||
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
|
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
|
||||||
'--log-level=ERROR',
|
'--log-level=ERROR',
|
||||||
'-o', self.branch_path,
|
# '--distpath', self.branch_path,
|
||||||
#u'-i', self.mac_icon,
|
# '-i', self.mac_icon,
|
||||||
'-p', self.branch_path,
|
'-p', self.branch_path,
|
||||||
'-n', 'OpenLP',
|
'-n', 'OpenLP',
|
||||||
self.openlp_script),
|
self.openlp_script),
|
||||||
@ -350,24 +350,39 @@ class MacosxBuilder(object):
|
|||||||
tag = '0.0.0'
|
tag = '0.0.0'
|
||||||
revision = '0'
|
revision = '0'
|
||||||
else:
|
else:
|
||||||
tag, revision = lines[-1].split()
|
tag, revision = lines[-1].decode('utf-8').split()
|
||||||
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
|
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
|
||||||
output, error = bzr.communicate()
|
output, error = bzr.communicate()
|
||||||
code = bzr.wait()
|
code = bzr.wait()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
raise Exception('Error running bzr log')
|
raise Exception('Error running bzr log')
|
||||||
output_ascii = str(output, errors='ignore')
|
latest = output.decode('utf-8').split(':')[0]
|
||||||
latest = output_ascii.split(':')[0]
|
|
||||||
self.version_string = '%s-bzr%s' % (tag, latest)
|
self.version_string = '%s-bzr%s' % (tag, latest)
|
||||||
self.version_tag = tag
|
self.version_tag = tag
|
||||||
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
|
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
|
||||||
# Release version does not contain revision in .dmg name.
|
# Release version does not contain revision in .dmg name.
|
||||||
if self.args.devel:
|
if self.args.devel:
|
||||||
version_file.write(self.version_string)
|
version_file.write(str(self.version_string))
|
||||||
else:
|
else:
|
||||||
version_file.write(self.version_tag)
|
version_file.write(str(self.version_tag))
|
||||||
version_file.close()
|
version_file.close()
|
||||||
|
|
||||||
|
def copy_default_theme(self):
|
||||||
|
"""
|
||||||
|
Copy the default theme to the correct directory for OpenLP.
|
||||||
|
"""
|
||||||
|
self._print('Copying default theme...')
|
||||||
|
source = os.path.join(self.source_path, 'core', 'lib', 'json')
|
||||||
|
dest = os.path.join(self.dist_path, 'core', 'lib', 'json')
|
||||||
|
for root, dirs, files in os.walk(source):
|
||||||
|
for filename in files:
|
||||||
|
if filename.endswith('.json'):
|
||||||
|
dest_path = os.path.join(dest, root[len(source) + 1:])
|
||||||
|
if not os.path.exists(dest_path):
|
||||||
|
os.makedirs(dest_path)
|
||||||
|
self._print_verbose('... %s', filename)
|
||||||
|
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
|
||||||
|
|
||||||
def copy_plugins(self):
|
def copy_plugins(self):
|
||||||
"""
|
"""
|
||||||
Copy all the plugins to the correct directory so that OpenLP sees that
|
Copy all the plugins to the correct directory so that OpenLP sees that
|
||||||
@ -498,9 +513,9 @@ class MacosxBuilder(object):
|
|||||||
|
|
||||||
# Release version does not contain revision in .dmg name.
|
# Release version does not contain revision in .dmg name.
|
||||||
if self.args.devel:
|
if self.args.devel:
|
||||||
dmg_name = 'OpenLP-' + self.version_string + '.dmg'
|
dmg_name = 'OpenLP-' + str(self.version_string) + '.dmg'
|
||||||
else:
|
else:
|
||||||
dmg_name = 'OpenLP-' + self.version_tag + '.dmg'
|
dmg_name = 'OpenLP-' + str(self.version_tag) + '.dmg'
|
||||||
|
|
||||||
dmg_file = os.path.join(self.branch_path, 'build', dmg_name)
|
dmg_file = os.path.join(self.branch_path, 'build', dmg_name)
|
||||||
# Remove dmg if it exists.
|
# Remove dmg if it exists.
|
||||||
@ -555,7 +570,7 @@ class MacosxBuilder(object):
|
|||||||
|
|
||||||
self.adjust_dmg_view(os.path.basename(dmg_volume_path))
|
self.adjust_dmg_view(os.path.basename(dmg_volume_path))
|
||||||
|
|
||||||
## Unmount dmg file.
|
# Unmount dmg file.
|
||||||
self._print('... unmounting the dmg.')
|
self._print('... unmounting the dmg.')
|
||||||
# Sometimes it could happen that OSX Finder is blocking umount.
|
# Sometimes it could happen that OSX Finder is blocking umount.
|
||||||
# We need to find this process and kill it.
|
# We need to find this process and kill it.
|
||||||
@ -600,7 +615,7 @@ class MacosxBuilder(object):
|
|||||||
# TODO: Use only one applescript file. Remove one for osx 10.5.
|
# TODO: Use only one applescript file. Remove one for osx 10.5.
|
||||||
f = open(os.path.join(self.script_path, 'applescript-adjust-dmg-view.master'))
|
f = open(os.path.join(self.script_path, 'applescript-adjust-dmg-view.master'))
|
||||||
p = Popen([self.osascript], stdin=PIPE)
|
p = Popen([self.osascript], stdin=PIPE)
|
||||||
p.communicate(f.read() % (dmg_volume_name, 'OpenLP'))
|
p.communicate(bytes(f.read() % (dmg_volume_name, 'OpenLP'), 'utf-8'))
|
||||||
f.close()
|
f.close()
|
||||||
result = p.returncode
|
result = p.returncode
|
||||||
if (result != 0):
|
if (result != 0):
|
||||||
@ -627,6 +642,7 @@ class MacosxBuilder(object):
|
|||||||
self.run_pyinstaller()
|
self.run_pyinstaller()
|
||||||
self.write_version_file()
|
self.write_version_file()
|
||||||
self.copy_mac_bundle_files()
|
self.copy_mac_bundle_files()
|
||||||
|
self.copy_default_theme()
|
||||||
self.copy_plugins()
|
self.copy_plugins()
|
||||||
self.copy_media_player()
|
self.copy_media_player()
|
||||||
# TODO creating help on Mac
|
# TODO creating help on Mac
|
||||||
|
@ -129,7 +129,7 @@ import sys
|
|||||||
from shutil import copy, rmtree, move
|
from shutil import copy, rmtree, move
|
||||||
from distutils import dir_util
|
from distutils import dir_util
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
from configparser import SafeConfigParser as ConfigParser
|
from configparser import ConfigParser
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
|
||||||
@ -253,11 +253,9 @@ class WindowsBuilder(object):
|
|||||||
self.args.portable = self.portable_path
|
self.args.portable = self.portable_path
|
||||||
else:
|
else:
|
||||||
self.portable_path = ''
|
self.portable_path = ''
|
||||||
self.openlp_script = os.path.abspath(
|
self.openlp_script = os.path.abspath(os.path.join(branch_path, 'openlp.py'))
|
||||||
os.path.join(branch_path, 'openlp.py'))
|
|
||||||
self.hooks_path = os.path.abspath(self.config.get('paths', 'hooks'))
|
self.hooks_path = os.path.abspath(self.config.get('paths', 'hooks'))
|
||||||
self.win32_icon = os.path.abspath(
|
self.win32_icon = os.path.abspath(self.config.get('paths', 'win32icon'))
|
||||||
self.config.get('paths', 'win32icon'))
|
|
||||||
self.i18n_utils = os.path.join(self.branch_path, 'scripts', 'translation_utils.py')
|
self.i18n_utils = os.path.join(self.branch_path, 'scripts', 'translation_utils.py')
|
||||||
self.source_path = os.path.join(self.branch_path, 'openlp')
|
self.source_path = os.path.join(self.branch_path, 'openlp')
|
||||||
self.manual_path = os.path.join(self.docs_path, 'manual')
|
self.manual_path = os.path.join(self.docs_path, 'manual')
|
||||||
@ -302,7 +300,7 @@ class WindowsBuilder(object):
|
|||||||
'--additional-hooks-dir', self.hooks_path,
|
'--additional-hooks-dir', self.hooks_path,
|
||||||
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
|
'--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
|
||||||
'--log-level=ERROR',
|
'--log-level=ERROR',
|
||||||
'-o', self.branch_path,
|
'--distpath', self.branch_path,
|
||||||
'-i', self.win32_icon,
|
'-i', self.win32_icon,
|
||||||
'-p', self.branch_path,
|
'-p', self.branch_path,
|
||||||
'-n', 'OpenLP',
|
'-n', 'OpenLP',
|
||||||
@ -330,21 +328,36 @@ class WindowsBuilder(object):
|
|||||||
tag = '0.0.0'
|
tag = '0.0.0'
|
||||||
revision = '0'
|
revision = '0'
|
||||||
else:
|
else:
|
||||||
tag, revision = lines[-1].split()
|
tag, revision = lines[-1].decode('utf-8').split()
|
||||||
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
|
bzr = Popen(('bzr', 'log', '--line', '-r', '-1'), stdout=PIPE)
|
||||||
output, error = bzr.communicate()
|
output, error = bzr.communicate()
|
||||||
code = bzr.wait()
|
code = bzr.wait()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
raise Exception('Error running bzr log')
|
raise Exception('Error running bzr log')
|
||||||
output_ascii = str(output, errors='ignore')
|
latest = output.decode('utf-8').split(':')[0]
|
||||||
latest = output_ascii.split(':')[0]
|
|
||||||
version_string = latest == revision and tag or '%s-bzr%s' % (tag, latest)
|
version_string = latest == revision and tag or '%s-bzr%s' % (tag, latest)
|
||||||
# Save decimal version in case we need to do a portable build.
|
# Save decimal version in case we need to do a portable build.
|
||||||
self.version = latest == revision and tag or '%s.%s' % (tag, latest)
|
self.version = latest == revision and tag or '%s.%s' % (tag, latest)
|
||||||
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
|
version_file = open(os.path.join(self.dist_path, '.version'), 'w')
|
||||||
version_file.write(version_string)
|
version_file.write(str(version_string))
|
||||||
version_file.close()
|
version_file.close()
|
||||||
|
|
||||||
|
def copy_default_theme(self):
|
||||||
|
"""
|
||||||
|
Copy the default theme to the correct directory for OpenLP.
|
||||||
|
"""
|
||||||
|
self._print('Copying default theme...')
|
||||||
|
source = os.path.join(self.source_path, 'core', 'lib', 'json')
|
||||||
|
dest = os.path.join(self.dist_path, 'core', 'lib', 'json')
|
||||||
|
for root, dirs, files in os.walk(source):
|
||||||
|
for filename in files:
|
||||||
|
if filename.endswith('.json'):
|
||||||
|
dest_path = os.path.join(dest, root[len(source) + 1:])
|
||||||
|
if not os.path.exists(dest_path):
|
||||||
|
os.makedirs(dest_path)
|
||||||
|
self._print_verbose('... %s', filename)
|
||||||
|
copy(os.path.join(root, filename), os.path.join(dest_path, filename))
|
||||||
|
|
||||||
def copy_plugins(self):
|
def copy_plugins(self):
|
||||||
"""
|
"""
|
||||||
Copy all the plugins to the correct directory so that OpenLP sees that
|
Copy all the plugins to the correct directory so that OpenLP sees that
|
||||||
@ -555,7 +568,8 @@ class WindowsBuilder(object):
|
|||||||
code = portableapps.wait()
|
code = portableapps.wait()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
raise Exception('Error running PortableApps Installer')
|
raise Exception('Error running PortableApps Installer')
|
||||||
portable_app = os.path.abspath(os.path.join(self.portable_path, '..', 'OpenLPPortable_%s.paf.exe' % self.version))
|
portable_app = os.path.abspath(os.path.join(self.portable_path, '..',
|
||||||
|
'OpenLPPortable_%s.paf.exe' % self.version))
|
||||||
if os.path.exists(portable_app):
|
if os.path.exists(portable_app):
|
||||||
move(portable_app, os.path.abspath(os.path.join(self.dist_path, '..')))
|
move(portable_app, os.path.abspath(os.path.join(self.dist_path, '..')))
|
||||||
self._print(' PortableApp build complete')
|
self._print(' PortableApp build complete')
|
||||||
@ -599,6 +613,7 @@ class WindowsBuilder(object):
|
|||||||
self.build_pptviewlib()
|
self.build_pptviewlib()
|
||||||
self.run_pyinstaller()
|
self.run_pyinstaller()
|
||||||
self.write_version_file()
|
self.write_version_file()
|
||||||
|
self.copy_default_theme()
|
||||||
self.copy_plugins()
|
self.copy_plugins()
|
||||||
self.copy_media_player()
|
self.copy_media_player()
|
||||||
if os.path.exists(self.manual_path):
|
if os.path.exists(self.manual_path):
|
||||||
|
Loading…
Reference in New Issue
Block a user