Marcel Telka
2023-12-18 3b42bf3a0a7aaca94353ddd0f0a143124eddee10
tools/python-requires: handle extras in requirements

1 files modified
11 ■■■■ changed files
tools/python-requires 11 ●●●● patch | view | raw | blame | history
tools/python-requires
@@ -15,9 +15,11 @@
#
#
# Print requirements for a package (first argument).
# Evaluated and normalized.
# If the package specified is - evaluate and normalize stdin.
# Usage:
#   python-requires PACKAGE [EXTRA]
#
# Print requirements for PACKAGE.  Evaluated and normalized.
# If PACKAGE is - evaluate and normalize stdin.
# With optional EXTRA argument passed print requirements for such extra only.
#
@@ -30,6 +32,7 @@
    except ImportError:
        from importlib_metadata import requires
    from packaging.requirements import Requirement
    import subprocess
except:
    exit()
@@ -55,5 +58,7 @@
        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())
            for extra in r.extras:
                subprocess.run([sys.argv[0], r.name, extra])
except:
    pass