Fix html_last_updated_fmt for Python3

Fix the Sphinx html_last_updated_fmt for Python3.
The html_last_updated_fmt option is interpreted as a
byte string in python3, causing Sphinx build to break.
This patch makes it utf-8 string.

Change-Id: I3a79f12a62037e565484cea4b8ff927d85a83394
Closes-Bug: #1693670
This commit is contained in:
luqitao 2017-06-09 04:47:22 -04:00
parent e9f4da1961
commit 79135121a9
1 changed files with 5 additions and 3 deletions

View File

@ -122,9 +122,11 @@ html_theme = 'nature'
# using the given strftime format.
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
"-n1"]
html_last_updated_fmt = subprocess.Popen(
git_cmd, stdout=subprocess.PIPE).communicate()[0]
try:
html_last_updated_fmt = subprocess.check_output(git_cmd).decode('utf-8')
except Exception:
warnings.warn('Cannot get last updated time from git repository. '
'Not setting "html_last_updated_fmt".')
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
#html_use_smartypants = True