Make sure getting latest always takes into consideration non-version attributes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
IamTheFij 2024-07-06 15:05:03 -07:00
parent b61e94005e
commit e45dc59d1f
2 changed files with 6 additions and 1 deletions

View File

@ -120,7 +120,7 @@ class Unhacs:
]
upgrade_packages: list[Package] = []
latest_packages = [Package(url=p.url) for p in installed_packages]
latest_packages = [p.get_latest() for p in installed_packages]
for installed_package, latest_package in zip(
installed_packages, latest_packages
):

View File

@ -279,6 +279,11 @@ class Package:
installed_package = self.installed_package(hass_config_path)
return installed_package is None or installed_package.version != self.version
def get_latest(self) -> "Package":
package = self.to_yaml()
package.pop("version")
return Package(**package)
def get_installed_packages(
hass_config_path: Path = DEFAULT_HASS_CONFIG_PATH,