Dobry den, uz 5 dni se snazim tyto 3x skripty predelat do bataku nebo do powershellu. Ale marne,
me znalosti na to nestaci. Najde se tady nekdo natolik zkuseny ze by me s tim pomohl nebo dokonce ze by to dokazal predelat?
Skript1=build-electrum-git.sh
#!/bin/bash
# You probably need to update only this link
ELECTRUM_GIT_URL=git://github.com/spesmilo/electrum.git
BRANCH=master
NAME_ROOT=electrum
# These settings probably don't need any change
export WINEPREFIX=/opt/wine64
PYHOME=c:/python27
PYTHON="wine $PYHOME/python.exe -OO -B"
# Let's begin!
cd `dirname $0`
set -e
cd tmp
if [ -d "electrum-git" ]; then
# GIT repository found, update it
echo "Pull"
cd electrum-git
git checkout master
git pull
cd ..
else
# GIT repository not found, clone it
echo "Clone"
git clone -b $BRANCH $ELECTRUM_GIT_URL electrum-git
fi
cd electrum-git
VERSION=`git describe --tags`
echo "Last commit: $VERSION"
cd ..
rm -rf $WINEPREFIX/drive_c/electrum
cp -r electrum-git $WINEPREFIX/drive_c/electrum
cp electrum-git/LICENCE .
# add python packages (built with make_packages)
cp -r ../../../packages $WINEPREFIX/drive_c/electrum/
# add locale dir
cp -r ../../../lib/locale $WINEPREFIX/drive_c/electrum/lib/
# Build Qt resources
wine $WINEPREFIX/drive_c/Python27/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/lib/icons_rc.py
wine $WINEPREFIX/drive_c/Python27/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/gui/qt/icons_rc.py
cd ..
rm -rf dist/
# build standalone version
$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -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.
wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" /DPRODUCT_VERSION=$VERSION electrum.nsi
cd dist
mv electrum.exe $NAME_ROOT-$VERSION.exe
mv electrum-setup.exe $NAME_ROOT-$VERSION-setup.exe
mv electrum $NAME_ROOT-$VERSION
zip -r $NAME_ROOT-$VERSION.zip $NAME_ROOT-$VERSION
cd ..
# build portable version
cp portable.patch $WINEPREFIX/drive_c/electrum
pushd $WINEPREFIX/drive_c/electrum
patch < portable.patch
popd
$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii -w deterministic.spec
cd dist
mv electrum.exe $NAME_ROOT-$VERSION-portable.exe
cd ..
echo "Done."
Skript2=deterministic.spec
# -*- mode: python -*-
home = 'C:\\electrum\\'
# 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+'electrum',
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/qt.py',
home+'plugins/keepkey/qt.py',
home+'plugins/ledger/qt.py',
home+'packages/requests/utils.py'
],
pathex=[home+'lib', home+'gui', home+'plugins', home+'packages'],
hiddenimports=['lib', 'gui'],
hookspath=[])
##### include folder in distribution #######
def extra_datas(mydir):
def rec_glob(p, files):
import os
import glob
for d in glob.glob(p):
if os.path.isfile(d):
files.append(d)
rec_glob("%s/*" % d, files)
files = []
rec_glob("%s/*" % mydir, files)
extra_datas = []
for f in files:
d = f.split('\\')
t = ''
for a in d[2:]:
if len(t)==0:
t = a
else:
t = t+'\\'+a
extra_datas.append((t, f, 'DATA'))
return extra_datas
###########################################
# append dirs
# cacert.pem
a.datas += [ ('requests/cacert.pem', home+'packages/requests/cacert.pem', 'DATA') ]
# Py folders that are needed because of the magic import finding
a.datas += extra_datas(home+'gui')
a.datas += extra_datas(home+'lib')
a.datas += extra_datas(home+'plugins')
a.datas += extra_datas(home+'packages')
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.datas,
name=os.path.join('build\\pyi.win32\\electrum', 'electrum.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
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=None,
upx=True,
debug=False,
icon=home+'icons/electrum.ico',
console=False,
name=os.path.join('dist', 'electrum'))
Skript3=portable.patch
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')