← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~springermac/openlp/packaging into lp:openlp/packaging

 

Jonathan Springer has proposed merging lp:~springermac/openlp/packaging into lp:openlp/packaging.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~springermac/openlp/packaging/+merge/268863

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).
-- 
Your team OpenLP Core is requested to review the proposed merge of lp:~springermac/openlp/packaging into lp:openlp/packaging.
=== modified file 'osx/macosx-builder.py'
--- osx/macosx-builder.py	2015-06-16 20:07:34 +0000
+++ osx/macosx-builder.py	2015-08-24 00:56:21 +0000
@@ -322,20 +322,25 @@
         """
         self._print('Running PyInstaller...')
         os.chdir(self.work_path)
-        pyinstaller = Popen((self.python,
-                             self.pyinstaller,
-                             '--noconfirm',
-                             '--windowed',
-                             '--noupx',
-                             '--additional-hooks-dir', self.hooks_path,
-                             '--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
-                             '--log-level=ERROR',
-                             # '--distpath', self.branch_path,
-                             # '-i', self.mac_icon,
-                             '-p', self.work_path,
-                             '-n', 'OpenLP',
-                             self.openlp_script),
-                            stdout=PIPE)
+        cmd = [self.python,
+               self.pyinstaller,
+               '--clean',
+               '--noconfirm',
+               '--windowed',
+               '--noupx',
+               '--additional-hooks-dir', self.hooks_path,
+               '--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
+               '-i', self.mac_icon,
+               '-p', self.work_path,
+               '-n', 'OpenLP',
+               self.openlp_script]
+        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]
         code = pyinstaller.wait()
         if code != 0:
@@ -433,7 +438,10 @@
         fr = open(self.bundle_info, 'r')
         fw = open(os.path.join(self.dist_app_path, 'Contents', os.path.basename(self.bundle_info)), 'w')
         text = fr.read()
-        text = text % {'openlp_version': self.version_string}
+        if self.args.devel:
+            text = text % {'openlp_version': self.version_string}
+        else:
+            text = text % {'openlp_version': self.version_tag}
         fw.write(text)
         fr.close()
         fw.close()
@@ -584,7 +592,7 @@
             os.remove(dmg_file)
         # Create empty dmg file.
         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.
         self._print('... dmg disk size: %s' % size)
         self._run_command([self.hdiutil, 'create', dmg_file, '-ov', '-megabytes', str(size), '-fs', 'HFS+', '-volname',
@@ -602,7 +610,7 @@
         # Copy OpenLP.app and other files to .dmg
         # TODO more reliable way to determine 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.')
 
         # Set icon for dmg file.

=== added file 'pyinstaller-hooks/hook-ssl.py'
--- pyinstaller-hooks/hook-ssl.py	1970-01-01 00:00:00 +0000
+++ pyinstaller-hooks/hook-ssl.py	2015-08-24 00:56:21 +0000
@@ -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'

=== added file 'pyinstaller-hooks/rthook_ssl.py'
--- pyinstaller-hooks/rthook_ssl.py	1970-01-01 00:00:00 +0000
+++ pyinstaller-hooks/rthook_ssl.py	2015-08-24 00:56:21 +0000
@@ -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')

=== modified file 'windows/windows-builder.py'
--- windows/windows-builder.py	2015-06-28 09:50:54 +0000
+++ windows/windows-builder.py	2015-08-24 00:56:21 +0000
@@ -289,19 +289,26 @@
         """
         self._print('Running PyInstaller...')
         os.chdir(self.branch_path)
-        pyinstaller = Popen((self.python, self.pyinstaller,
-                             '--noconfirm',
-                             '--windowed',
-                             '--noupx',
-                             '--additional-hooks-dir', self.hooks_path,
-                             '--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
-                             '--log-level=DEBUG',
-                             '--distpath', self.dist_path_pyinst_arg,
-                             '-i', self.win32_icon,
-                             '-p', self.branch_path,
-                             '-n', 'OpenLP',
-                             self.openlp_script),
-                            stdout=PIPE)
+        cmd = [self.python,
+               self.pyinstaller,
+               '--clean',
+               '--noconfirm',
+               '--windowed',
+               '--noupx',
+               '--additional-hooks-dir', self.hooks_path,
+               '--runtime-hook', os.path.join(self.hooks_path, 'rthook_openlp_pyqt4.py'),
+               '--distpath', self.dist_path_pyinst_arg,
+               '-i', self.win32_icon,
+               '-p', self.branch_path,
+               '-n', 'OpenLP',
+               self.openlp_script]
+        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]
         code = pyinstaller.wait()
         if code != 0:


Follow ups