Update HACS

This commit is contained in:
root
2022-05-23 17:48:47 -07:00
parent 3bdb8638a8
commit 1d83dd0c31
163 changed files with 862 additions and 11844 deletions

View File

@@ -6,12 +6,11 @@ from typing import TYPE_CHECKING, Any
from homeassistant.loader import async_get_custom_components
from ..enums import HacsCategory, HacsGitHubRepo, RepositoryFile
from ..enums import HacsCategory, HacsDispatchEvent, HacsGitHubRepo, RepositoryFile
from ..exceptions import AddonRepositoryException, HacsException
from ..utils.decode import decode_content
from ..utils.decorator import concurrent
from ..utils.filters import get_first_directory_in_directory
from ..utils.version import version_to_download
from .base import HacsRepository
if TYPE_CHECKING:
@@ -50,7 +49,7 @@ class HacsIntegrationRepository(HacsRepository):
await self.common_validate()
# Custom step 1: Validate content.
if self.data.content_in_root:
if self.repository_manifest.content_in_root:
self.content.path.remote = ""
if self.content.path.remote == "custom_components":
@@ -100,7 +99,7 @@ class HacsIntegrationRepository(HacsRepository):
if not await self.common_update(ignore_issues, force) and not force:
return
if self.data.content_in_root:
if self.repository_manifest.content_in_root:
self.content.path.remote = ""
if self.content.path.remote == "custom_components":
@@ -129,8 +128,8 @@ class HacsIntegrationRepository(HacsRepository):
# Signal entities to refresh
if self.data.installed:
self.hacs.hass.bus.async_fire(
"hacs/repository",
self.hacs.async_dispatch(
HacsDispatchEvent.REPOSITORY,
{
"id": 1337,
"action": "update",
@@ -150,7 +149,7 @@ class HacsIntegrationRepository(HacsRepository):
"""Get the content of the manifest.json file."""
manifest_path = (
"manifest.json"
if self.data.content_in_root
if self.repository_manifest.content_in_root
else f"{self.content.path.remote}/{RepositoryFile.MAINIFEST_JSON}"
)
@@ -161,7 +160,7 @@ class HacsIntegrationRepository(HacsRepository):
method=self.hacs.githubapi.repos.contents.get,
repository=self.data.full_name,
path=manifest_path,
**{"params": {"ref": ref or version_to_download(self)}},
**{"params": {"ref": ref or self.version_to_download()}},
)
if response:
return json.loads(decode_content(response.data.content))