1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00

Improve updater

This commit is contained in:
ewilly 2023-03-15 21:31:06 +01:00
parent 5c83d5ab55
commit 6c283e63d1
2 changed files with 13 additions and 5 deletions

View file

@ -47,6 +47,15 @@ fi
# Replace new version in _common.sh # Replace new version in _common.sh
sed -i "s/^app_version=.*/app_version=$upstream_version/" scripts/_common.sh sed -i "s/^app_version=.*/app_version=$upstream_version/" scripts/_common.sh
# Replace python required version
py_required_major=$(curl -Ls https://pypi.org/pypi/$app/json | jq -r .info.requires_python | cut -d '=' -f 2 | rev | cut -d"." -f2- | rev)
py_required_minor=$(curl -s "https://www.python.org/ftp/python/" | grep ">$py_required_major" | cut -d '/' -f 2 | cut -d '>' -f 2 | sort -rV | head -n 1)
sed -i "s/^py_required_version=.*/py_required_version=$py_required_minor/" scripts/_common.sh
# Replace pip required version
pip_required=$(curl -Ls https://pypi.org/pypi/$app/json | jq -r .info.requires_dist[] | grep "pip") #"pip (<23.1,>=21.0)"
sed -i "s/^pip_required=.*/pip_required=$pip_required/" scripts/_common.sh
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================

View file

@ -7,10 +7,9 @@
# Release to install # Release to install
app_version=2023.3.1 app_version=2023.3.1
# Requirements (Major.Minor.Patch) # Requirements
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.9" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
# Pyhton 3.9.2 will be shiped with bullseye
py_required_version=3.10.9 py_required_version=3.10.9
pip_required=""
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
@ -125,7 +124,7 @@ myynh_install_homeassistant () {
ynh_exec_as $app "$install_dir/bin/python3" -m ensurepip ynh_exec_as $app "$install_dir/bin/python3" -m ensurepip
# install last version of pip # install last version of pip
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade pip ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade "$pip_required"
# install last version of wheel # install last version of wheel
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade wheel ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade wheel
@ -137,7 +136,7 @@ myynh_install_homeassistant () {
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade mysqlclient ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade mysqlclient
# install Home Assistant # install Home Assistant
ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade $app==$app_version ynh_exec_as $app "$install_dir/bin/pip3" --cache-dir "$data_dir/.cache" install --upgrade "$app==$app_version"
) )
} }