Merge pull request #2569 from bauerj/pyinstaller3

Fix pyinstaller3 build
This commit is contained in:
ThomasV 2017-08-07 11:09:04 +02:00 committed by GitHub
commit bd854e2f3c
4 changed files with 45 additions and 31 deletions

View File

@ -5,9 +5,13 @@ 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
PYTHON="wine $PYHOME/python.exe -OO -B"
@ -35,7 +39,7 @@ fi
cd electrum-git
VERSION=`git describe --tags`
echo "Last commit: $VERSION"
$PYTHON setup.py install
cd ..
rm -rf $WINEPREFIX/drive_c/electrum
@ -48,18 +52,22 @@ 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
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
exit
wine "C:/python27/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.
wine "$WINEPREFIX/drive_c/Program Files (x86)/NSIS/makensis.exe" /DPRODUCT_VERSION=$VERSION electrum.nsi
@ -68,11 +76,13 @@ cd dist
mv electrum-setup.exe $NAME_ROOT-$VERSION-setup.exe
cd ..
rm build/ -r
# 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 --name $NAME_ROOT-$VERSION-portable.exe -w deterministic.spec
wine "C:/python27/scripts/pyinstaller.exe" --noconfirm --ascii --name $NAME_ROOT-$VERSION-portable.exe -w deterministic.spec
echo "Done."

View File

@ -47,10 +47,13 @@ a = Analysis([home+'electrum',
],
datas = [
(home+'lib/currencies.json', 'electrum'),
(home+'lib/wordlist/english.txt', 'electrum/wordlist')],
(home+'lib/wordlist/english.txt', 'electrum/wordlist'),
(home+'packages/requests/cacert.pem', 'requests/cacert.pem')
],
binaries= zbar_dlls,
hookspath=[])
hookspath=[],
hiddenimports=["lib", "gui", "plugins", "electrum_gui.qt.icons_rc"]
)
# http://stackoverflow.com/questions/19055089/pyinstaller-onefile-warning-pyconfig-h-when-importing-scipy-or-scipy-signal
for d in a.datas:
@ -59,6 +62,7 @@ for d in a.datas:
break
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
@ -68,7 +72,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,
@ -79,5 +83,6 @@ coll = COLLECT(exe,
upx=True,
debug=False,
icon=home+'icons/electrum.ico',
console=False,
console=True,
name=os.path.join('dist', 'electrum'))

View File

@ -4,8 +4,6 @@
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
PYINSTALLER_URL=https://pypi.python.org/packages/source/P/PyInstaller/PyInstaller-3.2.zip
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
@ -23,7 +21,8 @@ set -e
# Clean up Wine environment
echo "Cleaning $WINEPREFIX"
rm -rf $WINEPREFIX
rm -rf $WINEPREFIX/
mkdir $WINEPREFIX
echo "done"
wine 'wineboot'
@ -47,28 +46,28 @@ wine pywin32.exe
wget -O PyQt.exe "$PYQT4_URL"
wine PyQt.exe
# Install pyinstaller
wget -O pyinstaller.zip "$PYINSTALLER_URL"
unzip pyinstaller.zip
#mv PyInstaller-2.1 $WINEPREFIX/drive_c/pyinstaller
mv PyInstaller-3.2.1 $WINEPREFIX/drive_c/pyinstaller
#note: run setup.py too!
wine c:/python27/python.exe -OO -B setup.py install
also needed: https://pypi.python.org/pypi/win_inet_pton
# Install ZBar
#wget -q -O zbar.exe "http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download"
#wine zbar-0.10-setup.exe
# install Cryptodome
$PYTHON -m pip install pycryptodomex
# Install setuptools
wget -O setuptools.exe "$SETUPTOOLS_URL"
wine setuptools.exe
# Install pyinstaller
$PYTHON -m pip install pyinstaller==3.2.1
$PYTHON -m pip install win_inet_pton
# Install ZBar
wget -q -O zbar.exe "http://sourceforge.net/projects/zbar/files/zbar/0.10/zbar-0.10-setup.exe/download"
wine zbar.exe
# install Cryptodome
$PYTHON -m pip install pycryptodomex
# 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

View File

@ -90,7 +90,7 @@ if not is_android:
check_imports()
# load local module as electrum
if is_bundle or is_local or is_android:
if is_local or is_android:
import imp
imp.load_module('electrum', *imp.find_module('lib'))
imp.load_module('electrum_gui', *imp.find_module('gui'))