Recovered lost code from other libraries
This commit is contained in:
31
bash/init_pyenv.sh
Normal file
31
bash/init_pyenv.sh
Normal file
@@ -0,0 +1,31 @@
|
||||
init_pyenv(){
|
||||
vtuple="(${1//./, })";
|
||||
python3 -c "import sys; exit(sys.version_info <= ($vtuple))";
|
||||
pyvok=$?;
|
||||
|
||||
if [ $pyvok -eq 1 ]; then
|
||||
add-apt-repository -y ppa:deadsnakes/ppa
|
||||
apt-get update
|
||||
apt-get -y install "python$1" "python$1-venv"
|
||||
"python$1" -m venv .env
|
||||
else
|
||||
python3 -m venv .env
|
||||
fi;
|
||||
|
||||
source .env/bin/activate;
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
reqfile="requirements.txt";
|
||||
else
|
||||
reqfile="$2";
|
||||
fi
|
||||
|
||||
if [ -z "$3" ]; then
|
||||
piplog="/dev/null";
|
||||
else
|
||||
piplog="$3";
|
||||
fi
|
||||
|
||||
pip install -r "$reqfile" >> "$piplog";
|
||||
echo "PIP status: $?" >> "$piplog";
|
||||
}
|
||||
Reference in New Issue
Block a user