summaryrefslogtreecommitdiff
path: root/pkg/pyinst/app.spec
blob: d00d540f25c2734801a9dc6586fec5be7742ed4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- mode: python -*-
import os
import sys
import platform

block_cipher = None

IS_MAC = sys.platform.startswith('darwin')
IS_WIN = platform.system() == 'Windows'

BITMASK_VERSION = open('pkg/next-version').read()
if IS_MAC:
    # launchd chokes because more digits are added to the version string,
    # so let's skip the patch part of the version.
    BITMASK_VERSION  = '.'.join(BITMASK_VERSION.split('.')[:-1])

hiddenimports = [
     'appdirs',
     'scrypt', 'zope.interface', 'zope.proxy',
     'psutil',
     'leap.pixelated_www', 'pixelated', 'chardet', 'whoosh', 'requests',
     'pysqlcipher', 'service_identity',
     'leap.common', 'leap.bitmask', 
     'leap.bitmask.core.logs',
     'leap.soledad.common', 
     'leap.soledad.common.document', 
     'leap.soledad.common.l2db',
     'leap.soledad.client.events',
     'leap.bitmask_js',
     'packaging', 'packaging.version', 'packaging.specifiers',
     'packaging.requirements']

if IS_WIN:
    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']
elif IS_MAC:
    hiddenimports.extend(['pywebview', 'pyobjc'])
    hiddenimports.extend(
        ['PyQt5.QtWidgets', 'PyQt5.QtCore',
         'leap.bitmask.gui.icons_rc'])
    print "Added PyQt5 to the venv"
    excludes = ['IPython', 'PySide']
else:
    hiddenimports.extend(
        ['PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.QtWebEngineWidgets',
         'leap.bitmask.gui.icons_rc'])
    excludes = ['IPython', 'PySide', 
                'PyQt5.QtPrintSupport', 'PyQt5.QtNetwork.py']


VENV = os.environ.get('VIRTUAL_ENV', '')

if IS_MAC:
    # experimental pywebview entrypoint
    ENTRYPOINT = ['../../src/leap/bitmask/gui/app2.py']
else:
    ENTRYPOINT = ['../../src/leap/bitmask/gui/app.py']

a = Analysis(ENTRYPOINT,
             pathex=[
	         '/usr/lib/python2.7/dist-packages/',
	         '/usr/local/lib/python2.7/site-packages/'],
             binaries=None,
             datas=None,
             hiddenimports=hiddenimports,
             hookspath=[],
             runtime_hooks=[],
             excludes=excludes,

             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='bitmask',
          debug=False,
          strip=False,
          upx=True,
	  # TODO remove console for win
          console=True,
          icon='../branding/mask-icon.ico')
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='bitmask')

if IS_MAC:
    app = BUNDLE(
    	coll,
        name=os.path.join(
          'dist', 'Bitmask.app'),
          appname='Bitmask',
          version=BITMASK_VERSION,
          icon='pkg/osx/bitmask.icns',
	  bundle_identifier='bitmask-' + BITMASK_VERSION)