mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Improve version management in '_app_upgradable'
This commit is contained in:
parent
8dd3986cac
commit
4f0d5cef96
1 changed files with 8 additions and 0 deletions
|
@ -156,10 +156,18 @@ def app_info(app, full=False):
|
||||||
|
|
||||||
|
|
||||||
def _app_upgradable(app_infos):
|
def _app_upgradable(app_infos):
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
# Determine upgradability
|
# Determine upgradability
|
||||||
# In case there is neither update_time nor install_time, we assume the app can/has to be upgraded
|
# 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):
|
if not app_infos.get("from_catalog", None):
|
||||||
return "url_required"
|
return "url_required"
|
||||||
if not app_infos["from_catalog"].get("lastUpdate") or not app_infos["from_catalog"].get("git"):
|
if not app_infos["from_catalog"].get("lastUpdate") or not app_infos["from_catalog"].get("git"):
|
||||||
|
|
Loading…
Add table
Reference in a new issue