added support for building macOS
This commit is contained in:
parent
ff1172134e
commit
d3d5fdf687
|
@ -5,6 +5,8 @@ build/
|
|||
dist/
|
||||
*.egg/
|
||||
/electrum.py
|
||||
/electrum-mac.py
|
||||
.DS_Store
|
||||
contrib/pyinstaller/
|
||||
Electrum.egg-info/
|
||||
gui/qt/icons_rc.py
|
||||
|
|
10
README.rst
10
README.rst
|
@ -160,13 +160,8 @@ Mac OS X / macOS
|
|||
|
||||
::
|
||||
|
||||
# On MacPorts installs:
|
||||
sudo python3 setup-release.py py2app
|
||||
|
||||
# On Homebrew installs:
|
||||
ARCHFLAGS="-arch i386 -arch x86_64" sudo python3 setup-release.py py2app --includes sip
|
||||
|
||||
sudo hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-VERSION-macosx.dmg
|
||||
sh ./setup-mac.sh
|
||||
sudo sh ./install-mac.sh
|
||||
|
||||
Windows
|
||||
-------
|
||||
|
@ -178,4 +173,3 @@ Android
|
|||
-------
|
||||
|
||||
See `gui/kivy/Readme.txt` file.
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ for i, x in enumerate(sys.argv):
|
|||
break
|
||||
else:
|
||||
raise BaseException('no version')
|
||||
|
||||
home = '/Users/voegtlin/electrum/'
|
||||
import os
|
||||
home = os.getcwd() + '/'
|
||||
block_cipher=None
|
||||
|
||||
# see https://github.com/pyinstaller/pyinstaller/issues/2005
|
||||
|
@ -82,4 +82,3 @@ app = BUNDLE(exe,
|
|||
'NSHighResolutionCapable':'True'
|
||||
}
|
||||
)
|
||||
|
||||
|
|
7
electrum
7
electrum
|
@ -45,6 +45,7 @@ script_dir = os.path.dirname(os.path.realpath(__file__))
|
|||
is_bundle = getattr(sys, 'frozen', False)
|
||||
is_local = not is_bundle and os.path.exists(os.path.join(script_dir, "electrum.desktop"))
|
||||
is_android = 'ANDROID_DATA' in os.environ
|
||||
is_macOS = sys.platform == 'darwin'
|
||||
|
||||
# move this back to gui/kivy/__init.py once plugins are moved
|
||||
os.environ['KIVY_DATA_DIR'] = os.path.abspath(os.path.dirname(__file__)) + '/gui/kivy/data/'
|
||||
|
@ -73,6 +74,8 @@ def check_imports():
|
|||
from google.protobuf import descriptor_pb2
|
||||
from jsonrpclib import SimpleJSONRPCServer
|
||||
# make sure that certificates are here
|
||||
if not is_macOS:
|
||||
# cannot check if path exists inside zip on macOS
|
||||
assert os.path.exists(requests.utils.DEFAULT_CA_BUNDLE_PATH)
|
||||
|
||||
|
||||
|
@ -80,7 +83,7 @@ if not is_android:
|
|||
check_imports()
|
||||
|
||||
# load local module as electrum
|
||||
if is_local or is_android:
|
||||
if is_local or is_android or is_macOS:
|
||||
import imp
|
||||
imp.load_module('electrum', *imp.find_module('lib'))
|
||||
imp.load_module('electrum_gui', *imp.find_module('gui'))
|
||||
|
@ -339,7 +342,7 @@ if __name__ == '__main__':
|
|||
config_options['cwd'] = os.getcwd()
|
||||
|
||||
# fixme: this can probably be achieved with a runtime hook (pyinstaller)
|
||||
if is_bundle and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')):
|
||||
if is_bundle and hasattr(sys, '_MEIPASS') and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')):
|
||||
config_options['portable'] = True
|
||||
|
||||
if config_options.get('portable'):
|
||||
|
|
|
@ -45,6 +45,7 @@ script_dir = os.path.dirname(os.path.realpath(__file__))
|
|||
is_bundle = getattr(sys, 'frozen', False)
|
||||
is_local = not is_bundle and os.path.exists(os.path.join(script_dir, "electrum.desktop"))
|
||||
is_android = 'ANDROID_DATA' in os.environ
|
||||
is_macOS = sys.platform == 'darwin'
|
||||
|
||||
# move this back to gui/kivy/__init.py once plugins are moved
|
||||
os.environ['KIVY_DATA_DIR'] = os.path.abspath(os.path.dirname(__file__)) + '/gui/kivy/data/'
|
||||
|
@ -73,6 +74,8 @@ def check_imports():
|
|||
from google.protobuf import descriptor_pb2
|
||||
from jsonrpclib import SimpleJSONRPCServer
|
||||
# make sure that certificates are here
|
||||
if not is_macOS:
|
||||
# cannot check if path exists inside zip on macOS
|
||||
assert os.path.exists(requests.utils.DEFAULT_CA_BUNDLE_PATH)
|
||||
|
||||
|
||||
|
@ -80,7 +83,7 @@ if not is_android:
|
|||
check_imports()
|
||||
|
||||
# load local module as electrum
|
||||
if is_local or is_android:
|
||||
if is_local or is_android or is_macOS:
|
||||
import imp
|
||||
imp.load_module('electrum', *imp.find_module('lib'))
|
||||
imp.load_module('electrum_gui', *imp.find_module('gui'))
|
||||
|
@ -339,7 +342,7 @@ if __name__ == '__main__':
|
|||
config_options['cwd'] = os.getcwd()
|
||||
|
||||
# fixme: this can probably be achieved with a runtime hook (pyinstaller)
|
||||
if is_bundle and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')):
|
||||
if is_bundle and hasattr(sys, '_MEIPASS') and os.path.exists(os.path.join(sys._MEIPASS, 'is_portable')):
|
||||
config_options['portable'] = True
|
||||
|
||||
if config_options.get('portable'):
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
sudo sh ./clean.sh
|
||||
VERSION=$(cat lib/version.py \
|
||||
| grep ELECTRUM_VERSION \
|
||||
| sed "s/[',]//g" \
|
||||
| tr -d '[[:space:]]')
|
||||
VERSION=${VERSION//ELECTRUM_VERSION=/}
|
||||
echo "Creating package $VERSION"
|
||||
|
||||
sudo python3 setup.py sdist
|
||||
echo "Creating python app using py2app"
|
||||
sudo ARCHFLAGS="-arch i386 -arch x86_64" sudo python3 setup-release.py py2app --includes sip
|
||||
echo "Creating python Electrum.app and .dmg"
|
||||
sudo hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-$VERSION-macosx.dmg
|
||||
echo "Done!"
|
|
@ -1,5 +1,7 @@
|
|||
ELECTRUM_VERSION = '3.0.5.1' # version of the client package
|
||||
PROTOCOL_VERSION = '1.1' # protocol version requested
|
||||
# version of the client package
|
||||
ELECTRUM_VERSION = '3.0.5.1'
|
||||
# protocol version requested
|
||||
PROTOCOL_VERSION = '1.1'
|
||||
|
||||
# The hash of the mnemonic seed must begin with this
|
||||
SEED_PREFIX = '01' # Standard wallet
|
||||
|
|
|
@ -12,6 +12,7 @@ sudo chown -R "$USER":admin /Library/Caches/Homebrew
|
|||
brew install python3
|
||||
brew link python3
|
||||
brew postinstall python3
|
||||
brew install protobuf
|
||||
|
||||
# Python setuptools
|
||||
curl https://bootstrap.pypa.io/ez_setup.py -o - | python3
|
||||
|
@ -20,3 +21,5 @@ pip3 install pyqt5
|
|||
|
||||
# Setup
|
||||
python3 setup.py install
|
||||
pyrcc5 icons.qrc -o gui/qt/icons_rc.py icons.qrc -o gui/qt/icons_rc.py
|
||||
protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
"""
|
||||
py2app build script for Electrum Bitcoin Private
|
||||
|
||||
Usage (Mac OS X):
|
||||
python setup.py py2app
|
||||
"""
|
||||
|
||||
from setuptools import setup
|
||||
from plistlib import Plist
|
||||
import requests
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from lib.version import ELECTRUM_VERSION as version
|
||||
|
||||
|
||||
name = "Electrum"
|
||||
mainscript = 'electrum-mac'
|
||||
|
||||
plist = Plist.fromFile('Info.plist')
|
||||
plist.update(dict(CFBundleIconFile='electrum.icns'))
|
||||
|
||||
|
||||
CERT_PATH = requests.certs.where()
|
||||
|
||||
shutil.copy(mainscript, mainscript + '.py')
|
||||
mainscript += '.py'
|
||||
extra_options = dict(
|
||||
setup_requires=['py2app'],
|
||||
app=[mainscript],
|
||||
packages=[
|
||||
'electrum',
|
||||
'electrum_gui',
|
||||
'electrum_gui.qt',
|
||||
'electrum_plugins',
|
||||
'electrum_plugins.audio_modem',
|
||||
'electrum_plugins.cosigner_pool',
|
||||
'electrum_plugins.email_requests',
|
||||
'electrum_plugins.greenaddress_instant',
|
||||
'electrum_plugins.hw_wallet',
|
||||
'electrum_plugins.keepkey',
|
||||
'electrum_plugins.labels',
|
||||
'electrum_plugins.ledger',
|
||||
'electrum_plugins.trezor',
|
||||
'electrum_plugins.digitalbitbox',
|
||||
'electrum_plugins.trustedcoin',
|
||||
'electrum_plugins.virtualkeyboard',
|
||||
|
||||
],
|
||||
package_dir={
|
||||
'electrum': 'lib',
|
||||
'electrum_gui': 'gui',
|
||||
'electrum_plugins': 'plugins'
|
||||
},
|
||||
data_files=[CERT_PATH],
|
||||
options=dict(py2app=dict(argv_emulation=False,
|
||||
includes=['sip'],
|
||||
packages=['lib', 'gui', 'plugins'],
|
||||
iconfile='electrum.icns',
|
||||
plist=plist,
|
||||
resources=["icons"])),
|
||||
)
|
||||
|
||||
setup(
|
||||
name=name,
|
||||
version=version,
|
||||
**extra_options
|
||||
)
|
||||
|
||||
# Remove the copied py file
|
||||
os.remove(mainscript)
|
Loading…
Reference in New Issue