forked from Electron-Cash/Electron-Cash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosx.spec
150 lines (136 loc) · 5.73 KB
/
osx.spec
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# -*- mode: python3 -*-
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
import sys, os
PACKAGE='Electron-Cash'
BUNDLE_IDENTIFIER='org.electroncash.' + PACKAGE # Used for info.plist
PYPKG='electroncash'
MAIN_SCRIPT='electron-cash'
ICONS_FILE='electron.icns'
VERSION = os.environ.get("ELECTRONCASH_VERSION")
if not VERSION:
raise Exception('no version')
home = os.path.abspath(".") + "/"
block_cipher = None
# see https://github.com/pyinstaller/pyinstaller/issues/2005
hiddenimports = []
hiddenimports += collect_submodules('trezorlib')
hiddenimports += collect_submodules('btchip')
hiddenimports += collect_submodules('keepkeylib')
hiddenimports += collect_submodules('satochip') # Satochip
hiddenimports += collect_submodules('smartcard') # Satochip
datas = [
(home+'electroncash/currencies.json', PYPKG),
(home+'electroncash/servers.json', PYPKG),
(home+'electroncash/servers_testnet.json', PYPKG),
(home+'electroncash/servers_testnet4.json', PYPKG),
(home+'electroncash/servers_scalenet.json', PYPKG),
(home+'electroncash/servers_regtest.json', PYPKG),
(home+'electroncash/servers_chipnet.json', PYPKG),
(home+'electroncash/wordlist/english.txt', PYPKG + '/wordlist'),
(home+'electroncash/locale', PYPKG + '/locale'),
(home+'electroncash_plugins', PYPKG + '_plugins'),
]
datas += collect_data_files('trezorlib')
datas += collect_data_files('btchip')
datas += collect_data_files('keepkeylib')
datas += collect_data_files('mnemonic') # wordlists used by keepkeylib from lib mnemonic
# Add libusb so Trezor will work
binaries = [(home + "contrib/osx/libusb-1.0.dylib", ".")]
# LibSecp for fast ECDSA and Schnorr
binaries += [(home + "contrib/osx/libsecp256k1.0.dylib", ".")]
# LibZBar for QR code scanning
binaries += [(home + "contrib/osx/libzbar.0.dylib", ".")]
# Add Tor binary
binaries += [(home + "electroncash/tor/bin/tor", "electroncash/tor/bin")]
# Workaround for "Retro Look":
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
# We don't put these files in to actually include them in the script but to make the Analysis method scan them for imports
a = Analysis([home+MAIN_SCRIPT,
home+'electroncash_gui/qt/main_window.py',
home+'electroncash_gui/qt/qrreader/camera_dialog.py',
home+'electroncash_gui/text.py',
home+'electroncash/util.py',
home+'electroncash/wallet.py',
home+'electroncash/simple_config.py',
home+'electroncash/bitcoin.py',
home+'electroncash/dnssec.py',
home+'electroncash/commands.py',
home+'electroncash/tor/controller.py',
home+'electroncash_plugins/cosigner_pool/qt.py',
home+'electroncash_plugins/email_requests/qt.py',
home+'electroncash_plugins/trezor/clientbase.py',
home+'electroncash_plugins/trezor/trezor.py',
home+'electroncash_plugins/trezor/qt.py',
home+'electroncash_plugins/keepkey/qt.py',
home+'electroncash_plugins/ledger/qt.py',
home+'electroncash_plugins/satochip/qt.py', # Satochip
home+'electroncash_plugins/fusion/fusion.py', # CashFusion
home+'electroncash_plugins/fusion/qt.py', # CashFusion
],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
# Prevent the console2.py dev-only script from pulling-in qtconsole and ipython
excludes=["qtconsole", "ipython"],
)
# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal
for d in a.datas:
if 'pyconfig' in d[0]:
a.datas.remove(d)
break
# Remove QtWeb and other stuff that we know we never use.
# This is a hack of sorts that works to keep the binary file size reasonable.
bins2remove=('qtweb', 'qt3d', 'qtgame', 'qtdesigner', 'qtquick', 'qtlocation',
'qttest', 'qtxml', 'qtqml', 'qtsql', 'qtserialport', 'qtsensors',
'qtpositioning', 'qtnfc', 'qthelp', 'qtbluetooth',
'pyqt5/qt/qml', 'pyqt5/qt/plugins/position',
'pyqt5/qt/plugins/sqldrivers', )
files2remove=('libqsqlmysql.dylib', 'libdeclarative_multimedia.dylib',
'libqtquickscene2dplugin.dylib', 'libqtquickscene3dplugin.dylib',
'libqtquickcontrols2imaginestyleplugin.dylib', 'libqwebgl.dylib',
'libqtquickextrasflatplugin.dylib', 'ibqtcanvas3d.dylib',
'libqtquickcontrolsplugin.dylib', 'libqtquicktemplates2plugin.dylib',
'libqtlabsplatformplugin.dylib', 'libdeclarative_sensors.dylib',
'libdeclarative_location.dylib', )
print("Removing", *(bins2remove + files2remove))
for x in a.binaries.copy():
item = x[0].lower()
fn = x[1].lower()
if os.path.basename(fn) in files2remove:
a.binaries.remove(x)
print('----> Removed:', x)
continue
for r in bins2remove:
pyqt5_r = 'pyqt5.' + r
if item.startswith(r) or item.startswith(pyqt5_r):
a.binaries.remove(x)
print('----> Removed:', x)
break # break from inner loop
#
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name=PACKAGE,
debug=False,
strip=False,
upx=False,
icon=home+ICONS_FILE,
console=False
)
app = BUNDLE(
exe,
a.binaries,
a.zipfiles,
a.datas,
version = VERSION,
name=PACKAGE + '.app',
icon=home+ICONS_FILE,
bundle_identifier=BUNDLE_IDENTIFIER,
info_plist = {
'NSHighResolutionCapable':'True',
'NSSupportsAutomaticGraphicsSwitching':'True'
}
)