Browse Source

Parameterise the OSX builder

3.1
Neil Booth 7 years ago
committed by Johann Bauer
parent
commit
cc19de9db3
  1. 23
      contrib/build-osx/make_osx
  2. 35
      contrib/build-osx/osx.spec

23
contrib/build-osx/make_osx

@ -16,7 +16,12 @@ 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"
@ -34,7 +39,7 @@ fail "Unable to use Python $PYTHON_VERSION"
info "Installing pyinstaller"
python3 -m pip install pyinstaller -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 "
@ -43,16 +48,16 @@ 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 "Installing requirements..."
python3 -m pip install -Ir ./contrib/deterministic-build/requirements.txt --user && \
@ -63,11 +68,11 @@ 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"

35
contrib/build-osx/osx.spec

@ -5,6 +5,11 @@ from PyInstaller.utils.hooks import collect_data_files, collect_submodules
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,21 @@ 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')
# 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',
@ -58,7 +63,7 @@ a = Analysis([electrum+'electrum',
# 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 +73,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'
}
)
)

Loading…
Cancel
Save