Get version info from installed addon (#3702)

* Get version info from installed addon

* addon.slug not self.slug
This commit is contained in:
Mike Degatano 2022-06-27 16:25:38 -04:00 committed by GitHub
parent bb3b8891bc
commit d685d8539b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,6 +103,12 @@ class APIStore(CoreSysAttributes):
) -> dict[str, Any]: ) -> dict[str, Any]:
"""Generate addon information.""" """Generate addon information."""
installed = (
self.sys_addons.get(addon.slug, local_only=True)
if addon.is_installed
else None
)
data = { data = {
ATTR_ADVANCED: addon.advanced, ATTR_ADVANCED: addon.advanced,
ATTR_ARCH: addon.supported_arch, ATTR_ARCH: addon.supported_arch,
@ -118,10 +124,12 @@ class APIStore(CoreSysAttributes):
ATTR_REPOSITORY: addon.repository, ATTR_REPOSITORY: addon.repository,
ATTR_SLUG: addon.slug, ATTR_SLUG: addon.slug,
ATTR_STAGE: addon.stage, ATTR_STAGE: addon.stage,
ATTR_UPDATE_AVAILABLE: addon.need_update if addon.is_installed else False, ATTR_UPDATE_AVAILABLE: installed.need_update
if addon.is_installed
else False,
ATTR_URL: addon.url, ATTR_URL: addon.url,
ATTR_VERSION_LATEST: addon.latest_version, ATTR_VERSION_LATEST: addon.latest_version,
ATTR_VERSION: addon.version if addon.is_installed else None, ATTR_VERSION: installed.version if addon.is_installed else None,
} }
if extended: if extended:
data.update( data.update(