From 32017c4b4ab334860a8dd0b9b9b7633a37291db4 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 10 Nov 2023 18:00:28 +0100 Subject: [PATCH] home-assistant: track unstable dependency version comparator We often update packages that are not well maintained to unstable versions. That leaves us with no valid version comparison anymore, and these packages, while newer than the last release, will always appear as mismatching from the wanted version. This change allows specifying that our unstable version is newer than a certain released version. --- .../servers/home-assistant/parse-requirements.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py index 1df4d98fb45d..bb5e70994320 100755 --- a/pkgs/servers/home-assistant/parse-requirements.py +++ b/pkgs/servers/home-assistant/parse-requirements.py @@ -56,6 +56,15 @@ EXTRA_COMPONENT_DEPS = { ], } +# Sometimes we have unstable versions for libraries that are not +# well-maintained. This allows us to mark our weird version as newer +# than a certain wanted version +OUR_VERSION_IS_NEWER_THAN = { + "blinkstick": "1.2.0", + "gps3": "0.33.3", + "pybluez": "0.22", +} + def run_sync(cmd: List[str]) -> None: @@ -226,7 +235,12 @@ def main() -> None: Version.parse(our_version) except InvalidVersion: print(f"Attribute {attr_name} has invalid version specifier {our_version}", file=sys.stderr) - attr_outdated = True + + # allow specifying that our unstable version is newer than some version + if newer_than_version := OUR_VERSION_IS_NEWER_THAN.get(attr_name): + attr_outdated = Version.parse(newer_than_version) < Version.parse(required_version) + else: + attr_outdated = True else: attr_outdated = Version.parse(our_version) < Version.parse(required_version) finally: