mirror of
https://gitlab.com/openlp/packaging.git
synced 2024-12-22 21:12:50 +00:00
Show PyInstaller DEBUG output when run with verbose option.
Use debug bootloader when building devel version. Add ssl hook and runtime hook to include certificates for Mac OS X(OS X). Fix release app version(OS X). Fix converting bytes to megabytes(OS X). Fix argument to cp command(OS X).
This commit is contained in:
parent
38550840d8
commit
3bd987ffcf
@ -322,20 +322,25 @@ class MacosxBuilder(object):
|
|||||||
"""
|
"""
|
||||||
self._print('Running PyInstaller...')
|
self._print('Running PyInstaller...')
|
||||||
os.chdir(self.work_path)
|
os.chdir(self.work_path)
|
||||||
pyinstaller = Popen((self.python,
|
cmd = [self.python,
|
||||||
self.pyinstaller,
|
self.pyinstaller,
|
||||||
|
'--clean',
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
'--windowed',
|
'--windowed',
|
||||||
'--noupx',
|
'--noupx',
|
||||||
'--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',
|
'-i', self.mac_icon,
|
||||||
# '--distpath', self.branch_path,
|
|
||||||
# '-i', self.mac_icon,
|
|
||||||
'-p', self.work_path,
|
'-p', self.work_path,
|
||||||
'-n', 'OpenLP',
|
'-n', 'OpenLP',
|
||||||
self.openlp_script),
|
self.openlp_script]
|
||||||
stdout=PIPE)
|
if not self.args.verbose:
|
||||||
|
cmd.append('--log-level=ERROR')
|
||||||
|
else:
|
||||||
|
cmd.append('--log-level=DEBUG')
|
||||||
|
if self.args.devel:
|
||||||
|
cmd.append('-d')
|
||||||
|
pyinstaller = Popen(cmd, stdout=PIPE)
|
||||||
output = pyinstaller.communicate()[0]
|
output = pyinstaller.communicate()[0]
|
||||||
code = pyinstaller.wait()
|
code = pyinstaller.wait()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
@ -433,7 +438,10 @@ class MacosxBuilder(object):
|
|||||||
fr = open(self.bundle_info, 'r')
|
fr = open(self.bundle_info, 'r')
|
||||||
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w')
|
fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w')
|
||||||
text = fr.read()
|
text = fr.read()
|
||||||
|
if self.args.devel:
|
||||||
text = text % {'openlp_version': self.version_string}
|
text = text % {'openlp_version': self.version_string}
|
||||||
|
else:
|
||||||
|
text = text % {'openlp_version': self.version_tag}
|
||||||
fw.write(text)
|
fw.write(text)
|
||||||
fr.close()
|
fr.close()
|
||||||
fw.close()
|
fw.close()
|
||||||
@ -584,7 +592,7 @@ class MacosxBuilder(object):
|
|||||||
os.remove(dmg_file)
|
os.remove(dmg_file)
|
||||||
# Create empty dmg file.
|
# Create empty dmg file.
|
||||||
size = self._get_directory_size(self.dist_app_path) # in bytes.
|
size = self._get_directory_size(self.dist_app_path) # in bytes.
|
||||||
size = size / (1024 * 1024) # Convert to megabytes.
|
size = size / (1000 * 1000) # Convert to megabytes.
|
||||||
size += 10 # Additional space in .dmg for other files.
|
size += 10 # Additional space in .dmg for other files.
|
||||||
self._print('... dmg disk size: %s' % size)
|
self._print('... dmg disk size: %s' % size)
|
||||||
self._run_command([self.hdiutil, 'create', dmg_file, '-ov', '-megabytes', str(size), '-fs', 'HFS+', '-volname',
|
self._run_command([self.hdiutil, 'create', dmg_file, '-ov', '-megabytes', str(size), '-fs', 'HFS+', '-volname',
|
||||||
@ -602,7 +610,7 @@ class MacosxBuilder(object):
|
|||||||
# Copy OpenLP.app and other files to .dmg
|
# Copy OpenLP.app and other files to .dmg
|
||||||
# TODO more reliable way to determine dmg_volume_path
|
# TODO more reliable way to determine dmg_volume_path
|
||||||
self._print('... Copying the app to the dmg: ' + dmg_volume_path)
|
self._print('... Copying the app to the dmg: ' + dmg_volume_path)
|
||||||
self._run_command(['cp', '-r', self.dist_app_path, dmg_volume_path],
|
self._run_command(['cp', '-R', self.dist_app_path, dmg_volume_path],
|
||||||
'Could not copy app bundle, dmg creation failed.')
|
'Could not copy app bundle, dmg creation failed.')
|
||||||
|
|
||||||
# Set icon for dmg file.
|
# Set icon for dmg file.
|
||||||
|
10
pyinstaller-hooks/hook-ssl.py
Normal file
10
pyinstaller-hooks/hook-ssl.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from PyInstaller.compat import is_darwin
|
||||||
|
from PyInstaller.utils.hooks.hookutils import exec_statement
|
||||||
|
|
||||||
|
if is_darwin: # TODO check if this is needed on linux
|
||||||
|
datas = []
|
||||||
|
files = exec_statement("""
|
||||||
|
import ssl
|
||||||
|
print(ssl.get_default_verify_paths().cafile)""").strip().split()
|
||||||
|
for file in files:
|
||||||
|
datas.append((file, 'lib')) # TODO find a way to make sure the bundled cafile is always named 'cert.pem'
|
5
pyinstaller-hooks/rthook_ssl.py
Normal file
5
pyinstaller-hooks/rthook_ssl.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.platform == 'darwin': # TODO check if this is needed on linux
|
||||||
|
os.environ['SSL_CERT_FILE'] = os.path.join(sys._MEIPASS, 'lib', 'cert.pem')
|
@ -289,19 +289,26 @@ class WindowsBuilder(object):
|
|||||||
"""
|
"""
|
||||||
self._print('Running PyInstaller...')
|
self._print('Running PyInstaller...')
|
||||||
os.chdir(self.branch_path)
|
os.chdir(self.branch_path)
|
||||||
pyinstaller = Popen((self.python, self.pyinstaller,
|
cmd = [self.python,
|
||||||
|
self.pyinstaller,
|
||||||
|
'--clean',
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
'--windowed',
|
'--windowed',
|
||||||
'--noupx',
|
'--noupx',
|
||||||
'--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=DEBUG',
|
|
||||||
'--distpath', self.dist_path_pyinst_arg,
|
'--distpath', self.dist_path_pyinst_arg,
|
||||||
'-i', self.win32_icon,
|
'-i', self.win32_icon,
|
||||||
'-p', self.branch_path,
|
'-p', self.branch_path,
|
||||||
'-n', 'OpenLP',
|
'-n', 'OpenLP',
|
||||||
self.openlp_script),
|
self.openlp_script]
|
||||||
stdout=PIPE)
|
if not self.args.verbose:
|
||||||
|
cmd.append('--log-level=ERROR')
|
||||||
|
else:
|
||||||
|
cmd.append('--log-level=DEBUG')
|
||||||
|
if self.args.devel:
|
||||||
|
cmd.append('-d')
|
||||||
|
pyinstaller = Popen(cmd, stdout=PIPE)
|
||||||
output = pyinstaller.communicate()[0]
|
output = pyinstaller.communicate()[0]
|
||||||
code = pyinstaller.wait()
|
code = pyinstaller.wait()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user