-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_venv.sh
executable file
·40 lines (37 loc) · 1.23 KB
/
setup_venv.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
#
# setup_venv.sh is a script to create a virtual environment.
# it will create a virtual environment in env directory and
# install all packages listed in requirements.txt
#
# Usage:
# ./setup_venv.sh
#
ORIGIN=$(dirname "$0")
PATH_gcoin_rpc=$ORIGIN/gcoin-rpc
PATH_pygcointools=$ORIGIN/pygcointools
# check whether venv works
virtualenv_module="venv"
. /etc/os-release
if ([ "$ID" == "rhel" ] || [[ "$ID_LIKE" =~ "rhel" ]]) && [ "$VERSION_ID" == "7" ]; then
if ! python3 -m "$virtualenv_module" $ORIGIN/env; then
rm -r $ORIGIN/env
echo "Install venv failed."
echo "Change to install virtualenv."
if !(command -v pip3 > /dev/null 2>&1); then
echo "pip3 is not installed. We are going to install it."
curl https://bootstrap.pypa.io/get-pip.py | python3 - --user
rm -f ~/.local/bin/easy_install
rm -f ~/.local/bin/pip
rm -f ~/.local/bin/wheel
fi
pip3 install --user virtualenv
virtualenv_module="virtualenv"
python3 -m "$virtualenv_module" $ORIGIN/env
fi
fi
. $ORIGIN/env/bin/activate
# install required packages
pip install -e $PATH_pygcointools
pip install -e $PATH_gcoin_rpc
pip install -r requirements.txt