update pyinstaller scripts for python3 and pyinstaller3 (credit: bauerj)
This commit is contained in:
@@ -5,11 +5,16 @@ ELECTRUM_GIT_URL=git://github.com/spesmilo/electrum.git
|
||||
BRANCH=master
|
||||
NAME_ROOT=electrum
|
||||
|
||||
if [ "$#" -gt 0 ]; then
|
||||
BRANCH="$1"
|
||||
fi
|
||||
|
||||
# These settings probably don't need any change
|
||||
export WINEPREFIX=/opt/wine64
|
||||
export PYTHONHASHSEED=22
|
||||
|
||||
PYHOME=c:/python27
|
||||
|
||||
PYHOME=c:/python34
|
||||
PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
|
||||
@@ -42,22 +47,23 @@ 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
|
||||
wine $WINEPREFIX/drive_c/Python34/Lib/site-packages/PyQt4/pyrcc4.exe C:/electrum/icons.qrc -o C:/electrum/gui/qt/icons_rc.py -py3
|
||||
|
||||
|
||||
pushd $WINEPREFIX/drive_c/electrum
|
||||
$PYTHON setup.py install
|
||||
popd
|
||||
|
||||
cd ..
|
||||
|
||||
rm -rf dist/
|
||||
|
||||
# build standalone version
|
||||
$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii --name $NAME_ROOT-$VERSION.exe -w deterministic.spec
|
||||
wine "C:/python34/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION.exe -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.
|
||||
@@ -72,6 +78,6 @@ cp portable.patch $WINEPREFIX/drive_c/electrum
|
||||
pushd $WINEPREFIX/drive_c/electrum
|
||||
patch < portable.patch
|
||||
popd
|
||||
$PYTHON "C:/pyinstaller/pyinstaller.py" --noconfirm --ascii --name $NAME_ROOT-$VERSION-portable.exe -w deterministic.spec
|
||||
wine "C:/python34/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION-portable.exe -w deterministic.spec
|
||||
|
||||
echo "Done."
|
||||
|
||||
@@ -27,47 +27,17 @@ a = Analysis([home+'electrum',
|
||||
home+'plugins/trezor/qt.py',
|
||||
home+'plugins/keepkey/qt.py',
|
||||
home+'plugins/ledger/qt.py',
|
||||
home+'packages/requests/utils.py'
|
||||
#home+'packages/requests/utils.py'
|
||||
],
|
||||
pathex=[home+'lib', home+'gui', home+'plugins', home+'packages'],
|
||||
hiddenimports=['lib', 'gui'],
|
||||
datas = [
|
||||
(home+'lib/currencies.json', 'electrum'),
|
||||
(home+'lib/wordlist/english.txt', 'electrum/wordlist'),
|
||||
#(home+'packages/requests/cacert.pem', 'requests/cacert.pem')
|
||||
],
|
||||
#pathex=[home+'lib', home+'gui', home+'plugins'],
|
||||
#hiddenimports=["lib", "gui", "plugins", "electrum_gui.qt.icons_rc"],
|
||||
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')
|
||||
|
||||
# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal
|
||||
for d in a.datas:
|
||||
@@ -85,7 +55,7 @@ exe = EXE(pyz,
|
||||
strip=None,
|
||||
upx=False,
|
||||
icon=home+'icons/electrum.ico',
|
||||
console=False)
|
||||
console=True)
|
||||
# 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,
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Please update these links carefully, some versions won't work under Wine
|
||||
PYTHON_URL=https://www.python.org/ftp/python/2.7.13/python-2.7.13.msi
|
||||
PYQT4_URL=http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.1/PyQt4-4.11.1-gpl-Py2.7-Qt4.8.6-x32.exe
|
||||
PYWIN32_URL=http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win32-py2.7.exe/download
|
||||
PYINSTALLER_URL=https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-2.1.zip
|
||||
PYTHON_URL=https://www.python.org/ftp/python/3.4.4/python-3.4.4.amd64.msi
|
||||
PYWIN32_URL=https://sourceforge.net/projects/pywin32/files/pywin32/Build%20221/pywin32-221.win-amd64-py3.4.exe
|
||||
PYQT4_URL=https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64.exe
|
||||
NSIS_URL=http://prdownloads.sourceforge.net/nsis/nsis-2.46-setup.exe?download
|
||||
SETUPTOOLS_URL=https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe
|
||||
|
||||
|
||||
## These settings probably don't need change
|
||||
export WINEPREFIX=/opt/wine64
|
||||
#export WINEARCH='win32'
|
||||
|
||||
PYHOME=c:/python27
|
||||
PYHOME=c:/python34
|
||||
PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
# Let's begin!
|
||||
@@ -46,10 +44,11 @@ wine pywin32.exe
|
||||
wget -O PyQt.exe "$PYQT4_URL"
|
||||
wine PyQt.exe
|
||||
|
||||
# upgrade pip
|
||||
$PYTHON -m pip install pip --upgrade
|
||||
|
||||
# Install pyinstaller
|
||||
wget -O pyinstaller.zip "$PYINSTALLER_URL"
|
||||
unzip pyinstaller.zip
|
||||
mv PyInstaller-2.1 $WINEPREFIX/drive_c/pyinstaller
|
||||
$PYTHON -m pip install pyinstaller==3.2.1
|
||||
|
||||
# Install ZBar
|
||||
#wget -q -O zbar.exe "http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download"
|
||||
@@ -66,10 +65,14 @@ $PYTHON -m pip install websocket-client
|
||||
|
||||
|
||||
# Install setuptools
|
||||
wget -O setuptools.exe "$SETUPTOOLS_URL"
|
||||
wine setuptools.exe
|
||||
#wget -O setuptools.exe "$SETUPTOOLS_URL"
|
||||
#wine setuptools.exe
|
||||
|
||||
# Upgrade setuptools (so Electrum can be installed later)
|
||||
$PYTHON -m pip install setuptools --upgrade
|
||||
|
||||
# Install NSIS installer
|
||||
echo "Make sure to untick 'Start NSIS' and 'Show release notes'"
|
||||
wget -q -O nsis.exe "$NSIS_URL"
|
||||
wine nsis.exe
|
||||
|
||||
@@ -79,5 +82,5 @@ wine nsis.exe
|
||||
#cp upx*/upx.exe .
|
||||
|
||||
# add dlls needed for pyinstaller:
|
||||
cp $WINEPREFIX/drive_c/windows/system32/msvcp90.dll $WINEPREFIX/drive_c/Python27/
|
||||
cp $WINEPREFIX/drive_c/windows/system32/msvcm90.dll $WINEPREFIX/drive_c/Python27/
|
||||
cp $WINEPREFIX/drive_c/windows/system32/msvcp90.dll $WINEPREFIX/drive_c/Python34/
|
||||
cp $WINEPREFIX/drive_c/windows/system32/msvcm90.dll $WINEPREFIX/drive_c/Python34/
|
||||
|
||||
Reference in New Issue
Block a user