diff --git a/README.rst b/README.rst index d258297b..a90db075 100644 --- a/README.rst +++ b/README.rst @@ -56,34 +56,21 @@ For Mac: Using Homebrew:: - # Install Homebrew - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + # Setup Homebrew + sh ./setup-mac.sh - # (Optionally) - sudo chown -R "$USER":admin /usr/local - sudo chown -R "$USER":admin /Library/Caches/Homebrew - - # Install python3 - brew install python3 - brew link python3 - brew postinstall python3 - - # Python setuptools - curl https://bootstrap.pypa.io/ez_setup.py -o - | python3 - - # Install pyqt5 - pip3 install pyqt5 - - # Install Protobuf - brew install protobuf - - # Setup - python3 setup.py install + # Install Homebrew dependencies + brew bundle + # Install Python dependencies + pip3 install -r requirements.txt # Build icons pyrcc5 icons.qrc -o gui/qt/icons_rc.py + # Compile the protobuf description file + protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto + # Run ./electrum @@ -98,20 +85,12 @@ For Linux: Install Dependencies:: - sudo apt-get install python3-pip python3-setuptools python3-dev python3-pyqt5 - sudo pip2 install pyblake2 - pip3 install pyqt5 - python3 setup.py install + sudo apt-get install $(grep -vE "^\s*#" packages.txt | tr "\n" " ") - # OPTIONAL: Install without sudo - - # If you do not have a dir located at /usr/local/lib/python3.6/site-packages/ - # you will need to create this before running the install. - - mkdir /usr/local/lib/python3.6/site-packages/ + pip install -r requirement.txt Compile the icons file for Qt:: - sudo apt-get install pyqt5-dev-tools pyrcc5 icons.qrc -o gui/qt/icons_rc.py For the Linux app launcher (start menu) icon:: @@ -120,12 +99,9 @@ For the Linux app launcher (start menu) icon:: Compile the protobuf description file:: - sudo apt-get install protobuf-compiler protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto Create translations (optional):: - - sudo apt-get install python-requests gettext ./contrib/make_locale Run:: @@ -194,4 +170,3 @@ Also be sure to check out::: --- The Zclassic Team - diff --git a/brewfile b/brewfile new file mode 100644 index 00000000..7e98cb87 --- /dev/null +++ b/brewfile @@ -0,0 +1,10 @@ +tap "caskroom/cask" +brew "python3" +brew "protobuf" +# brew "zbar" - +brew "gmp" +# required by gmpy +brew "gettext" +tap "brewsci/science" +brew "matplotlib" +# required for matplotlib used in Plot History diff --git a/contrib/make_osx b/contrib/make_osx deleted file mode 100755 index f354e331..00000000 --- a/contrib/make_osx +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -rm -rf dist -export PYTHONHASHSEED=22 -VERSION=`git describe --tags` -pyinstaller --noconfirm --ascii --name $VERSION contrib/osx.spec -hdiutil create -fs HFS+ -volname "Electrum" -srcfolder dist/Electrum.app dist/electrum-$VERSION.dmg diff --git a/contrib/osx.spec b/contrib/osx.spec deleted file mode 100644 index cb7e5a6e..00000000 --- a/contrib/osx.spec +++ /dev/null @@ -1,84 +0,0 @@ -# -*- mode: python -*- - -from PyInstaller.utils.hooks import collect_data_files, collect_submodules - -import sys -for i, x in enumerate(sys.argv): - if x == '--name': - VERSION = sys.argv[i+1] - break -else: - raise BaseException('no version') -import os -home = os.getcwd() + '/' -block_cipher=None - -# see https://github.com/pyinstaller/pyinstaller/issues/2005 -hiddenimports = [] -hiddenimports += collect_submodules('trezorlib') -hiddenimports += collect_submodules('btchip') -hiddenimports += collect_submodules('keepkeylib') - -datas = [ - (home+'lib/currencies.json', 'electrum'), - (home+'lib/servers.json', 'electrum'), - (home+'lib/checkpoints.json', 'electrum'), - (home+'lib/servers_testnet.json', 'electrum'), - (home+'lib/checkpoints_testnet.json', 'electrum'), - (home+'lib/wordlist/english.txt', 'electrum/wordlist'), - (home+'lib/locale', 'electrum/locale'), - (home+'plugins', 'electrum_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([home+'electrum', - home+'gui/qt/main_window.py', - home+'gui/text.py', - home+'lib/util.py', - home+'lib/wallet.py', - home+'lib/simple_config.py', - home+'lib/bitcoin.py', - home+'lib/dnssec.py', - home+'lib/commands.py', - home+'plugins/cosigner_pool/qt.py', - home+'plugins/email_requests/qt.py', - home+'plugins/trezor/client.py', - home+'plugins/trezor/qt.py', - home+'plugins/keepkey/qt.py', - home+'plugins/ledger/qt.py', - ], - 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]: - a.datas.remove(d) - break - -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) - -exe = EXE(pyz, - a.scripts, - a.binaries, - a.datas, - name='Electrum', - debug=False, - strip=False, - upx=True, - icon=home+'electrum.icns', - console=False) - -app = BUNDLE(exe, - version = VERSION, - name='Electrum.app', - icon=home+'electrum.icns', - bundle_identifier=None, - info_plist = { - 'NSHighResolutionCapable':'True' - } -) diff --git a/install-mac.sh b/create-dmg.sh similarity index 60% rename from install-mac.sh rename to create-dmg.sh index dfc2d7b1..226c299e 100644 --- a/install-mac.sh +++ b/create-dmg.sh @@ -7,9 +7,28 @@ VERSION=$(cat lib/version.py \ VERSION=${VERSION//ELECTRUM_VERSION=/} echo "Creating package $VERSION" +echo "brew install" +brew bundle + +echo "pip install" +pip3 install -r requirements.txt + +echo "building icons" +pyrcc5 icons.qrc -o gui/qt/icons_rc.py + +echo "Compile the protobuf description file" +protoc --proto_path=lib/ --python_out=lib/ lib/paymentrequest.proto + +echo "compiling translations" +./config/make_locale + +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!" diff --git a/electrum.icns b/electrum.icns deleted file mode 100644 index 977b124d..00000000 Binary files a/electrum.icns and /dev/null differ diff --git a/icons/electrum.icns b/icons/electrum.icns new file mode 100644 index 00000000..62c3fc55 Binary files /dev/null and b/icons/electrum.icns differ diff --git a/packages.txt b/packages.txt new file mode 100644 index 00000000..e94cbc17 --- /dev/null +++ b/packages.txt @@ -0,0 +1,10 @@ +python3-pip +python3-setuptools +python3-dev +python3-pyqt5 +protobuf-compiler +python-requests +gettext +wine-development +dirmngr +gnupg2 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..d34ef7b8 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,21 @@ +certifi +chardet==3.0.4 +dnspython==1.15.0 +ecdsa==0.13 +idna==2.6 +jsonrpclib-pelix==0.3.1 +pbkdf2==1.3 +protobuf==3.5.0.post1 +pyaes==1.6.1 +PySocks==1.6.7 +qrcode==5.3 +requests==2.18.4 +six==1.11.0 +urllib3==1.22 +cython +pyqt5 +trezor +keepkey +configparser +btchip-python==0.1.23 +pillow diff --git a/setup-mac.sh b/setup-mac.sh index ee59e364..7d173459 100755 --- a/setup-mac.sh +++ b/setup-mac.sh @@ -4,22 +4,12 @@ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - # Optionally (this is bad practice but works if you're stuck) sudo chown -R "$USER":admin /usr/local 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 -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 diff --git a/setup-release.py b/setup-release.py index cd0d28cc..c83c0f29 100644 --- a/setup-release.py +++ b/setup-release.py @@ -19,7 +19,7 @@ name = "Electrum" mainscript = 'electrum' plist = Plist.fromFile('Info.plist') -plist.update(dict(CFBundleIconFile='electrum.icns')) +plist.update(dict(CFBundleIconFile='icons/electrum.icns')) os.environ["REQUESTS_CA_BUNDLE"] = "cacert.pem" @@ -56,7 +56,7 @@ extra_options = dict( options=dict(py2app=dict(argv_emulation=False, includes=['sip'], packages=['lib', 'gui', 'plugins'], - iconfile='electrum.icns', + iconfile='icons/electrum.icns', plist=plist, resources=["icons"])), ) diff --git a/setup.py b/setup.py index 85fdba83..af9cbf66 100755 --- a/setup.py +++ b/setup.py @@ -11,6 +11,22 @@ import argparse version = imp.load_source('version', 'lib/version.py') + +def readhere(path): + here = os.path.abspath(os.path.dirname(__file__)) + with open(os.path.join(here, path), 'r') as fd: + return fd.read() + + +def readreqs(path): + return [req for req in + [line.strip() for line in readhere(path).split('\n')] + if req and not req.startswith(('#', '-r'))] + + +install_requires = readreqs('requirements.txt') +tests_requires = install_requires + readreqs('requirements_travis.txt') + if sys.version_info[:3] < (3, 4, 0): sys.exit("Error: Electrum requires Python version >= 3.4.0...") @@ -35,19 +51,8 @@ if platform.system() in ['Linux', 'FreeBSD', 'DragonFly']: setup( name="Electrum-ZCL", version=version.ELECTRUM_VERSION, - install_requires=[ - 'pyaes>=0.1a1', - 'ecdsa>=0.9', - 'pbkdf2', - 'requests', - 'qrcode', - 'protobuf', - 'dnspython', - 'jsonrpclib-pelix', - 'pyblake2', - 'PySocks>=1.6.6', - 'PyQt5', - ], + install_requires=install_requires, + tests_require=tests_requires, packages=[ 'electrum', 'electrum_gui',