Update HACS
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -107,6 +107,7 @@ class RepositoryData:
|
||||
first_install: bool = False
|
||||
full_name: str = ""
|
||||
hide: bool = False
|
||||
has_issues: bool = True
|
||||
id: int = 0
|
||||
installed_commit: str = None
|
||||
installed_version: str = None
|
||||
@@ -138,13 +139,13 @@ class RepositoryData:
|
||||
return attr.asdict(self, filter=lambda attr, value: attr.name != "last_fetched")
|
||||
|
||||
@staticmethod
|
||||
def create_from_dict(source: dict):
|
||||
def create_from_dict(source: dict, action: bool = False) -> RepositoryData:
|
||||
"""Set attributes from dicts."""
|
||||
data = RepositoryData()
|
||||
data.update_data(source)
|
||||
data.update_data(source, action)
|
||||
return data
|
||||
|
||||
def update_data(self, data: dict):
|
||||
def update_data(self, data: dict, action: bool = False) -> None:
|
||||
"""Update data of the repository."""
|
||||
for key in data:
|
||||
if key not in self.__dict__:
|
||||
@@ -167,7 +168,7 @@ class RepositoryData:
|
||||
setattr(self, key, [data[key]])
|
||||
else:
|
||||
setattr(self, key, data[key])
|
||||
elif key == "topics":
|
||||
elif key == "topics" and not action:
|
||||
setattr(self, key, [topic for topic in data[key] if topic not in TOPIC_FILTER])
|
||||
|
||||
else:
|
||||
@@ -450,7 +451,10 @@ class HacsRepository:
|
||||
if RepositoryFile.HACS_JSON in [x.filename for x in self.tree]:
|
||||
if manifest := await self.async_get_hacs_json():
|
||||
self.repository_manifest = HacsManifest.from_dict(manifest)
|
||||
self.data.update_data(self.repository_manifest.to_dict())
|
||||
self.data.update_data(
|
||||
self.repository_manifest.to_dict(),
|
||||
action=self.hacs.system.action,
|
||||
)
|
||||
|
||||
async def common_registration(self) -> None:
|
||||
"""Common registration steps of the repository."""
|
||||
@@ -460,7 +464,10 @@ class HacsRepository:
|
||||
self.repository_object, etag = await self.async_get_legacy_repository_object(
|
||||
etag=None if self.data.installed else self.data.etag_repository,
|
||||
)
|
||||
self.data.update_data(self.repository_object.attributes)
|
||||
self.data.update_data(
|
||||
self.repository_object.attributes,
|
||||
action=self.hacs.system.action,
|
||||
)
|
||||
self.data.etag_repository = etag
|
||||
except HacsNotModifiedException:
|
||||
self.logger.debug("%s Did not update, content was not modified", self.string)
|
||||
@@ -505,7 +512,10 @@ class HacsRepository:
|
||||
if RepositoryFile.HACS_JSON in [x.filename for x in self.tree]:
|
||||
if manifest := await self.async_get_hacs_json():
|
||||
self.repository_manifest = HacsManifest.from_dict(manifest)
|
||||
self.data.update_data(self.repository_manifest.to_dict())
|
||||
self.data.update_data(
|
||||
self.repository_manifest.to_dict(),
|
||||
action=self.hacs.system.action,
|
||||
)
|
||||
|
||||
# Update "info.md"
|
||||
self.additional_info = await self.async_get_info_file_contents()
|
||||
@@ -1016,7 +1026,10 @@ class HacsRepository:
|
||||
self.data.full_name
|
||||
] = repository_object.full_name
|
||||
raise HacsRepositoryExistException
|
||||
self.data.update_data(repository_object.attributes)
|
||||
self.data.update_data(
|
||||
repository_object.attributes,
|
||||
action=self.hacs.system.action,
|
||||
)
|
||||
self.data.etag_repository = etag
|
||||
except HacsNotModifiedException:
|
||||
return
|
||||
|
||||
@@ -70,9 +70,9 @@ class HacsIntegrationRepository(HacsRepository):
|
||||
if manifest := await self.async_get_integration_manifest():
|
||||
try:
|
||||
self.integration_manifest = manifest
|
||||
self.data.authors = manifest["codeowners"]
|
||||
self.data.authors = manifest.get("codeowners", [])
|
||||
self.data.domain = manifest["domain"]
|
||||
self.data.manifest_name = manifest["name"]
|
||||
self.data.manifest_name = manifest.get("name")
|
||||
self.data.config_flow = manifest.get("config_flow", False)
|
||||
|
||||
except KeyError as exception:
|
||||
@@ -110,9 +110,9 @@ class HacsIntegrationRepository(HacsRepository):
|
||||
if manifest := await self.async_get_integration_manifest():
|
||||
try:
|
||||
self.integration_manifest = manifest
|
||||
self.data.authors = manifest["codeowners"]
|
||||
self.data.authors = manifest.get("codeowners", [])
|
||||
self.data.domain = manifest["domain"]
|
||||
self.data.manifest_name = manifest["name"]
|
||||
self.data.manifest_name = manifest.get("name")
|
||||
self.data.config_flow = manifest.get("config_flow", False)
|
||||
|
||||
except KeyError as exception:
|
||||
|
||||
@@ -63,6 +63,9 @@ class HacsPythonScriptRepository(HacsRepository):
|
||||
# Set name
|
||||
self.update_filenames()
|
||||
|
||||
if self.hacs.system.action:
|
||||
await self.hacs.validation.async_run_repository_checks(self)
|
||||
|
||||
@concurrent(concurrenttasks=10, backoff_time=5)
|
||||
async def update_repository(self, ignore_issues=False, force=False):
|
||||
"""Update."""
|
||||
|
||||
@@ -69,6 +69,9 @@ class HacsThemeRepository(HacsRepository):
|
||||
self.update_filenames()
|
||||
self.content.path.local = self.localpath
|
||||
|
||||
if self.hacs.system.action:
|
||||
await self.hacs.validation.async_run_repository_checks(self)
|
||||
|
||||
@concurrent(concurrenttasks=10, backoff_time=5)
|
||||
async def update_repository(self, ignore_issues=False, force=False):
|
||||
"""Update."""
|
||||
|
||||
Reference in New Issue
Block a user