adaptions for ansible: init_venv + config template to jinja2
This commit is contained in:
parent
1cf5094bfd
commit
6ee34a3ee6
@ -5,10 +5,10 @@ import report
|
|||||||
|
|
||||||
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
__BASEPATH__ = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
MQTT_SERVER = "<mqtt_smarthome_hostname>"
|
MQTT_SERVER = "{{ smart_sat_ambientinfo_hostname }}"
|
||||||
MQTT_USER = "<mqtt_smarthome_username>"
|
MQTT_USER = "{{ smart_sat_ambientinfo_username }}"
|
||||||
MQTT_PASS = "<mqtt_smarthome_password>"
|
MQTT_PASS = "{{ smart_sat_ambientinfo_password }}"
|
||||||
MQTT_TOPIC = "<mqtt_ambient_info_topic>"
|
MQTT_TOPIC = "{{ smart_sat_ambientinfo_topic }}"
|
||||||
|
|
||||||
DAT_PATH_DHT = None # os.path.join(__BASEPATH__, 'dat', 'dht')
|
DAT_PATH_DHT = None # os.path.join(__BASEPATH__, 'dat', 'dht')
|
||||||
DAT_PATH_BMP = None # os.path.join(__BASEPATH__, 'dat', 'bmp')
|
DAT_PATH_BMP = None # os.path.join(__BASEPATH__, 'dat', 'bmp')
|
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