-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check Python version before proceeding (<=3.8)
- Loading branch information
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,32 @@ | ||
#!/bin/bash | ||
MIN_PYTHON_VER=3.8 | ||
|
||
source scripts/vercomp.sh | ||
|
||
cd app/ 2>/dev/null || true | ||
|
||
version=$(python -V 2>&1 | grep -Po '(?<=Python )(.+)') | ||
if [[ -z "$version" ]] | ||
then | ||
echo "No Python detected" | ||
exit 1 | ||
fi | ||
|
||
echo "Detected python version: $version." | ||
|
||
vercomp "$version" $MIN_PYTHON_VER # Return codes: 0 is equal, 1 is greater, 2 is less | ||
|
||
COMPARISON_CODE=$? | ||
if [ $COMPARISON_CODE -eq 2 ]; | ||
then | ||
echo "Current Python versions is less than required ($MIN_PYTHON_VER)." | ||
echo "Please upgrade your python version." | ||
exit 1 | ||
fi | ||
|
||
echo "Creating virtual environment in: $(pwd)" | ||
python3 -m pip install --user virtualenv | ||
virtualenv venv --python=python3 | ||
source venv/bin/activate | ||
pip install -r requirements.txt | ||
echo "If running locally, try sudo -E venv/bin/python3 src/main.py recipes log.txt" | ||
echo "If running locally, try: sudo -E venv/bin/python3 src/main.py recipes log.txt" |