Skip to content

Commit

Permalink
scripts: Test if venv is already activated
Browse files Browse the repository at this point in the history
  • Loading branch information
silopolis committed Dec 28, 2023
1 parent 2779d29 commit 8e74e78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ echo "-- Shell: Source profile in case it's been updated"
# shellcheck source="$HOME/.profile" disable=SC1091
source "$HOME/.profile"

echo "-- Activate Python virtual environment"
# shellcheck source="../.venv/bin/activate"
source .venv/bin/activate
if [[ ! $(pip -V) =~ .*\.venv.* ]]; then
echo "-- Python: Activate '.venv' virtual environment"
# shellcheck source="../.venv/bin/activate" disable=SC1091
source .venv/bin/activate
fi

echo "-- Install project Python requirements in venv"
pip install -r requirements.txt
Expand Down
8 changes: 5 additions & 3 deletions scripts/python_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ if [ ! -d .venv ]; then
python3 -m venv .venv
fi

echo "-- Python: Activate '.venv' virtual environment"
# shellcheck source="../.venv/bin/activate"
source .venv/bin/activate
if [[ ! $(pip -V) =~ .*\.venv.* ]]; then
echo "-- Python: Activate '.venv' virtual environment"
# shellcheck source="../.venv/bin/activate" disable=SC1091
source .venv/bin/activate
fi

echo "-- Upgrage Python pip and setuptools in venv"
pip install --upgrade setuptools pip
Expand Down

0 comments on commit 8e74e78

Please sign in to comment.