Fix startup check for broken venv (logic was the wrong way around) (#513)

* I got the logic the wrong way around

* Explicitly use pip3 to avoid certain error scenarios
This commit is contained in:
Daniel Markstedt 2021-12-09 17:45:54 -08:00 committed by GitHub
parent 8f1cc95195
commit 916cf2c72c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 14 deletions

View File

@ -68,9 +68,9 @@ fi
# Test for two known broken venv states
if test -e venv; then
GOOD_VENV=true
test -e venv/bin/activate && GOOD_VENV=false
pip list &> /dev/null
test $? -eq 0 && GOOD_VENV=false
! test -e venv/bin/activate && GOOD_VENV=false
pip3 list &> /dev/null
test $? -eq 1 && GOOD_VENV=false
if ! "$GOOD_VENV"; then
echo "Deleting bad python venv"
sudo rm -rf venv
@ -84,20 +84,20 @@ if ! test -e venv; then
echo "Activating venv"
source venv/bin/activate
echo "Installing requirements.txt"
pip install wheel
CFLAGS="$COMPILER_FLAGS" pip install -r requirements.txt
pip3 install wheel
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
git rev-parse HEAD > current
fi
source venv/bin/activate
# Detect if someone updates - we need to re-run pip install.
# Detect if someone updates - we need to re-run pip3 install.
if ! test -e current; then
git rev-parse > current
else
if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
echo "New version detected, updating requirements.txt"
CFLAGS="$COMPILER_FLAGS" pip install -r requirements.txt
CFLAGS="$COMPILER_FLAGS" pip3 install -r requirements.txt
git rev-parse HEAD > current
fi
fi

View File

@ -34,9 +34,9 @@ fi
# Test for two known broken venv states
if test -e venv; then
GOOD_VENV=true
test -e venv/bin/activate && GOOD_VENV=false
pip list &> /dev/null
test $? -eq 0 && GOOD_VENV=false
! test -e venv/bin/activate && GOOD_VENV=false
pip3 list &> /dev/null
test $? -eq 1 && GOOD_VENV=false
if ! "$GOOD_VENV"; then
echo "Deleting bad python venv"
sudo rm -rf venv
@ -50,20 +50,20 @@ if ! test -e venv; then
echo "Activating venv"
source venv/bin/activate
echo "Installing requirements.txt"
pip install wheel
pip install -r requirements.txt
pip3 install wheel
pip3 install -r requirements.txt
git rev-parse HEAD > current
fi
source venv/bin/activate
# Detect if someone updates - we need to re-run pip install.
# Detect if someone updates - we need to re-run pip3 install.
if ! test -e current; then
git rev-parse > current
else
if [ "$(cat current)" != "$(git rev-parse HEAD)" ]; then
echo "New version detected, updating requirements.txt"
pip install -r requirements.txt
pip3 install -r requirements.txt
git rev-parse HEAD > current
fi
fi