Roll HACS to 1.31.0

This commit is contained in:
root
2023-03-04 12:15:50 -08:00
parent 39fb3ccd1d
commit 8056390e49
8 changed files with 86 additions and 32 deletions

View File

@@ -457,7 +457,9 @@ class HacsBase:
try:
await self.hass.async_add_executor_job(_write_file)
except BaseException as error: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as error:
self.log.error("Could not write data to %s - %s", file_path, error)
return False
@@ -476,7 +478,9 @@ class HacsBase:
f"{reset.hour}:{reset.minute}:{reset.second}",
)
self.disable_hacs(HacsDisabledReason.RATE_LIMIT)
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.log.exception(exception)
return 0
@@ -515,7 +519,9 @@ class HacsBase:
raise exception
except GitHubException as exception:
_exception = exception
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.log.exception(exception)
_exception = exception
@@ -726,7 +732,9 @@ class HacsBase:
await asyncio.sleep(1)
continue
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.log.exception("Download failed - %s", exception)
return None
@@ -742,7 +750,9 @@ class HacsBase:
entry=self.configuration.config_entry,
platforms=platforms,
)
self.hass.config_entries.async_setup_platforms(self.configuration.config_entry, platforms)
await self.hass.config_entries.async_forward_entry_setups(
self.configuration.config_entry, platforms
)
@callback
def async_dispatch(self, signal: HacsDispatchEvent, data: dict | None = None) -> None:
@@ -764,6 +774,17 @@ class HacsBase:
if self.configuration.appdaemon:
self.enable_hacs_category(HacsCategory.APPDAEMON)
if self.configuration.netdaemon:
downloaded_netdaemon = [
x
for x in self.repositories.list_downloaded
if x.data.category == HacsCategory.NETDAEMON
]
if len(downloaded_netdaemon) != 0:
self.log.warning(
"NetDaemon in HACS is deprectaded. It will stop working in the future. "
"Please remove all your current NetDaemon repositories from HACS "
"and download them manually if you want to continue using them."
)
self.enable_hacs_category(HacsCategory.NETDAEMON)
async def async_load_hacs_from_github(self, _=None) -> None:
@@ -849,6 +870,15 @@ class HacsBase:
repository.repository_manifest.update_data(
{**dict(HACS_MANIFEST_KEYS_TO_EXPORT), **manifest}
)
self.async_dispatch(
HacsDispatchEvent.REPOSITORY,
{
"id": 1337,
"action": "update",
"repository": repository.data.full_name,
"repository_id": repository.data.id,
},
)
if category == "integration":
self.status.inital_fetch_done = True

View File

@@ -1,4 +1,6 @@
{
"domain": "hacs",
"name": "HACS",
"codeowners": [
"@ludeeus"
],
@@ -12,12 +14,10 @@
"repairs"
],
"documentation": "https://hacs.xyz/docs/configuration/start",
"domain": "hacs",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/hacs/integration/issues",
"name": "HACS",
"requirements": [
"aiogithubapi>=22.10.1"
],
"version": "1.30.1"
"version": "1.31.0"
}

View File

