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
This commit is contained in:
Thomas Bechtold
2017-03-30 08:16:56 +02:00
parent b3d69f5d1b
commit 7822e33622

View File

@@ -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()