about summary refs log tree commit diff
path: root/pkgs/servers/home-assistant
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2023-11-10 18:00:28 +0100
committerMartin Weinelt <hexa@darmstadt.ccc.de>2023-11-10 18:00:28 +0100
commit32017c4b4ab334860a8dd0b9b9b7633a37291db4 (patch)
treeeb39007b0dd974dcf5aa0c2f698283d7f9b664a7 /pkgs/servers/home-assistant
parent3d0e527b1ffb0656c4e82a1e3cb9ca0b568860c9 (diff)
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.
Diffstat (limited to 'pkgs/servers/home-assistant')
-rwxr-xr-xpkgs/servers/home-assistant/parse-requirements.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/servers/home-assistant/parse-requirements.py b/pkgs/servers/home-assistant/parse-requirements.py
index 1df4d98fb45d4..bb5e70994320b 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: