Fix doc generation for python 3
1. The html_last_updated_fmt sphinx setting was providing a byte string where sphinx expected a str, which produced warnings (and therefore failures): WARNING: The config value `html_last_updated_fmt' has type `bytes', expected to ['str']. The solution provided is copied from cinder's solution[1]. 2. The .keys() method in python 3 returns a dict_keys object rather than a list and it does not include a .sort() method. This patch swaps .sort() out for the global function sorted() which works in both python 2 and python 3. This came up because on some newer distros that don't install python 2 by default, virtualenv defaults to creating a python 3 environment when none is specified. [1] https://review.openstack.org/#/c/433081 Change-Id: I68b796fa2e33fd6c3df67b542def31e6ba620944
This commit is contained in:
parent
4dd73a8543
commit
c7ab7c5677
@ -171,8 +171,8 @@ pygments_style = 'sphinx'
|
|||||||
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
||||||
"-n1"]
|
"-n1"]
|
||||||
try:
|
try:
|
||||||
html_last_updated_fmt = subprocess.Popen(
|
html_last_updated_fmt = subprocess.check_output(
|
||||||
git_cmd, stdout=subprocess.PIPE).communicate()[0]
|
git_cmd).decode('utf-8')
|
||||||
except Exception:
|
except Exception:
|
||||||
warnings.warn('Cannot get last updated time from git repository. '
|
warnings.warn('Cannot get last updated time from git repository. '
|
||||||
'Not setting "html_last_updated_fmt".')
|
'Not setting "html_last_updated_fmt".')
|
||||||
|
@ -319,8 +319,7 @@ class SupportMatrixDirective(rst.Directive):
|
|||||||
summaryhead.append(header)
|
summaryhead.append(header)
|
||||||
|
|
||||||
# then one column for each hypervisor driver
|
# then one column for each hypervisor driver
|
||||||
impls = matrix.targets.keys()
|
impls = sorted(matrix.targets.keys())
|
||||||
impls.sort()
|
|
||||||
for key in impls:
|
for key in impls:
|
||||||
target = matrix.targets[key]
|
target = matrix.targets[key]
|
||||||
implcol = nodes.entry()
|
implcol = nodes.entry()
|
||||||
@ -352,8 +351,7 @@ class SupportMatrixDirective(rst.Directive):
|
|||||||
classes=["sp_feature_" + feature.status]))
|
classes=["sp_feature_" + feature.status]))
|
||||||
|
|
||||||
# and then one column for each hypervisor driver
|
# and then one column for each hypervisor driver
|
||||||
impls = matrix.targets.keys()
|
impls = sorted(matrix.targets.keys())
|
||||||
impls.sort()
|
|
||||||
for key in impls:
|
for key in impls:
|
||||||
target = matrix.targets[key]
|
target = matrix.targets[key]
|
||||||
impl = feature.implementations[key]
|
impl = feature.implementations[key]
|
||||||
|
@ -167,8 +167,8 @@ html_static_path = ['_static']
|
|||||||
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
||||||
"-n1"]
|
"-n1"]
|
||||||
try:
|
try:
|
||||||
html_last_updated_fmt = subprocess.Popen(
|
html_last_updated_fmt = subprocess.check_output(
|
||||||
git_cmd, stdout=subprocess.PIPE).communicate()[0]
|
git_cmd).decode('utf-8')
|
||||||
except Exception:
|
except Exception:
|
||||||
warnings.warn('Cannot get last updated time from git repository. '
|
warnings.warn('Cannot get last updated time from git repository. '
|
||||||
'Not setting "html_last_updated_fmt".')
|
'Not setting "html_last_updated_fmt".')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user