From 22016934b308f7cb088ee0ce10d1cdcc3dc4724b Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Mon, 2 Dec 2024 10:35:02 -0600 Subject: [PATCH] gracefully handle if git is not installed The following error occurs in `_get_contributors()` if git is not installed. > FileNotFoundError: [Errno 2] No such file or directory: 'git': 'git' Treat this the same as if `git` fails, catch the error and print a warning. --- sphinxcontrib/spelling/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinxcontrib/spelling/filters.py b/sphinxcontrib/spelling/filters.py index e9265df..60d9024 100644 --- a/sphinxcontrib/spelling/filters.py +++ b/sphinxcontrib/spelling/filters.py @@ -245,7 +245,7 @@ def _get_contributors(self): try: p = subprocess.run(cmd, check=True, stdout=subprocess.PIPE) - except subprocess.CalledProcessError as err: + except (subprocess.CalledProcessError, FileNotFoundError) as err: logger.warning('Called: %s', ' '.join(cmd)) logger.warning('Failed to scan contributors: %s', err) return set()