From 7822e33622da67143cc79ebd88ab9d397b87dc90 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Thu, 30 Mar 2017 08:16:56 +0200 Subject: [PATCH] Fix doc build if git is absent When building packages if git is absent, do not try to get the git sha via the git cli. That can not work. Change-Id: I3bde4df045287cbda07c9447ef3397de74f42910 Closes-Bug: #1677463 --- doc/source/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index c12c69e10..8dee8f737 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -13,6 +13,7 @@ import os import sys +import warnings import openstackdocstheme @@ -67,7 +68,12 @@ release = '1.0' # These variables are passed to the logabug code via html_context. giturl = u'http://git.openstack.org/cgit/openstack/python-openstacksdk/tree/doc/source' git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '" -gitsha = os.popen(git_cmd).read().strip('\n') +try: + gitsha = os.popen(git_cmd).read().strip('\n') +except Exception: + warnings.warn("Can not get git sha.") + gitsha = "unknown" + bug_tag = "docs" # source tree pwd = os.getcwd()