Browse Source

windows: build portable version without patching the source

3.0.x
ThomasV 7 years ago
parent
commit
b9d8b2a571
  1. 10
      contrib/build-wine/build-electrum-git.sh
  2. 19
      contrib/build-wine/deterministic.spec
  3. 13
      contrib/build-wine/portable.patch
  4. 6
      electrum

10
contrib/build-wine/build-electrum-git.sh

@ -10,6 +10,7 @@ fi
# These settings probably don't need any change
export WINEPREFIX=/opt/wine64
export PYTHONDONTWRITEBYTECODE=1
export PYTHONHASHSEED=22
PYHOME=c:/python$PYTHON_VERSION
PYTHON="wine $PYHOME/python.exe -OO -B"
@ -64,7 +65,7 @@ cd ..
rm -rf dist/
# build standalone version
wine "C:/python$PYTHON_VERSION/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION.exe -w deterministic.spec
wine "C:/python$PYTHON_VERSION/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION -w deterministic.spec
# build NSIS installer
# $VERSION could be passed to the electrum.nsi script, but this would require some rewriting in the script iself.
@ -74,11 +75,4 @@ cd dist
mv electrum-setup.exe $NAME_ROOT-$VERSION-setup.exe
cd ..
# build portable version
cp portable.patch $WINEPREFIX/drive_c/electrum
pushd $WINEPREFIX/drive_c/electrum
patch < portable.patch
popd
wine "C:/python$PYTHON_VERSION/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION-portable.exe -w deterministic.spec
echo "Done."

19
contrib/build-wine/deterministic.spec

@ -26,7 +26,6 @@ datas = [
(home+'lib/wordlist/english.txt', 'electrum/wordlist'),
(home+'lib/locale', 'electrum/locale'),
(home+'plugins', 'electrum_plugins'),
#(home+'packages/requests/cacert.pem', 'requests/cacert.pem')
]
datas += collect_data_files('trezorlib')
datas += collect_data_files('btchip')
@ -70,24 +69,34 @@ pyz = PYZ(a.pure)
#####
# "standalone" exe with all dependencies packed into it
# (or "portable", depending on cmdline_name)
exe_standalone = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name),
name=os.path.join('build\\pyi.win32\\electrum', cmdline_name + ".exe"),
debug=False,
strip=None,
upx=False,
icon=home+'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+'icons/electrum.ico',
console=False)
# The 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 and separate files that NSIS uses to build installer "setup" exe
# FIXME: this is redundantly done again, when building the "portable" exe
exe_dependent = EXE(
pyz,

13
contrib/build-wine/portable.patch

@ -1,13 +0,0 @@
diff --git a/electrum b/electrum
index 8c972c6..46903b7 100755
--- a/electrum
+++ b/electrum
@@ -454,6 +454,8 @@ if __name__ == '__main__':
if config_options.get('server'):
config_options['auto_connect'] = False
+ config_options['portable'] = True
+
if config_options.get('portable'):
config_options['electrum_path'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')

6
electrum

@ -316,7 +316,7 @@ if __name__ == '__main__':
elif arg == '?':
sys.argv[i] = input("Enter argument:")
elif arg == ':':
sys.argv[i] = prompt_password('Enter argument (will noot echo):', False)
sys.argv[i] = prompt_password('Enter argument (will not echo):', False)
# parse command line
parser = get_parser()
@ -338,6 +338,10 @@ if __name__ == '__main__':
config_options['cwd'] = os.getcwd()
# fixme: this can probably be achieved with a runtime hook (pyinstaller)
if is_bundle and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')):
config_options.get('portable') = True
if config_options.get('portable'):
config_options['electrum_path'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'electrum_data')

Loading…
Cancel
Save