You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
3.6 KiB
107 lines
3.6 KiB
7 years ago
|
# -*- mode: python -*-
|
||
|
|
||
|
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
|
||
|
|
||
|
import sys
|
||
|
import os
|
||
|
|
||
|
PACKAGE='Electrum'
|
||
|
PYPKG='electrum'
|
||
|
MAIN_SCRIPT='run_electrum'
|
||
|
ICONS_FILE='electrum.icns'
|
||
|
|
||
|
for i, x in enumerate(sys.argv):
|
||
|
if x == '--name':
|
||
|
VERSION = sys.argv[i+1]
|
||
|
break
|
||
|
else:
|
||
|
raise Exception('no version')
|
||
|
|
||
|
electrum = os.path.abspath(".") + "/"
|
||
|
block_cipher = None
|
||
|
|
||
|
# see https://github.com/pyinstaller/pyinstaller/issues/2005
|
||
|
hiddenimports = []
|
||
|
hiddenimports += collect_submodules('trezorlib')
|
||
7 years ago
|
hiddenimports += collect_submodules('safetlib')
|
||
7 years ago
|
hiddenimports += collect_submodules('btchip')
|
||
|
hiddenimports += collect_submodules('keepkeylib')
|
||
|
hiddenimports += collect_submodules('websocket')
|
||
7 years ago
|
hiddenimports += collect_submodules('ckcc')
|
||
7 years ago
|
|
||
|
datas = [
|
||
6 years ago
|
(electrum + PYPKG + '/*.json', PYPKG),
|
||
|
(electrum + PYPKG + '/wordlist/english.txt', PYPKG + '/wordlist'),
|
||
|
(electrum + PYPKG + '/locale', PYPKG + '/locale'),
|
||
|
(electrum + PYPKG + '/plugins', PYPKG + '/plugins'),
|
||
7 years ago
|
]
|
||
|
datas += collect_data_files('trezorlib')
|
||
7 years ago
|
datas += collect_data_files('safetlib')
|
||
7 years ago
|
datas += collect_data_files('btchip')
|
||
|
datas += collect_data_files('keepkeylib')
|
||
7 years ago
|
datas += collect_data_files('ckcc')
|
||
7 years ago
|
|
||
6 years ago
|
# Add the QR Scanner helper app
|
||
6 years ago
|
datas += [(electrum + "contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app", "./contrib/osx/CalinsQRReader/build/Release/CalinsQRReader.app")]
|
||
6 years ago
|
|
||
7 years ago
|
# Add libusb so Trezor and Safe-T mini will work
|
||
6 years ago
|
binaries = [(electrum + "contrib/osx/libusb-1.0.dylib", ".")]
|
||
|
binaries += [(electrum + "contrib/osx/libsecp256k1.0.dylib", ".")]
|
||
7 years ago
|
|
||
|
# 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([electrum+ MAIN_SCRIPT,
|
||
|
electrum+'electrum/gui/qt/main_window.py',
|
||
|
electrum+'electrum/gui/text.py',
|
||
|
electrum+'electrum/util.py',
|
||
|
electrum+'electrum/wallet.py',
|
||
|
electrum+'electrum/simple_config.py',
|
||
|
electrum+'electrum/bitcoin.py',
|
||
|
electrum+'electrum/dnssec.py',
|
||
|
electrum+'electrum/commands.py',
|
||
|
electrum+'electrum/plugins/cosigner_pool/qt.py',
|
||
|
electrum+'electrum/plugins/email_requests/qt.py',
|
||
|
electrum+'electrum/plugins/trezor/qt.py',
|
||
7 years ago
|
electrum+'electrum/plugins/safe_t/client.py',
|
||
|
electrum+'electrum/plugins/safe_t/qt.py',
|
||
7 years ago
|
electrum+'electrum/plugins/keepkey/qt.py',
|
||
|
electrum+'electrum/plugins/ledger/qt.py',
|
||
7 years ago
|
electrum+'electrum/plugins/coldcard/qt.py',
|
||
7 years ago
|
],
|
||
|
binaries=binaries,
|
||
|
datas=datas,
|
||
|
hiddenimports=hiddenimports,
|
||
|
hookspath=[])
|
||
|
|
||
|
# 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
|
||
|
|
||
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||
|
|
||
|
exe = EXE(pyz,
|
||
|
a.scripts,
|
||
|
a.binaries,
|
||
|
a.datas,
|
||
|
name=PACKAGE,
|
||
|
debug=False,
|
||
|
strip=False,
|
||
|
upx=True,
|
||
|
icon=electrum+ICONS_FILE,
|
||
|
console=False)
|
||
|
|
||
|
app = BUNDLE(exe,
|
||
|
version = VERSION,
|
||
|
name=PACKAGE + '.app',
|
||
|
icon=electrum+ICONS_FILE,
|
||
|
bundle_identifier=None,
|
||
|
info_plist={
|
||
|
'NSHighResolutionCapable': 'True',
|
||
|
'NSSupportsAutomaticGraphicsSwitching': 'True'
|
||
|
}
|
||
|
)
|