From c4b442c3c88b8b745cf32ea116897621b8d43015 Mon Sep 17 00:00:00 2001 From: pato-pan <131620424+pato-pan@users.noreply.github.com> Date: Wed, 17 Jul 2024 22:46:27 -0400 Subject: [PATCH] Update run.sh pyenv compatibility. Pyenv check was not working as intended, it should be inverted match (with -v). if pyenv exists in the system, it will now install python3.8 and set it as the default for the current folder This should give support to Arch Linux users, among other distros. Review needed, 2 questions: 1. Is it safe to set python3.8 as the default for the current folder? If you don't know and no one can verify, let's assume it is. I think it likely is, but I can't consider for every possibility. 2. Which version of python 3.8 do you prefer? If it's not 3.8.19, it should be changed to the one you wish to have installed (like 3.8.0) --- run.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index f239307..9971503 100755 --- a/run.sh +++ b/run.sh @@ -17,13 +17,17 @@ else requirements_file="requirements.txt" # Check if Python 3.8 is installed - if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -q "3.8"; then + if ! command -v python3.8 >/dev/null 2>&1 || pyenv versions --bare | grep -qv "3.8"; then echo "Python 3 not found. Attempting to install 3.8..." if [ "$(uname)" = "Darwin" ] && command -v brew >/dev/null 2>&1; then brew install python@3.8 elif [ "$(uname)" = "Linux" ] && command -v apt-get >/dev/null 2>&1; then sudo apt-get update sudo apt-get install python3.8 + elif [ "$(uname)" = "Linux" ] && command -v pyenv >/dev/null 2>&1; then + pyenv install 3.8 + pyenv local 3.8 + alias python3.8=python else echo "Please install Python 3.8 manually." exit 1