Unverified Commit 32017c4b authored by Martin Weinelt's avatar Martin Weinelt
Browse files

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.
parent 3d0e527b
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -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,6 +235,11 @@ def main() -> None:
                        Version.parse(our_version)
                    except InvalidVersion:
                        print(f"Attribute {attr_name} has invalid version specifier {our_version}", file=sys.stderr)

                        # 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)