From 13af58f568fceb69ba5446ffbbdd2c17aa88e0d7 Mon Sep 17 00:00:00 2001 From: Jacob Hummer Date: Tue, 12 Nov 2024 19:47:22 -0600 Subject: [PATCH] work when git is not installed --- bikeshed/metadata.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bikeshed/metadata.py b/bikeshed/metadata.py index e1eb256128..a3e4c10e67 100644 --- a/bikeshed/metadata.py +++ b/bikeshed/metadata.py @@ -1197,10 +1197,11 @@ def getSpecRepository(doc: t.SpecT) -> repository.Repository | None: source_dir = doc.inputSource.directory() try: with open(os.devnull, "wb") as fnull: - remotes = str( - subprocess.check_output(["git", "remote", "-v"], stderr=fnull, cwd=source_dir), # noqa: S603 - encoding="utf-8", - ) + try: + output = subprocess.check_output(["git", "remote", "-v"], stderr=fnull, cwd=source_dir), # noqa: S603 + except: + return None + remotes = str(output, encoding="utf-8") searches = [ r"origin\tgit@github\.([\w.-]+):([\w-]+)/([\w-]+)\.git \(\w+\)", r"origin\thttps://github\.([\w.-]+)/([\w-]+)/([\w-]+)\.git \(\w+\)",