c1dbcab9bb
This commit ports the work of EchterAgo and cculianu from Electron-Cash, to implement a new toolchain to scan qr codes. Previously, on Linux and Win, we have been using zbar to access the camera and read qrcodes; and on macOS we used CalinsQRReader (an objective-C project by cculianu). The new toolchain added here can use QtMultimedia to access the camera, and then feed that image into zbar. When used this way, zbar needs fewer dependencies and is easier to compile, in particular it can be compiled for macOS. The new toolchain works on all three platforms, with some caveats (see code comments in related commits) -- so we also keep the end-to-end zbar toolchain; but at least we can drop CalinsQRReader. The related changes in Electron-Cash are spread over 50+ commits (several PRs and direct pushes to master), but see in particular: https://github.com/Electron-Cash/Electron-Cash/pull/1376 some other interesting links: https://github.com/Electron-Cash/Electron-Cash/commit/b2b737001c8cc41a38fa580ea252a6d24e08f5d5 https://github.com/Electron-Cash/Electron-Cash/commit/163224cf1fad3af63f2d3cbe68a34fb8ff279af6 https://github.com/Electron-Cash/Electron-Cash/commit/3b31e0fcb13f67646228ff42c0dd39d2a0912291 https://github.com/Electron-Cash/Electron-Cash/commit/eda015908e9d6ea9a0adfbda9db55b929c0926ba https://github.com/Electron-Cash/Electron-Cash/pull/1545 https://github.com/Electron-Cash/Electron-Cash/commit/052aa06c23b939adcea07c701f70ae28ebcf9e0a
176 lines
5.9 KiB
RPMSpec
176 lines
5.9 KiB
RPMSpec
# -*- mode: python -*-
|
|
|
|
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
|
|
|
|
import sys
|
|
for i, x in enumerate(sys.argv):
|
|
if x == '--name':
|
|
cmdline_name = sys.argv[i+1]
|
|
break
|
|
else:
|
|
raise Exception('no name')
|
|
|
|
home = 'C:\\electrum\\'
|
|
|
|
# see https://github.com/pyinstaller/pyinstaller/issues/2005
|
|
hiddenimports = []
|
|
hiddenimports += collect_submodules('pkg_resources') # workaround for https://github.com/pypa/setuptools/issues/1963
|
|
hiddenimports += collect_submodules('trezorlib')
|
|
hiddenimports += collect_submodules('safetlib')
|
|
hiddenimports += collect_submodules('btchip')
|
|
hiddenimports += collect_submodules('keepkeylib')
|
|
hiddenimports += collect_submodules('websocket')
|
|
hiddenimports += collect_submodules('ckcc')
|
|
hiddenimports += collect_submodules('bitbox02')
|
|
hiddenimports += ['PyQt5.QtPrintSupport'] # needed by Revealer
|
|
|
|
|
|
binaries = []
|
|
|
|
# Workaround for "Retro Look":
|
|
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]]
|
|
|
|
binaries += [('C:/tmp/libsecp256k1-0.dll', '.')]
|
|
binaries += [('C:/tmp/libusb-1.0.dll', '.')]
|
|
binaries += [('C:/tmp/libzbar-0.dll', '.')]
|
|
|
|
datas = [
|
|
(home+'electrum/*.json', 'electrum'),
|
|
(home+'electrum/lnwire/*.csv', 'electrum/lnwire'),
|
|
(home+'electrum/wordlist/english.txt', 'electrum/wordlist'),
|
|
(home+'electrum/wordlist/slip39.txt', 'electrum/wordlist'),
|
|
(home+'electrum/locale', 'electrum/locale'),
|
|
(home+'electrum/plugins', 'electrum/plugins'),
|
|
(home+'electrum/gui/icons', 'electrum/gui/icons'),
|
|
]
|
|
datas += collect_data_files('trezorlib')
|
|
datas += collect_data_files('safetlib')
|
|
datas += collect_data_files('btchip')
|
|
datas += collect_data_files('keepkeylib')
|
|
datas += collect_data_files('ckcc')
|
|
datas += collect_data_files('bitbox02')
|
|
|
|
# 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+'run_electrum',
|
|
home+'electrum/gui/qt/main_window.py',
|
|
home+'electrum/gui/qt/qrreader/camera_dialog.py',
|
|
home+'electrum/gui/text.py',
|
|
home+'electrum/util.py',
|
|
home+'electrum/wallet.py',
|
|
home+'electrum/simple_config.py',
|
|
home+'electrum/bitcoin.py',
|
|
home+'electrum/dnssec.py',
|
|
home+'electrum/commands.py',
|
|
home+'electrum/plugins/cosigner_pool/qt.py',
|
|
home+'electrum/plugins/email_requests/qt.py',
|
|
home+'electrum/plugins/trezor/qt.py',
|
|
home+'electrum/plugins/safe_t/client.py',
|
|
home+'electrum/plugins/safe_t/qt.py',
|
|
home+'electrum/plugins/keepkey/qt.py',
|
|
home+'electrum/plugins/ledger/qt.py',
|
|
home+'electrum/plugins/coldcard/qt.py',
|
|
#home+'packages/requests/utils.py'
|
|
],
|
|
binaries=binaries,
|
|
datas=datas,
|
|
#pathex=[home+'lib', home+'gui', home+'plugins'],
|
|
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
|
|
|
|
# Strip out parts of Qt that we never use. Reduces binary size by tens of MBs. see #4815
|
|
qt_bins2remove=('qt5web', 'qt53d', 'qt5game', 'qt5designer', 'qt5quick',
|
|
'qt5location', 'qt5test', 'qt5xml', r'pyqt5\qt\qml\qtquick')
|
|
print("Removing Qt binaries:", *qt_bins2remove)
|
|
for x in a.binaries.copy():
|
|
for r in qt_bins2remove:
|
|
if x[0].lower().startswith(r):
|
|
a.binaries.remove(x)
|
|
print('----> Removed x =', x)
|
|
|
|
qt_data2remove=(r'pyqt5\qt\translations\qtwebengine_locales',)
|
|
print("Removing Qt datas:", *qt_data2remove)
|
|
for x in a.datas.copy():
|
|
for r in qt_data2remove:
|
|
if x[0].lower().startswith(r):
|
|
a.datas.remove(x)
|
|
print('----> Removed x =', x)
|
|
|
|
# hotfix for #3171 (pre-Win10 binaries)
|
|
a.binaries = [x for x in a.binaries if not x[1].lower().startswith(r'c:\windows')]
|
|
|
|
pyz = PYZ(a.pure)
|
|
|
|
|
|
#####
|
|
# "standalone" exe with all dependencies packed into it
|
|
|
|
exe_standalone = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas,
|
|
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + ".exe"),
|
|
debug=False,
|
|
strip=None,
|
|
upx=False,
|
|
icon=home+'electrum/gui/icons/electrum.ico',
|
|
console=False)
|
|
# console=True makes an annoying black box pop up, but it does make Electrum output command line commands, with this turned off no output will be given but commands can still be used
|
|
|
|
exe_portable = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
a.binaries,
|
|
a.datas + [('is_portable', 'README.md', 'DATA')],
|
|
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + "-portable.exe"),
|
|
debug=False,
|
|
strip=None,
|
|
upx=False,
|
|
icon=home+'electrum/gui/icons/electrum.ico',
|
|
console=False)
|
|
|
|
#####
|
|
# exe and separate files that NSIS uses to build installer "setup" exe
|
|
|
|
exe_inside_setup_noconsole = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
exclude_binaries=True,
|
|
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name),
|
|
debug=False,
|
|
strip=None,
|
|
upx=False,
|
|
icon=home+'electrum/gui/icons/electrum.ico',
|
|
console=False)
|
|
|
|
exe_inside_setup_console = EXE(
|
|
pyz,
|
|
a.scripts,
|
|
exclude_binaries=True,
|
|
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name+"-debug"),
|
|
debug=False,
|
|
strip=None,
|
|
upx=False,
|
|
icon=home+'electrum/gui/icons/electrum.ico',
|
|
console=True)
|
|
|
|
coll = COLLECT(
|
|
exe_inside_setup_noconsole,
|
|
exe_inside_setup_console,
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
strip=None,
|
|
upx=True,
|
|
debug=False,
|
|
icon=home+'electrum/gui/icons/electrum.ico',
|
|
console=False,
|
|
name=os.path.join('dist', 'electrum'))
|