From f8d71ac5ad023a32cbbe04e109eb2793433ee558 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 1 Dec 2015 16:34:54 +0000 Subject: [PATCH] trap errors from git not being present subprocess raises OSError if the command it is asked to run isn't found, so trap that as well as the subprocess-specific error we were already catching. Change-Id: Ieb9c7f3ccc307250847104a7f97cfa28603fcf5d Closes-Bug: #1521541 --- oslosphinx/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oslosphinx/__init__.py b/oslosphinx/__init__.py index 7f311c8..239eed4 100644 --- a/oslosphinx/__init__.py +++ b/oslosphinx/__init__.py @@ -26,7 +26,8 @@ def _guess_cgit_link(): git_remote = subprocess.check_output( ['git', 'config', '--local', '--get', 'remote.origin.url'] ) - except subprocess.CalledProcessError: + except (OSError, subprocess.CalledProcessError): + # git is not present or the command failed return None else: if six.PY3: