From 600ff8bfe6b76cc993d26c950bd83e4820445462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Nov=C3=BD?= Date: Sun, 17 Jul 2016 22:26:48 +0200 Subject: [PATCH] Allow to build docs without git command Change-Id: If9177436c116f398e5956f2918d097c621c97157 --- doc/source/conf.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index ac7a41ff..9b9860ac 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -15,6 +15,7 @@ import subprocess import sys import os +import warnings import openstackdocstheme @@ -69,8 +70,12 @@ release = '1.0' # These variables are passed to the logabug code via html_context. giturl = u'http://git.openstack.org/cgit/openstack/openstackdocstheme/tree/doc/source' git_cmd = ["/usr/bin/git", "rev-parse", "HEAD"] -gitsha = subprocess.Popen( - git_cmd, stdout=subprocess.PIPE).communicate()[0].strip('\n') +try: + gitsha = subprocess.Popen( + git_cmd, stdout=subprocess.PIPE).communicate()[0].strip('\n') +except OSError: + warnings.warn('Cannot get gitsha from git repository. Setting to None') + gitsha = None bug_tag = "doc-builds" html_context = {"gitsha": gitsha, "bug_tag": bug_tag, "giturl" : giturl}