@@ -102,6 +102,7 @@ REPOSITORY_KEYS_TO_EXPORT = (
("description", ""),
("downloads", 0),
("domain", None),
("etag_releases", None),
("etag_repository", None),
("full_name", ""),
("last_commit", None),
@@ -143,6 +144,7 @@ class RepositoryData:
domain: str = None
downloads: int = 0
etag_repository: str = None
etag_releases: str = None
file_name: str = ""
first_install: bool = False
full_name: str = ""
@@ -505,14 +507,18 @@ class HacsRepository:
self.data.description = self.data.description
@concurrent(concurrenttasks=10, backoff_time=5)
async def common_update(self, ignore_issues=False, force=False) -> bool:
async def common_update(self, ignore_issues=False, force=False, skip_releases=False) -> bool:
"""Common information update steps of the repository."""
self.logger.debug("%s Getting repository information", self.string)
# Attach repository
current_etag = self.data.etag_repository
try:
await self.common_update_data(ignore_issues=ignore_issues, force=force)
await self.common_update_data(
ignore_issues=ignore_issues,
force=force,
skip_releases=skip_releases,
)
except HacsRepositoryExistException:
self.data.full_name = self.hacs.common.renamed_repositories[self.data.full_name]
await self.common_update_data(ignore_issues=ignore_issues, force=force)
@@ -746,9 +752,8 @@ class HacsRepository:
def remove(self) -> None:
"""Run remove tasks."""
self.logger.info("%s Starting removal", self.string)
if self.hacs.repositories.is_registered(repository_id=str(self.data.id)):
self.logger.info("%s Starting removal", self.string)
self.hacs.repositories.unregister(self)
async def uninstall(self) -> None:
@@ -830,7 +835,9 @@ class HacsRepository:
"%s Presumed local content path %s does not exist", self.string, local_path
)
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.logger.debug("%s Removing %s failed with %s", self.string, local_path, exception)
return False
return True
@@ -1048,6 +1055,7 @@ class HacsRepository:
ignore_issues: bool = False,
force: bool = False,
retry=False,
skip_releases=False,
) -> None:
"""Common update data."""
releases = []
@@ -1096,6 +1104,7 @@ class HacsRepository:
raise HacsException(f"{self} Repository has been requested to be removed.")
# Get releases.
if not skip_releases:
try:
releases = await self.get_releases(
prerelease=self.data.show_beta,
@@ -1118,6 +1127,9 @@ class HacsRepository:
if assets := release.assets:
downloads = next(iter(assets)).download_count
self.data.downloads = downloads
elif self.hacs.system.generator and self.repository_object:
await self.repository_object.set_last_commit()
self.data.last_commit = self.repository_object.last_commit
self.hacs.log.debug(
"%s Running checks against %s", self.string, self.ref.replace("tags/", "")
@@ -1247,7 +1259,9 @@ class HacsRepository:
return
self.validate.errors.append(f"[{content.name}] was not downloaded.")
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.validate.errors.append(f"Download was not completed [{exception}]")
async def async_remove_entity_device(self) -> None:

View File

@@ -47,7 +47,7 @@
"release_limit": "Number of releases to show.",
"debug": "Enable debug.",
"appdaemon": "Enable AppDaemon apps discovery & tracking",
"netdaemon": "Enable NetDaemon apps discovery & tracking",
"netdaemon": "[DEPRECATED] Enable NetDaemon apps discovery & tracking",
"sidepanel_icon": "Side panel icon",
"sidepanel_title": "Side panel title"
}

View File

@@ -74,7 +74,9 @@ class Backup:
self.local_path,
self.backup_path_full,
)
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.hacs.log.warning("Could not create backup: %s", exception)
def restore(self) -> None:

View File

@@ -241,7 +241,9 @@ class HacsData:
self.async_restore_repository(entry, repo_data)
self.logger.info("<HacsData restore> Restore done")
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
self.logger.critical(
"<HacsData restore> [%s] Restore Failed!", exception, exc_info=exception
)
@@ -282,6 +284,8 @@ class HacsData:
repository.data.description = repository_data.get("description", "")
repository.data.downloads = repository_data.get("downloads", 0)
repository.data.last_updated = repository_data.get("last_updated", 0)
if self.hacs.system.generator:
repository.data.etag_releases = repository_data.get("etag_releases")
repository.data.etag_repository = repository_data.get("etag_repository")
repository.data.topics = [
topic for topic in repository_data.get("topics", []) if topic not in TOPIC_FILTER

View File

@@ -17,7 +17,9 @@ class HACSStore(Store):
"""Load the data from disk if version matches."""
try:
data = json_util.load_json(self.path)
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
_LOGGER.critical(
"Could not load '%s', restore it from a backup or delete the file: %s",
self.path,

View File

@@ -31,6 +31,8 @@ def render_template(hacs: HacsBase, content: str, context: HacsRepository) -> st
version_available=context.releases.last_release,
version_installed=context.display_installed_version,
)
except BaseException as exception: # lgtm [py/catch-base-exception] pylint: disable=broad-except
except (
BaseException # lgtm [py/catch-base-exception] pylint: disable=broad-except
) as exception:
context.logger.debug(exception)
return content