summaryrefslogtreecommitdiff
path: root/pkg/pyinst
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-10-21 16:56:41 -0400
committerKali Kaneko (leap communications) <kali@leap.se>2016-10-21 17:17:30 -0400
commitb9f8766d72728093f6183c289d23ecd8a1fa562f (patch)
tree8f82ba9b16743e2d77ae1c53d602eeb604f7968f /pkg/pyinst
parentd063b5a2c32b867e5284121551951cc8e695aa9a (diff)
[pkg] native pyinstaller packaging
Diffstat (limited to 'pkg/pyinst')
-rw-r--r--pkg/pyinst/app.spec47
-rw-r--r--pkg/pyinst/build.mk9
-rw-r--r--pkg/pyinst/win_postbuild.bat11
3 files changed, 54 insertions, 13 deletions
diff --git a/pkg/pyinst/app.spec b/pkg/pyinst/app.spec
index e630439..5869b60 100644
--- a/pkg/pyinst/app.spec
+++ b/pkg/pyinst/app.spec
@@ -1,25 +1,47 @@
# -*- mode: python -*-
+import platform
block_cipher = None
+hiddenimports = [
+ 'scrypt', 'zope.interface', 'zope.proxy',
+ 'pysqlcipher', 'service_identity',
+ 'leap.common', 'leap.bitmask',
+ 'leap.bitmask.core.logs',
+ 'leap.soledad.common.document',
+ 'leap.bitmask_js']
+
+if platform.system() == 'Windows':
+ print "Platform=Windows, using pyside..."
+ hiddenimports.extend(
+ ['PySide.QtCore', 'PySide.QtGui', 'PySide.QtWebKit',
+ # for some reason pyinstaller 3.1 complains about missing
+ # packages that should have been vendored
+ 'appdirs',
+ 'packaging', 'packaging.version', 'packaging.specifiers',
+ 'packaging.requirements',
+ 'python-gnupg'])
+ excludes = ['PyQt5']
+else:
+ hiddenimports.extend(
+ ['PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWebKit'])
+ excludes = ['PySide']
+
+import os
+VENV = os.environ.get('VIRTUAL_ENV', '')
a = Analysis(['../../src/leap/bitmask/gui/app.py'],
pathex=[
- '/usr/lib/python2.7/dist-packages/'],
+ '/usr/lib/python2.7/dist-packages/',
+ VENV + '/Lib/site-packages/',
+ VENV + '/Lib/site-packages/leap/soledad'],
binaries=None,
datas=None,
- hiddenimports=[
- 'scrypt',
- 'zope.interface', 'zope.proxy',
- 'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWebKit',
- 'pysqlcipher', 'service_identity',
- 'leap.common', 'leap.bitmask',
- 'leap.bitmask.core.logs',
- 'leap.bitmask_js',
- ],
+ hiddenimports=hiddenimports,
hookspath=[],
runtime_hooks=[],
- excludes=[],
+ excludes=excludes,
+
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
@@ -29,9 +51,10 @@ exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='bitmask',
- debug=False,
+ debug=True,
strip=False,
upx=True,
+ # TODO remove console for win
console=True )
coll = COLLECT(exe,
a.binaries,
diff --git a/pkg/pyinst/build.mk b/pkg/pyinst/build.mk
index 9df420d..4a250d7 100644
--- a/pkg/pyinst/build.mk
+++ b/pkg/pyinst/build.mk
@@ -10,6 +10,13 @@ bundle: bundle_clean
cd pkg/launcher && make
cp pkg/launcher/bitmask $(DIST_VERSION)
+bundle_win:
+ pyinstaller -y pkg/pyinst/app.spec
+ cp ${VIRTUAL_ENV}/Lib/site-packages/_scrypt.pyd $(DIST)
+ cp ${VIRTUAL_ENV}/Lib/site-packages/zmq/libzmq.pyd $(DIST)
+ cp src/leap/bitmask/core/bitmaskd.tac $(DIST)
+
+
bundle_tar:
cd dist/ && tar cvzf Bitmask.$(NEXT_VERSION).tar.gz bitmask-$(NEXT_VERSION)
@@ -20,5 +27,5 @@ bundle_upload:
rsync --rsh='ssh' -avztlpog --progress --partial dist/Bitmask.$(NEXT_VERSION).* downloads.leap.se:./
bundle_clean:
- rm -rf dist build
+ rm -rf "dist" "build"
diff --git a/pkg/pyinst/win_postbuild.bat b/pkg/pyinst/win_postbuild.bat
new file mode 100644
index 0000000..c4d9fb0
--- /dev/null
+++ b/pkg/pyinst/win_postbuild.bat
@@ -0,0 +1,11 @@
+SET DIST=%CD%\dist\bitmask
+cp %VIRTUAL_ENV%/Lib/site-packages/_scrypt.pyd %DIST%
+cp %VIRTUAL_ENV%/Lib/site-packages/zmq/libzmq.pyd %DIST%
+cp %VIRTUAL_ENV%/Lib/site-packages/leap/common/cacert.pem %DIST%
+cp %CD%\src\leap\bitmask\core\bitmaskd.tac %DIST%
+mkdir %DIST%\leap
+mkdir %DIST%\leap\soledad\common\l2db\backends
+mkdir %DIST%\apps\mail
+cp %CD%/../gpg/* %DIST%\apps\mail\
+cp %VIRTUAL_ENV%/Lib/site-packages/leap/soledad/common/l2db/backends/dbschema.sql %DIST%\leap\soledad\common\l2db\backends
+cp -r %VIRTUAL_ENV%/Lib/site-packages/leap/bitmask_js %DIST%\leap\