|
@@ -1,8 +1,24 @@
|
1
|
|
-#!/bin/sh
|
|
1
|
+#!/bin/bash
|
2
|
2
|
#
|
3
|
3
|
BASEPATH=`realpath $(dirname $0)`
|
4
|
4
|
|
5
|
|
-python3 -m venv $BASEPATH/venv
|
6
|
|
-$BASEPATH/venv/bin/pip install --upgrade pip
|
7
|
|
-find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r
|
8
|
|
-$BASEPATH/venv/bin/pip list --outdated --format=json | jq -r '.[] | .name'|xargs -n1 $BASEPATH/venv/bin/pip install -U
|
|
5
|
+#
|
|
6
|
+# Create venv
|
|
7
|
+#
|
|
8
|
+if [[ ! -e $BASEPATH/venv ]]; then
|
|
9
|
+ python3 -m venv $BASEPATH/venv > /dev/null 2>&1
|
|
10
|
+ # $BASEPATH/venv/bin/pip install --upgrade pip
|
|
11
|
+ find $BASEPATH -name requirements.txt | xargs -L 1 $BASEPATH/venv/bin/pip install -r > /dev/null 2>&1
|
|
12
|
+ echo "venv changed"
|
|
13
|
+fi
|
|
14
|
+#
|
|
15
|
+# Update venv modules
|
|
16
|
+#
|
|
17
|
+for req_mod in $($BASEPATH/venv/bin/pip list --format=json | jq -r '.[] | .name'); do
|
|
18
|
+ $BASEPATH/venv/bin/pip install -U $req_mod | grep install > /dev/null 2>&1
|
|
19
|
+ if [[ "$?" -eq "0" ]]; then
|
|
20
|
+ echo $req_mod changed
|
|
21
|
+ fi
|
|
22
|
+
|
|
23
|
+done
|
|
24
|
+#|xargs -n1 $BASEPATH/venv/bin/pip install -U
|