Merge branch 'master' into zbar_windows
This commit is contained in:
@@ -16,11 +16,16 @@ cd $build_dir/../..
|
||||
|
||||
export PYTHONHASHSEED=22
|
||||
VERSION=`git describe --tags`
|
||||
|
||||
# Paramterize
|
||||
PYTHON_VERSION=3.6.4
|
||||
BUILDDIR=/tmp/electrum-build
|
||||
PACKAGE=Electrum
|
||||
GIT_REPO=https://github.com/spesmilo/electrum
|
||||
|
||||
|
||||
info "Installing Python $PYTHON_VERSION"
|
||||
export PATH="~/.pyenv/bin:~/.pyenv/shims:$PATH:~/Library/Python/3.6/bin"
|
||||
export PATH="~/.pyenv/bin:~/.pyenv/shims:~/Library/Python/3.6/bin:$PATH"
|
||||
if [ -d "~/.pyenv" ]; then
|
||||
pyenv update
|
||||
else
|
||||
@@ -31,12 +36,10 @@ pyenv global $PYTHON_VERSION || \
|
||||
fail "Unable to use Python $PYTHON_VERSION"
|
||||
|
||||
|
||||
if ! which pyinstaller > /dev/null; then
|
||||
info "Installing pyinstaller"
|
||||
python3 -m pip install pyinstaller -I --user || fail "Could not install pyinstaller"
|
||||
fi
|
||||
info "Installing pyinstaller"
|
||||
python3 -m pip install git+https://github.com/ecdsa/pyinstaller@fix_2952 -I --user || fail "Could not install pyinstaller"
|
||||
|
||||
info "Using these versions for building Electrum:"
|
||||
info "Using these versions for building $PACKAGE:"
|
||||
sw_vers
|
||||
python3 --version
|
||||
echo -n "Pyinstaller "
|
||||
@@ -45,31 +48,37 @@ pyinstaller --version
|
||||
rm -rf ./dist
|
||||
|
||||
|
||||
rm -rf /tmp/electrum-build > /dev/null 2>&1
|
||||
mkdir /tmp/electrum-build
|
||||
rm -rf $BUILDDIR > /dev/null 2>&1
|
||||
mkdir $BUILDDIR
|
||||
|
||||
info "Downloading icons and locale..."
|
||||
for repo in icons locale; do
|
||||
git clone https://github.com/spesmilo/electrum-$repo /tmp/electrum-build/electrum-$repo
|
||||
git clone $GIT_REPO-$repo $BUILDDIR/electrum-$repo
|
||||
done
|
||||
|
||||
cp -R /tmp/electrum-build/electrum-locale/locale/ ./lib/locale/
|
||||
cp /tmp/electrum-build/electrum-icons/icons_rc.py ./gui/qt/
|
||||
cp -R $BUILDDIR/electrum-locale/locale/ ./lib/locale/
|
||||
cp $BUILDDIR/electrum-icons/icons_rc.py ./gui/qt/
|
||||
|
||||
|
||||
info "Downloading libusb..."
|
||||
curl https://homebrew.bintray.com/bottles/libusb-1.0.21.el_capitan.bottle.tar.gz | \
|
||||
tar xz --directory $BUILDDIR
|
||||
cp $BUILDDIR/libusb/1.0.21/lib/libusb-1.0.dylib contrib/build-osx
|
||||
|
||||
info "Installing requirements..."
|
||||
python3 -m pip install -Ir ./contrib/deterministic-build/requirements.txt --user && \
|
||||
python3 -m pip install pyqt5 --user || \
|
||||
python3 -m pip install -Ir ./contrib/deterministic-build/requirements-binaries.txt --user || \
|
||||
fail "Could not install requirements"
|
||||
|
||||
info "Installing hardware wallet requirements..."
|
||||
python3 -m pip install -Ir ./contrib/deterministic-build/requirements-hw.txt --user || \
|
||||
fail "Could not install hardware wallet requirements"
|
||||
|
||||
info "Building Electrum..."
|
||||
python3 setup.py install --user > /dev/null || fail "Could not build Electrum"
|
||||
info "Building $PACKAGE..."
|
||||
python3 setup.py install --user > /dev/null || fail "Could not build $PACKAGE"
|
||||
|
||||
info "Building binary"
|
||||
pyinstaller --noconfirm --ascii --name $VERSION contrib/build-osx/osx.spec || fail "Could not build binary"
|
||||
|
||||
info "Creating .DMG"
|
||||
hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG"
|
||||
hdiutil create -fs HFS+ -volname $PACKAGE -srcfolder dist/$PACKAGE.app dist/electrum-$VERSION.dmg || fail "Could not create .DMG"
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
# -*- mode: python -*-
|
||||
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
PACKAGE='Electrum'
|
||||
PYPKG='electrum'
|
||||
MAIN_SCRIPT='electrum'
|
||||
ICONS_FILE='electrum.icns'
|
||||
|
||||
for i, x in enumerate(sys.argv):
|
||||
if x == '--name':
|
||||
VERSION = sys.argv[i+1]
|
||||
@@ -22,21 +27,27 @@ hiddenimports += collect_submodules('btchip')
|
||||
hiddenimports += collect_submodules('keepkeylib')
|
||||
|
||||
datas = [
|
||||
(electrum+'lib/currencies.json', 'electrum'),
|
||||
(electrum+'lib/servers.json', 'electrum'),
|
||||
(electrum+'lib/checkpoints.json', 'electrum'),
|
||||
(electrum+'lib/servers_testnet.json', 'electrum'),
|
||||
(electrum+'lib/checkpoints_testnet.json', 'electrum'),
|
||||
(electrum+'lib/wordlist/english.txt', 'electrum/wordlist'),
|
||||
(electrum+'lib/locale', 'electrum/locale'),
|
||||
(electrum+'plugins', 'electrum_plugins'),
|
||||
(electrum+'lib/currencies.json', PYPKG),
|
||||
(electrum+'lib/servers.json', PYPKG),
|
||||
(electrum+'lib/checkpoints.json', PYPKG),
|
||||
(electrum+'lib/servers_testnet.json', PYPKG),
|
||||
(electrum+'lib/checkpoints_testnet.json', PYPKG),
|
||||
(electrum+'lib/wordlist/english.txt', PYPKG + '/wordlist'),
|
||||
(electrum+'lib/locale', PYPKG + '/locale'),
|
||||
(electrum+'plugins', PYPKG + '_plugins'),
|
||||
]
|
||||
datas += collect_data_files('trezorlib')
|
||||
datas += collect_data_files('btchip')
|
||||
datas += collect_data_files('keepkeylib')
|
||||
|
||||
# Add libusb so Trezor will work
|
||||
binaries = [(electrum + "contrib/build-osx/libusb-1.0.dylib", ".")]
|
||||
|
||||
# Workaround for "Retro Look":
|
||||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'macstyle' in b[0]]
|
||||
|
||||
# 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([electrum+'electrum',
|
||||
a = Analysis([electrum+MAIN_SCRIPT,
|
||||
electrum+'gui/qt/main_window.py',
|
||||
electrum+'gui/text.py',
|
||||
electrum+'lib/util.py',
|
||||
@@ -52,13 +63,14 @@ a = Analysis([electrum+'electrum',
|
||||
electrum+'plugins/keepkey/qt.py',
|
||||
electrum+'plugins/ledger/qt.py',
|
||||
],
|
||||
binaries=binaries,
|
||||
datas=datas,
|
||||
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]:
|
||||
if 'pyconfig' in d[0]:
|
||||
a.datas.remove(d)
|
||||
break
|
||||
|
||||
@@ -68,19 +80,19 @@ exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
name='Electrum',
|
||||
name=PACKAGE,
|
||||
debug=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
icon=electrum+'electrum.icns',
|
||||
icon=electrum+ICONS_FILE,
|
||||
console=False)
|
||||
|
||||
app = BUNDLE(exe,
|
||||
version = VERSION,
|
||||
name='Electrum.app',
|
||||
icon=electrum+'electrum.icns',
|
||||
name=PACKAGE + '.app',
|
||||
icon=electrum+ICONS_FILE,
|
||||
bundle_identifier=None,
|
||||
info_plist = {
|
||||
'NSHighResolutionCapable':'True'
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
@@ -56,6 +56,12 @@ cp electrum-icons/icons_rc.py $WINEPREFIX/drive_c/electrum/gui/qt/
|
||||
|
||||
# Install frozen dependencies
|
||||
$PYTHON -m pip install -r ../../deterministic-build/requirements.txt
|
||||
|
||||
# Workaround until they upload binary wheels themselves:
|
||||
wget 'https://ci.appveyor.com/api/buildjobs/bwr3yfghdemoryy8/artifacts/dist%2Fpyblake2-1.1.0-cp35-cp35m-win32.whl' -O pyblake2-1.1.0-cp35-cp35m-win32.whl
|
||||
$PYTHON -m pip install ./pyblake2-1.1.0-cp35-cp35m-win32.whl
|
||||
|
||||
|
||||
$PYTHON -m pip install -r ../../deterministic-build/requirements-hw.txt
|
||||
|
||||
pushd $WINEPREFIX/drive_c/electrum
|
||||
|
||||
@@ -13,8 +13,7 @@ echo "Clearing $here/build and $here/dist..."
|
||||
rm "$here"/build/* -rf
|
||||
rm "$here"/dist/* -rf
|
||||
|
||||
$here/prepare-wine.sh && \
|
||||
$here/prepare-pyinstaller.sh || exit 1
|
||||
$here/prepare-wine.sh || exit 1
|
||||
|
||||
echo "Resetting modification time in C:\Python..."
|
||||
# (Because of some bugs in pyinstaller)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- mode: python -*-
|
||||
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
|
||||
from PyInstaller.utils.hooks import collect_data_files, collect_submodules, collect_dynamic_libs
|
||||
|
||||
import sys
|
||||
for i, x in enumerate(sys.argv):
|
||||
@@ -19,6 +19,12 @@ hiddenimports += collect_submodules('trezorlib')
|
||||
hiddenimports += collect_submodules('btchip')
|
||||
hiddenimports += collect_submodules('keepkeylib')
|
||||
|
||||
# Add libusb binary
|
||||
binaries = [("c:/python3.5.4/libusb-1.0.dll", ".")]
|
||||
|
||||
# Workaround for "Retro Look":
|
||||
binaries += [b for b in collect_dynamic_libs('PyQt5') if 'qwindowsvista' in b[0]]
|
||||
|
||||
datas = [
|
||||
(home+'lib/currencies.json', 'electrum'),
|
||||
(home+'lib/servers.json', 'electrum'),
|
||||
@@ -52,6 +58,7 @@ a = Analysis([home+'electrum',
|
||||
home+'plugins/ledger/qt.py',
|
||||
#home+'packages/requests/utils.py'
|
||||
],
|
||||
binaries=binaries,
|
||||
datas=datas,
|
||||
#pathex=[home+'lib', home+'gui', home+'plugins'],
|
||||
hiddenimports=hiddenimports,
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
PYTHON_VERSION=3.5.4
|
||||
|
||||
PYINSTALLER_GIT_URL=https://github.com/ecdsa/pyinstaller.git
|
||||
BRANCH=fix_2952
|
||||
|
||||
export WINEPREFIX=/opt/wine64
|
||||
PYHOME=c:/python$PYTHON_VERSION
|
||||
PYTHON="wine $PYHOME/python.exe -OO -B"
|
||||
|
||||
cd `dirname $0`
|
||||
set -e
|
||||
cd tmp
|
||||
if [ ! -d "pyinstaller" ]; then
|
||||
git clone -b $BRANCH $PYINSTALLER_GIT_URL pyinstaller
|
||||
fi
|
||||
|
||||
cd pyinstaller
|
||||
git pull
|
||||
git checkout $BRANCH
|
||||
$PYTHON setup.py install
|
||||
cd ..
|
||||
|
||||
wine "C:/python$PYTHON_VERSION/scripts/pyinstaller.exe" -v
|
||||
@@ -3,8 +3,13 @@
|
||||
# Please update these carefully, some versions won't work under Wine
|
||||
NSIS_URL=https://prdownloads.sourceforge.net/nsis/nsis-3.02.1-setup.exe?download
|
||||
NSIS_SHA256=736c9062a02e297e335f82252e648a883171c98e0d5120439f538c81d429552e
|
||||
|
||||
ZBAR_URL=https://sourceforge.net/projects/zbarw/files/zbarw-20121031-setup.exe/download
|
||||
ZBAR_SHA256=177e32b272fa76528a3af486b74e9cb356707be1c5ace4ed3fcee9723e2c2c02
|
||||
|
||||
LIBUSB_URL=https://prdownloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.21/libusb-1.0.21.7z?download
|
||||
LIBUSB_SHA256=acdde63a40b1477898aee6153f9d91d1a2e8a5d93f832ca8ab876498f3a6d2b8
|
||||
|
||||
PYTHON_VERSION=3.5.4
|
||||
|
||||
## These settings probably don't need change
|
||||
@@ -75,28 +80,21 @@ done
|
||||
$PYTHON -m pip install pip --upgrade
|
||||
|
||||
# Install pywin32-ctypes (needed by pyinstaller)
|
||||
$PYTHON -m pip install pywin32-ctypes
|
||||
$PYTHON -m pip install pywin32-ctypes==0.1.2
|
||||
|
||||
# Install PyQt
|
||||
$PYTHON -m pip install PyQt5
|
||||
# install PySocks
|
||||
$PYTHON -m pip install win_inet_pton==1.0.1
|
||||
|
||||
## Install pyinstaller
|
||||
#$PYTHON -m pip install pyinstaller==3.3
|
||||
$PYTHON -m pip install -r ../../deterministic-build/requirements-binaries.txt
|
||||
|
||||
# Install PyInstaller
|
||||
$PYTHON -m pip install https://github.com/ecdsa/pyinstaller/archive/fix_2952.zip
|
||||
|
||||
# Install ZBar
|
||||
wget -q -O zbar.exe "$ZBAR_URL"
|
||||
verify_hash zbar.exe $ZBAR_SHA256
|
||||
wine zbar.exe /S
|
||||
|
||||
# install Cryptodome
|
||||
$PYTHON -m pip install pycryptodomex
|
||||
|
||||
# install PySocks
|
||||
$PYTHON -m pip install win_inet_pton
|
||||
|
||||
# install websocket (python2)
|
||||
$PYTHON -m pip install websocket-client
|
||||
|
||||
# Upgrade setuptools (so Electrum can be installed later)
|
||||
$PYTHON -m pip install setuptools --upgrade
|
||||
@@ -106,6 +104,11 @@ wget -q -O nsis.exe "$NSIS_URL"
|
||||
verify_hash nsis.exe $NSIS_SHA256
|
||||
wine nsis.exe /S
|
||||
|
||||
wget -q -O libusb.7z "$LIBUSB_URL"
|
||||
verify_hash libusb.7z "$LIBUSB_SHA256"
|
||||
7z x -olibusb libusb.7z
|
||||
cp libusb/MS32/dll/libusb-1.0.dll $WINEPREFIX/drive_c/python$PYTHON_VERSION/
|
||||
|
||||
# Install UPX
|
||||
#wget -O upx.zip "https://downloads.sourceforge.net/project/upx/upx/3.08/upx308w.zip"
|
||||
#unzip -o upx.zip
|
||||
@@ -114,5 +117,4 @@ wine nsis.exe /S
|
||||
# add dlls needed for pyinstaller:
|
||||
cp $WINEPREFIX/drive_c/python$PYTHON_VERSION/Lib/site-packages/PyQt5/Qt/bin/* $WINEPREFIX/drive_c/python$PYTHON_VERSION/
|
||||
|
||||
|
||||
echo "Wine is configured. Please run prepare-pyinstaller.sh"
|
||||
|
||||
5
contrib/deterministic-build/requirements-binaries.txt
Normal file
5
contrib/deterministic-build/requirements-binaries.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
pycryptodomex==3.4.12
|
||||
PyQt5==5.10
|
||||
sip==4.19.7
|
||||
six==1.11.0
|
||||
websocket-client==0.46.0
|
||||
@@ -6,34 +6,17 @@ contrib=$(dirname "$0")
|
||||
|
||||
which virtualenv > /dev/null 2>&1 || { echo "Please install virtualenv" && exit 1; }
|
||||
|
||||
# standard Electrum dependencies
|
||||
for i in '' '-hw' '-binaries'; do
|
||||
rm "$venv_dir" -rf
|
||||
virtualenv -p $(which python3) $venv_dir
|
||||
|
||||
rm "$venv_dir" -rf
|
||||
virtualenv -p $(which python3) $venv_dir
|
||||
source $venv_dir/bin/activate
|
||||
|
||||
source $venv_dir/bin/activate
|
||||
echo "Installing $i dependencies"
|
||||
|
||||
echo "Installing main dependencies"
|
||||
|
||||
pushd $contrib/..
|
||||
python setup.py install
|
||||
popd
|
||||
|
||||
pip freeze | sed '/^Electrum/ d' > $contrib/deterministic-build/requirements.txt
|
||||
|
||||
|
||||
# hw wallet library dependencies
|
||||
|
||||
rm "$venv_dir" -rf
|
||||
virtualenv -p $(which python3) $venv_dir
|
||||
|
||||
source $venv_dir/bin/activate
|
||||
|
||||
echo "Installing hw wallet dependencies"
|
||||
|
||||
python -m pip install -r $contrib/../requirements-hw.txt --upgrade
|
||||
|
||||
pip freeze | sed '/^Electrum/ d' > $contrib/deterministic-build/requirements-hw.txt
|
||||
python -m pip install -r $contrib/requirements/requirements${i}.txt --upgrade
|
||||
|
||||
pip freeze | sed '/^Electrum/ d' > $contrib/deterministic-build/requirements${i}.txt
|
||||
done
|
||||
|
||||
echo "Done. Updated requirements"
|
||||
|
||||
3
contrib/requirements/requirements-binaries.txt
Normal file
3
contrib/requirements/requirements-binaries.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
PyQt5
|
||||
pycryptodomex
|
||||
websocket-client
|
||||
4
contrib/requirements/requirements-hw.txt
Normal file
4
contrib/requirements/requirements-hw.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
Cython>=0.27
|
||||
trezor>=0.9.0
|
||||
keepkey
|
||||
btchip-python
|
||||
3
contrib/requirements/requirements-travis.txt
Normal file
3
contrib/requirements/requirements-travis.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
tox
|
||||
python-coveralls
|
||||
tox-travis
|
||||
9
contrib/requirements/requirements.txt
Normal file
9
contrib/requirements/requirements.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
pyaes>=0.1a1
|
||||
ecdsa>=0.9
|
||||
pbkdf2
|
||||
requests
|
||||
qrcode
|
||||
protobuf
|
||||
dnspython
|
||||
jsonrpclib-pelix
|
||||
PySocks>=1.6.6
|
||||
Reference in New Issue
Block a user