Bump HACS to 1.30.1
This commit is contained in:
@@ -50,16 +50,27 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
TOPIC_FILTER = (
|
||||
"add-on",
|
||||
"addon",
|
||||
"app",
|
||||
"appdaemon-apps",
|
||||
"appdaemon",
|
||||
"custom-card",
|
||||
"custom-cards",
|
||||
"custom-component",
|
||||
"custom-components",
|
||||
"customcomponents",
|
||||
"hacktoberfest",
|
||||
"hacs-default",
|
||||
"hacs-integration",
|
||||
"hacs-repository",
|
||||
"hacs",
|
||||
"hass",
|
||||
"hassio",
|
||||
"home-assistant-custom",
|
||||
"home-assistant-frontend",
|
||||
"home-assistant-hacs",
|
||||
"home-assistant-sensor",
|
||||
"home-assistant",
|
||||
"home-automation",
|
||||
"homeassistant-components",
|
||||
@@ -68,16 +79,45 @@ TOPIC_FILTER = (
|
||||
"homeassistant",
|
||||
"homeautomation",
|
||||
"integration",
|
||||
"lovelace-ui",
|
||||
"lovelace",
|
||||
"media-player",
|
||||
"mediaplayer",
|
||||
"netdaemon",
|
||||
"plugin",
|
||||
"python_script",
|
||||
"python-script",
|
||||
"python",
|
||||
"sensor",
|
||||
"smart-home",
|
||||
"smarthome",
|
||||
"theme",
|
||||
"themes",
|
||||
"custom-cards",
|
||||
"home-assistant-frontend",
|
||||
"home-assistant-hacs",
|
||||
"home-assistant-custom",
|
||||
"lovelace-ui",
|
||||
)
|
||||
|
||||
|
||||
REPOSITORY_KEYS_TO_EXPORT = (
|
||||
# Keys can not be removed from this list until v3
|
||||
# If keys are added, the action need to be re-run with force
|
||||
("description", ""),
|
||||
("downloads", 0),
|
||||
("domain", None),
|
||||
("etag_repository", None),
|
||||
("full_name", ""),
|
||||
("last_commit", None),
|
||||
("last_updated", 0),
|
||||
("last_version", None),
|
||||
("manifest_name", None),
|
||||
("open_issues", 0),
|
||||
("stargazers_count", 0),
|
||||
("topics", []),
|
||||
)
|
||||
|
||||
HACS_MANIFEST_KEYS_TO_EXPORT = (
|
||||
# Keys can not be removed from this list until v3
|
||||
# If keys are added, the action need to be re-run with force
|
||||
("country", []),
|
||||
("name", None),
|
||||
)
|
||||
|
||||
|
||||
@@ -120,7 +160,6 @@ class RepositoryData:
|
||||
new: bool = True
|
||||
open_issues: int = 0
|
||||
published_tags: list[str] = []
|
||||
pushed_at: str = ""
|
||||
releases: bool = False
|
||||
selected_tag: str = None
|
||||
show_beta: bool = False
|
||||
@@ -147,32 +186,24 @@ class RepositoryData:
|
||||
|
||||
def update_data(self, data: dict, action: bool = False) -> None:
|
||||
"""Update data of the repository."""
|
||||
for key in data:
|
||||
for key, value in data.items():
|
||||
if key not in self.__dict__:
|
||||
continue
|
||||
if key == "pushed_at":
|
||||
if data[key] == "":
|
||||
continue
|
||||
if "Z" in data[key]:
|
||||
setattr(
|
||||
self,
|
||||
key,
|
||||
datetime.strptime(data[key], "%Y-%m-%dT%H:%M:%SZ"),
|
||||
)
|
||||
else:
|
||||
setattr(self, key, datetime.strptime(data[key], "%Y-%m-%dT%H:%M:%S"))
|
||||
|
||||
if key == "last_fetched" and isinstance(value, float):
|
||||
setattr(self, key, datetime.fromtimestamp(value))
|
||||
elif key == "id":
|
||||
setattr(self, key, str(data[key]))
|
||||
setattr(self, key, str(value))
|
||||
elif key == "country":
|
||||
if isinstance(data[key], str):
|
||||
setattr(self, key, [data[key]])
|
||||
if isinstance(value, str):
|
||||
setattr(self, key, [value])
|
||||
else:
|
||||
setattr(self, key, data[key])
|
||||
setattr(self, key, value)
|
||||
elif key == "topics" and not action:
|
||||
setattr(self, key, [topic for topic in data[key] if topic not in TOPIC_FILTER])
|
||||
setattr(self, key, [topic for topic in value if topic not in TOPIC_FILTER])
|
||||
|
||||
else:
|
||||
setattr(self, key, data[key])
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
@@ -215,6 +246,20 @@ class HacsManifest:
|
||||
setattr(manifest_data, key, value)
|
||||
return manifest_data
|
||||
|
||||
def update_data(self, data: dict) -> None:
|
||||
"""Update the manifest data."""
|
||||
for key, value in data.items():
|
||||
if key not in self.__dict__:
|
||||
continue
|
||||
|
||||
if key == "country":
|
||||
if isinstance(value, str):
|
||||
setattr(self, key, [value])
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
class RepositoryReleases:
|
||||
"""RepositoyReleases."""
|
||||
@@ -449,6 +494,10 @@ class HacsRepository:
|
||||
self.logger.debug("%s Did not update, content was not modified", self.string)
|
||||
return
|
||||
|
||||
if self.repository_object:
|
||||
self.data.last_updated = self.repository_object.attributes.get("pushed_at", 0)
|
||||
self.data.last_fetched = datetime.utcnow()
|
||||
|
||||
# Set topics
|
||||
self.data.topics = self.data.topics
|
||||
|
||||
@@ -497,7 +546,7 @@ class HacsRepository:
|
||||
self.additional_info = await self.async_get_info_file_contents()
|
||||
|
||||
# Set last fetch attribute
|
||||
self.data.last_fetched = datetime.now()
|
||||
self.data.last_fetched = datetime.utcnow()
|
||||
|
||||
return True
|
||||
|
||||
@@ -1011,7 +1060,11 @@ class HacsRepository:
|
||||
self.hacs.common.renamed_repositories[
|
||||
self.data.full_name
|
||||
] = repository_object.full_name
|
||||
raise HacsRepositoryExistException
|
||||
if not self.hacs.system.generator:
|
||||
raise HacsRepositoryExistException
|
||||
self.logger.error(
|
||||
"%s Repository has been renamed - %s", self.string, repository_object.full_name
|
||||
)
|
||||
self.data.update_data(
|
||||
repository_object.attributes,
|
||||
action=self.hacs.system.action,
|
||||
|
||||
Reference in New Issue
Block a user