forked from Electron-Cash/Electron-Cash
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Follow-up: More fixups preparing for merge
- build-electrum-git.sh still had a bad/old path - deterministic.spec was using DOS/Windows line endings (fixed)
- Loading branch information
Showing
2 changed files
with
154 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,153 +1,153 @@ | ||
# -*- 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 BaseException('no name') | ||
|
||
|
||
home = 'C:\\electrum\\' | ||
|
||
# see https://github.com/pyinstaller/pyinstaller/issues/2005 | ||
hiddenimports = [] | ||
hiddenimports += ['PyQt5.sip'] | ||
hiddenimports += collect_submodules('trezorlib') | ||
hiddenimports += collect_submodules('btchip') | ||
hiddenimports += collect_submodules('keepkeylib') | ||
|
||
# Add libusb binary | ||
binaries = [("c:/python3.5.4/libusb-1.0.dll", ".")] | ||
|
||
binaries += [('C:/tmp/libsecp256k1.dll', '.')] | ||
|
||
# Workaround for "Retro Look": | ||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]] | ||
|
||
datas = [ | ||
(home+'lib/currencies.json', 'electroncash'), | ||
(home+'lib/servers.json', 'electroncash'), | ||
(home+'lib/servers_testnet.json', 'electroncash'), | ||
(home+'lib/wordlist/english.txt', 'electroncash/wordlist'), | ||
(home+'lib/locale', 'electroncash/locale'), | ||
(home+'plugins', 'electroncash_plugins'), | ||
('C:\\Program Files (x86)\\ZBar\\bin\\', '.'), | ||
] | ||
datas += collect_data_files('trezorlib') | ||
datas += collect_data_files('btchip') | ||
datas += collect_data_files('keepkeylib') | ||
|
||
# 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+'electron-cash', | ||
home+'gui/qt/main_window.py', | ||
home+'gui/text.py', | ||
home+'lib/util.py', | ||
home+'lib/wallet.py', | ||
home+'lib/simple_config.py', | ||
home+'lib/bitcoin.py', | ||
home+'lib/dnssec.py', | ||
home+'lib/commands.py', | ||
home+'plugins/cosigner_pool/qt.py', | ||
home+'plugins/email_requests/qt.py', | ||
home+'plugins/trezor/clientbase.py', | ||
home+'plugins/trezor/trezor.py', | ||
home+'plugins/trezor/qt.py', | ||
home+'plugins/keepkey/qt.py', | ||
home+'plugins/ledger/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 | ||
|
||
#options = [ ('v', None, 'OPTION')] - put this in the following exe list to debug and turn console=true | ||
|
||
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+'icons/electron.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+'icons/electron.ico', | ||
console=False) | ||
|
||
##### | ||
# exe and separate files that NSIS uses to build installer "setup" exe | ||
|
||
exe_dependent = 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+'icons/electron.ico', | ||
console=False) | ||
|
||
coll = COLLECT( | ||
exe_dependent, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=None, | ||
upx=True, | ||
debug=False, | ||
icon=home+'icons/electron.ico', | ||
console=False, | ||
name=os.path.join('dist', 'electrum')) | ||
# -*- 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 BaseException('no name') | ||
|
||
|
||
home = 'C:\\electrum\\' | ||
|
||
# see https://github.com/pyinstaller/pyinstaller/issues/2005 | ||
hiddenimports = [] | ||
hiddenimports += ['PyQt5.sip'] | ||
hiddenimports += collect_submodules('trezorlib') | ||
hiddenimports += collect_submodules('btchip') | ||
hiddenimports += collect_submodules('keepkeylib') | ||
|
||
# Add libusb binary | ||
binaries = [("c:/python3.5.4/libusb-1.0.dll", ".")] | ||
|
||
binaries += [('C:/tmp/libsecp256k1.dll', '.')] | ||
|
||
# Workaround for "Retro Look": | ||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]] | ||
|
||
datas = [ | ||
(home+'lib/currencies.json', 'electroncash'), | ||
(home+'lib/servers.json', 'electroncash'), | ||
(home+'lib/servers_testnet.json', 'electroncash'), | ||
(home+'lib/wordlist/english.txt', 'electroncash/wordlist'), | ||
(home+'lib/locale', 'electroncash/locale'), | ||
(home+'plugins', 'electroncash_plugins'), | ||
('C:\\Program Files (x86)\\ZBar\\bin\\', '.'), | ||
] | ||
datas += collect_data_files('trezorlib') | ||
datas += collect_data_files('btchip') | ||
datas += collect_data_files('keepkeylib') | ||
|
||
# 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+'electron-cash', | ||
home+'gui/qt/main_window.py', | ||
home+'gui/text.py', | ||
home+'lib/util.py', | ||
home+'lib/wallet.py', | ||
home+'lib/simple_config.py', | ||
home+'lib/bitcoin.py', | ||
home+'lib/dnssec.py', | ||
home+'lib/commands.py', | ||
home+'plugins/cosigner_pool/qt.py', | ||
home+'plugins/email_requests/qt.py', | ||
home+'plugins/trezor/clientbase.py', | ||
home+'plugins/trezor/trezor.py', | ||
home+'plugins/trezor/qt.py', | ||
home+'plugins/keepkey/qt.py', | ||
home+'plugins/ledger/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 | ||
|
||
#options = [ ('v', None, 'OPTION')] - put this in the following exe list to debug and turn console=true | ||
|
||
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+'icons/electron.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+'icons/electron.ico', | ||
console=False) | ||
|
||
##### | ||
# exe and separate files that NSIS uses to build installer "setup" exe | ||
|
||
exe_dependent = 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+'icons/electron.ico', | ||
console=False) | ||
|
||
coll = COLLECT( | ||
exe_dependent, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=None, | ||
upx=True, | ||
debug=False, | ||
icon=home+'icons/electron.ico', | ||
console=False, | ||
name=os.path.join('dist', 'electrum')) |