# Install dependencies with Pip.
puts-step "Installing dependencies with pip"

[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first

set +e
/app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --allow-all-external --disable-pip-version-check --no-cache-dir | cleanup | log-output | indent
PIP_STATUS="$?"
set -e

echo "$PIP_STATUS"

if [[ ! $PIP_STATUS -eq 0 ]]; then
    echo "an error occurred."
    show-warnings
    exit 1
fi

exit 1

# Smart Requirements handling
cp requirements.txt .heroku/python/requirements-declared.txt
/app/.heroku/python/bin/pip freeze > .heroku/python/requirements-installed.txt

[ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install
[ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first

echo