37 lines
994 B
Bash
Executable File
37 lines
994 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
|
|
BASEPATH=$(pwd -P)
|
|
#
|
|
# Create venv
|
|
#
|
|
if [ ! -e venv ];then
|
|
echo -e "\033[1;33mCreating venv in $BASEPATH...\e[0m"
|
|
python3 -m venv $BASEPATH/venv > /dev/null 2>&1
|
|
else
|
|
echo -e "\033[1;33mVirtualenv already exists in $BASEPATH...\e[0m"
|
|
fi
|
|
echo
|
|
|
|
#
|
|
# Install modules
|
|
#
|
|
echo -e "\033[1;33mInstalling modules to venv in $BASEPATH...\e[0m"
|
|
for req_file in $(find $BASEPATH -name requirements.txt); do
|
|
# echo " $req_file"
|
|
while read req_mod; do
|
|
if [[ $req_mod = *[![:space:]]* ]]; then
|
|
# req_mod is not empty
|
|
OUT=$($BASEPATH/venv/bin/pip install -U $req_mod)
|
|
if [[ $OUT =~ "Successfully installed" ]]; then
|
|
echo " * $req_mod installed."
|
|
elif [[ $OUT =~ "already satisfied" ]]; then
|
|
echo " * $req_mod already installed."
|
|
else
|
|
echo " * $req_mod installation FAILED!"
|
|
echo $OUT
|
|
fi
|
|
fi
|
|
done < $req_file
|
|
done
|
|
echo |