Marcel Telka
2022-12-08 915419768fd8499662809a5542c0b1f200a075d5
tools/python-requires: handle comments and invalid lines

1 files modified
6 ■■■■■ changed files
tools/python-requires 6 ●●●●● patch | view | raw | blame | history
tools/python-requires
@@ -30,7 +30,6 @@
    except ImportError:
        from importlib_metadata import requires
    from packaging.requirements import Requirement
    from packaging.markers import UndefinedEnvironmentName
except:
    exit()
@@ -49,7 +48,10 @@
try:
    for req in reqs:
        r = Requirement(req)
        try:
            r = Requirement(re.sub(r"#.*", "", req))
        except:
            continue
        m = r.marker
        if (not m and not e) or m and ((not e and m.evaluate(noe)) or (e and not m.evaluate(noe) and m.evaluate(e))):
            print(re.sub(r"[-_.]+", "-", r.name).lower())