From 9053a4685b75f4ba73ef3171e0336624e7c9d282 Mon Sep 17 00:00:00 2001 From: Andrey Volkov Date: Mon, 16 May 2016 11:27:19 +0300 Subject: [PATCH] Make available to build docs with python3 On Ubuntu 16.04 a tox package is for python3 by default and this causes errors in building docs in tox enviroment. In these changes iterators are replaced with lists where it's needed. Also external command calls result are decoded from bytes to unicode. Change-Id: I88ef54405b4bc13c269bdda55ae8289676311ee1 --- api-guide/source/conf.py | 2 +- api-ref/source/conf.py | 2 +- doc/ext/support_matrix.py | 4 ++-- doc/source/conf.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api-guide/source/conf.py b/api-guide/source/conf.py index 5ced3d297365..7373c3c00ed1 100644 --- a/api-guide/source/conf.py +++ b/api-guide/source/conf.py @@ -88,7 +88,7 @@ gitsha = subprocess.Popen( # source tree pwd = subprocess.Popen( - "pwd", stdout=subprocess.PIPE).communicate()[0].strip('\n') + "pwd", stdout=subprocess.PIPE).communicate()[0].decode().strip('\n') # html_context allows us to pass arbitrary values into the html template html_context = {"pwd": pwd, diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 3351b290d67c..5d0b2198fa9f 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -148,7 +148,7 @@ git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", "-n1"] try: html_last_updated_fmt = subprocess.Popen( - git_cmd, stdout=subprocess.PIPE).communicate()[0] + git_cmd, stdout=subprocess.PIPE).communicate()[0].decode() except Exception: warnings.warn('Cannot get last updated time from git repository. ' 'Not setting "html_last_updated_fmt".') diff --git a/doc/ext/support_matrix.py b/doc/ext/support_matrix.py index 67e9b44dfb2a..afcfe87941c3 100644 --- a/doc/ext/support_matrix.py +++ b/doc/ext/support_matrix.py @@ -317,7 +317,7 @@ class SupportMatrixDirective(rst.Directive): summaryhead.append(header) # then one column for each hypervisor driver - impls = matrix.targets.keys() + impls = list(matrix.targets.keys()) impls.sort() for key in impls: target = matrix.targets[key] @@ -350,7 +350,7 @@ class SupportMatrixDirective(rst.Directive): classes=["sp_feature_" + feature.status])) # and then one column for each hypervisor driver - impls = matrix.targets.keys() + impls = list(matrix.targets.keys()) impls.sort() for key in impls: target = matrix.targets[key] diff --git a/doc/source/conf.py b/doc/source/conf.py index dce5004ad976..e3cd90d4da8b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -197,7 +197,7 @@ git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local", "-n1"] try: html_last_updated_fmt = subprocess.Popen( - git_cmd, stdout=subprocess.PIPE).communicate()[0] + git_cmd, stdout=subprocess.PIPE).communicate()[0].decode() except Exception: warnings.warn('Cannot get last updated time from git repository. ' 'Not setting "html_last_updated_fmt".')