initvenv improved for ansible
This commit is contained in:
parent
4638d029e5
commit
2cc4356a24
24
init_venv
24
init_venv
@ -2,7 +2,23 @@
|
|||||||
#
|
#
|
||||||
BASEPATH=`realpath $(dirname $0)`
|
BASEPATH=`realpath $(dirname $0)`
|
||||||
|
|
||||||
python3 -m venv $BASEPATH/venv
|
#
|
||||||
$BASEPATH/venv/bin/pip install --upgrade pip
|
# Create venv
|
||||||
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
|
#
|
||||||
$BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U
|
if [[ ! -e $BASEPATH/venv ]]; then
|
||||||
|
python3 -m venv $BASEPATH/venv > /dev/null 2>&1
|
||||||
|
# $BASEPATH/venv/bin/pip install --upgrade pip
|
||||||
|
find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
|
||||||
|
echo "venv changed"
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
# Update venv modules
|
||||||
|
#
|
||||||
|
for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
|
||||||
|
$BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
|
||||||
|
if [[ "$?" -eq "0" ]]; then
|
||||||
|
echo $req_mod changed
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
#|xargs -n1 $BASEPATH/venv/bin/pip install -U
|
||||||
|
Loading…
x
Reference in New Issue
Block a user