electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

electrum-env (1282B)


      1 #!/usr/bin/env bash
      2 #
      3 # This script creates a virtualenv named 'env' and installs all
      4 # python dependencies before activating the env and running Electrum.
      5 # If 'env' already exists, it is activated and Electrum is started
      6 # without any installations. Additionally, the PYTHONPATH environment
      7 # variable is set so that system packages such as e.g. apt installed
      8 # PyQt5 will also be visible.
      9 #
     10 # By default, only pure python dependencies are installed.
     11 # If you would like more extras to be installed, do e.g.:
     12 # $ source ./env/bin/activate
     13 # $ pip install -e '.[crypto,gui,hardware]'
     14 # $ deactivate
     15 
     16 set -e
     17 
     18 PYTHON_VER="$(python3 -c 'import sys; print(sys.version[:3])')"
     19 
     20 cd $(dirname $0)
     21 if [ -e ./env/bin/activate ]; then
     22     source ./env/bin/activate
     23     # FIXME what if this is an old directory and our requirements
     24     #       changed in the meantime? should run "pip install -e . --upgrade"
     25 else
     26     python3 -m venv env
     27     source ./env/bin/activate
     28     pip install -e .
     29 fi
     30 
     31 export PYTHONPATH="$PYTHONPATH:"\
     32 "/usr/local/lib/python${PYTHON_VER}/site-packages:"\
     33 "/usr/local/lib/python${PYTHON_VER}/dist-packages:"\
     34 "/usr/lib/python3/dist-packages:"\
     35 "/usr/lib/python${PYTHON_VER}/site-packages:"\
     36 "${HOME}/.local/lib/python${PYTHON_VER}/site-packages"
     37 
     38 
     39 ./run_electrum "$@"