Improve version management in '_app_upgradable'

This commit is contained in:
Josué Tille 2020-04-15 16:25:35 +02:00
parent 8dd3986cac
commit 4f0d5cef96
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -156,10 +156,18 @@ def app_info(app, full=False):
def _app_upgradable(app_infos):
from packaging import version
# Determine upgradability
# In case there is neither update_time nor install_time, we assume the app can/has to be upgraded
# Firstly use the version to know if an upgrade is available
if app_infos["version"] != "-" and app_infos["from_catalog"]["manifest"].get("version", None):
if version.parse(app_infos["version"]) < version.parse(app_infos["from_catalog"]["manifest"].get("version", "-")):
return "yes"
else:
return "no"
if not app_infos.get("from_catalog", None):
return "url_required"
if not app_infos["from_catalog"].get("lastUpdate") or not app_infos["from_catalog"].get("git"):