diff --git a/README.rst b/README.rst index 5011648f..a580ee3f 100644 --- a/README.rst +++ b/README.rst @@ -35,8 +35,9 @@ metadata for the project where the docs reside:: # We ask git for the SHA checksum # The git SHA checksum is used by "log-a-bug" - git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '" - gitsha = os.popen(git_cmd).read().strip('\n') + git_cmd = ["/usr/bin/git", "rev-parse", "HEAD"] + gitsha = subprocess.Popen( + git_cmd, stdout=subprocess.PIPE).communicate()[0].strip('\n') # tag that reported bugs will be tagged with bug_tag = "your-chosen-tag" # source tree diff --git a/doc/source/conf.py b/doc/source/conf.py index 499ceb86..ac7a41ff 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -12,6 +12,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +import subprocess import sys import os @@ -67,8 +68,9 @@ release = '1.0' # bug_tag: Tag for categorizing the bug. Must be set manually. # 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 log | head -n1 | cut -f2 -d' '" -gitsha = os.popen(git_cmd).read().strip('\n') +git_cmd = ["/usr/bin/git", "rev-parse", "HEAD"] +gitsha = subprocess.Popen( + git_cmd, stdout=subprocess.PIPE).communicate()[0].strip('\n') bug_tag = "doc-builds" html_context = {"gitsha": gitsha, "bug_tag": bug_tag, "giturl" : giturl}