Suppress stderr in _get_version() (#5667)

This commit is contained in:
jack1142 2022-04-05 22:33:43 +02:00 committed by GitHub
parent 0b8dec77c3
commit 88d2cb3976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,9 @@ def _get_version(*, ignore_installed: bool = False) -> str:
path = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
output = subprocess.check_output(
("git", "describe", "--tags", "--long", "--dirty"), cwd=path
("git", "describe", "--tags", "--long", "--dirty"),
stderr=subprocess.DEVNULL,
cwd=path,
)
_, count, commit, *dirty = output.decode("utf-8").strip().split("-", 3)
dirty_suffix = f".{dirty[0]}" if dirty else ""