Merge pull request #2113 from freqtrade/improve_setup.sh

Improve setup.sh
This commit is contained in:
Matthias 2019-08-08 11:14:51 +02:00 committed by GitHub
commit 02b2de5c73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,12 @@ function check_installed_pip() {
# Check which python version is installed # Check which python version is installed
function check_installed_python() { function check_installed_python() {
if [ -n "${VIRTUAL_ENV}" ]; then
echo "Please deactivate your virtual environment before running setup.sh."
echo "You can do this by running 'deactivate'."
exit 2
fi
which python3.7 which python3.7
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "using Python 3.7" echo "using Python 3.7"
@ -37,17 +43,19 @@ function updateenv() {
echo "-------------------------" echo "-------------------------"
echo "Updating your virtual env" echo "Updating your virtual env"
echo "-------------------------" echo "-------------------------"
if [ ! -f .env/bin/activate ]; then
echo "Something went wrong, no virtual environment found."
exit 1
fi
source .env/bin/activate source .env/bin/activate
echo "pip install in-progress. Please wait..." echo "pip install in-progress. Please wait..."
# Install numpy first to have py_find_1st install clean ${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install --upgrade pip numpy
${PYTHON} -m pip install --upgrade -r requirements.txt
read -p "Do you want to install dependencies for dev [y/N]? " read -p "Do you want to install dependencies for dev [y/N]? "
if [[ $REPLY =~ ^[Yy]$ ]] if [[ $REPLY =~ ^[Yy]$ ]]
then then
${PYTHON} -m pip install --upgrade -r requirements-dev.txt ${PYTHON} -m pip install --upgrade -r requirements-dev.txt
else else
${PYTHON} -m pip install --upgrade -r requirements.txt
echo "Dev dependencies ignored." echo "Dev dependencies ignored."
fi fi
@ -70,6 +78,10 @@ function install_talib() {
./configure --prefix=/usr/local ./configure --prefix=/usr/local
make make
sudo make install sudo make install
if [ -x "$(command -v apt-get)" ]; then
echo "Updating library path using ldconfig"
sudo ldconfig
fi
cd .. && rm -rf ./ta-lib/ cd .. && rm -rf ./ta-lib/
cd .. cd ..
} }
@ -90,7 +102,7 @@ function install_macos() {
# Install bot Debian_ubuntu # Install bot Debian_ubuntu
function install_debian() { function install_debian() {
sudo apt-get update sudo apt-get update
sudo apt-get install build-essential autoconf libtool pkg-config make wget git sudo apt-get install -y build-essential autoconf libtool pkg-config make wget git
install_talib install_talib
} }
@ -105,12 +117,12 @@ function reset() {
echo "----------------------------" echo "----------------------------"
echo "Reseting branch and virtual env" echo "Reseting branch and virtual env"
echo "----------------------------" echo "----------------------------"
if [ "1" == $(git branch -vv |grep -cE "\* develop|\* master") ] if [ "1" == $(git branch -vv |grep -cE "\* develop|\* master") ]
then then
if [ -d ".env" ]; then
echo "- Delete your previous virtual env" read -p "Reset git branch? (This will remove all changes you made!) [y/N]? "
rm -rf .env if [[ $REPLY =~ ^[Yy]$ ]]; then
fi
git fetch -a git fetch -a
@ -123,12 +135,21 @@ function reset() {
echo "- Hard resetting of 'master' branch." echo "- Hard resetting of 'master' branch."
git reset --hard origin/master git reset --hard origin/master
fi fi
fi
else else
echo "Reset ignored because you are not on 'master' or 'develop'." echo "Reset ignored because you are not on 'master' or 'develop'."
fi fi
if [ -d ".env" ]; then
echo "- Delete your previous virtual env"
rm -rf .env
fi
echo echo
${PYTHON} -m venv .env ${PYTHON} -m venv .env
if [ $? -ne 0 ]; then
echo "Could not create virtual environment. Leaving now"
exit 1
fi
updateenv updateenv
} }