Commit e48a4caf authored by Zen Fu's avatar Zen Fu
Browse files

[weblate] Recognize "rc" pip package versions (tails#17377)

The regular expression matching package versions was not prepared to see
"rc" versions, and this made it fail to parse versions of dependencies.
parent 29c65192
......@@ -38,7 +38,7 @@ class Dependency:
if split:
for part in line.split(","):
m = re.match(r"^(?P<name>[^!=<>]*)\s*(?P<constrains>[!=<>~0-9ab\.dev,]+)?\s*$", part)
m = re.match(r"^(?P<name>[^!=<>]*)\s*(?P<constrains>[!=<>~0-9abrc\.dev,]+)?\s*$", part)
if first:
self.name = m.group("name")
first = False
......@@ -46,7 +46,7 @@ class Dependency:
for i in self.parse_constrains(m.group("constrains")):
self.constrains.add(i)
else:
m = re.match(r"^(?P<name>[^!=<>]*)\s*(?P<constrains>\([!=<>~0-9ab\.dev,]+\))?\s*$", line)
m = re.match(r"^(?P<name>[^!=<>]*)\s*(?P<constrains>\([!=<>~0-9abrc\.dev,]+\))?\s*$", line)
self.name = m.group("name")
if m.group("constrains"):
for i in self.parse_constrains(m.group("constrains")[1:-1]):
......@@ -61,7 +61,7 @@ class Dependency:
def parse_constrains(self, constrains):
for part in constrains.split(","):
n = re.match(r"^(?P<constrain>[!=<>~]+)\s*(?P<version>[0-9][0-9ab\.]*|dev)$", part.strip())
n = re.match(r"^(?P<constrain>[!=<>~]+)\s*(?P<version>[0-9][0-9abrc\.]*|dev)$", part.strip())
yield (n.group("constrain"), n.group("version"))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment