home-assistant: find unstable versions in parse-requirements.py

Previously unstable versions would not have been found, because the
regular expression was looking for a numeric version after the attribute
name. When the version is however an unstable one, it would start with

> unstable-2021-04-23

and therefore not match the pattern.
This commit is contained in:
Martin Weinelt
2021-04-23 02:00:52 +02:00
parent 313681c8fc
commit f129df86a1
2 changed files with 5 additions and 2 deletions
@@ -124,7 +124,10 @@ def name_to_attr_path(req: str, packages: Dict[str, Dict[str, str]]) -> Optional
for name in names:
# treat "-" and "_" equally
name = re.sub("[-_]", "[-_]", name)
pattern = re.compile("^python\\d\\.\\d-{}-\\d".format(name), re.I)
# python(minor).(major)-(pname)-(version or unstable-date)
# we need the version qualifier, or we'll have multiple matches
# (e.g. pyserial and pyserial-asyncio when looking for pyserial)
pattern = re.compile("^python\\d\\.\\d-{}-(?:\\d|unstable-.*)".format(name), re.I)
for attr_path, package in packages.items():
if pattern.match(package["name"]):
attr_paths.add(attr_path)