Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions setuptools_git_versioning/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ def _exec(*cmd: str, root: str | os.PathLike | None = None) -> list[str]:
stdout = subprocess.check_output(cmd, text=True, cwd=root) # noqa: S603
except subprocess.CalledProcessError as e:
stdout = e.output
except (FileNotFoundError, OSError) as e:
# Handle case where git executable is not found
# FileNotFoundError on Unix, OSError on some other systems
log.log(DEBUG, "Command not found: %r", e)
stdout = ""
lines = stdout.splitlines()
return [line.rstrip() for line in lines if line.rstrip()]

Expand Down