scripts: More version parsing in recompile_requirements

Required for misc_checks.py
This commit is contained in:
Florian Bruhin 2021-12-20 15:08:02 +01:00
parent 450619e25a
commit e78c6699a0
1 changed files with 8 additions and 2 deletions

View File

@ -399,8 +399,14 @@ def parse_versioned_line(line):
line = line.rsplit('#', maxsplit=1)[0]
line = line.split(';')[0].strip()
if '==' in line:
name, version = line.split('==')
ops = ["==", "~=", "!=", ">", "<", ">=", "<="]
if any(op in line for op in ops):
# strictly speaking, this version isn't necessarily correct, but it's
# enough for the table.
for op in ops:
if op in line:
name, version = line.split(op)
elif line.startswith('-e'):
rest, name = line.split('#egg=')
version = rest.split('@')[1][:7]