summaryrefslogtreecommitdiff
path: root/pkg
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
parentd063b5a2c32b867e5284121551951cc8e695aa9a (diff)
[pkg] native pyinstaller packaging
Diffstat (limited to 'pkg')
-rw-r--r--pkg/pyinst/app.spec47
-rw-r--r--pkg/pyinst/build.mk9
-rw-r--r--pkg/pyinst/win_postbuild.bat11
-rw-r--r--pkg/requirements-win.py4
-rw-r--r--pkg/requirements.pip1
-rw-r--r--pkg/windows/build_native.sh7
6 files changed, 65 insertions, 14 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\
diff --git a/pkg/requirements-win.py b/pkg/requirements-win.py
new file mode 100644
index 0000000..9074d21
--- /dev/null
+++ b/pkg/requirements-win.py
@@ -0,0 +1,4 @@
+pypiwin32
+pyinstaller==3.1
+appdirs
+packaging
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
index ce48e64..793885e 100644
--- a/pkg/requirements.pip
+++ b/pkg/requirements.pip
@@ -4,5 +4,4 @@ zope.interface
service-identity
leap.common
leap.soledad.client
-vext.pyqt5
gnupg
diff --git a/pkg/windows/build_native.sh b/pkg/windows/build_native.sh
new file mode 100644
index 0000000..4c19143
--- /dev/null
+++ b/pkg/windows/build_native.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+rm -rf dist build
+pip uninstall leap.bitmask
+python setup.py bdist_wheel
+pip install dist/*.whl
+pyinstaller.exe -y pkg/pyinst/app.spec
+pkg/pyinst/win_postbuild.bat