diff options
author | Stephen Finucane <sfinucan@redhat.com> | 2018-03-27 16:16:49 +0100 |
---|---|---|
committer | Elod Illes <elod.illes@est.tech> | 2022-02-22 16:58:15 +0100 |
commit | 6d7646be5319d724a22aa76a6abe2d092de53ec7 (patch) | |
tree | cd8995319956dcee058a14988b1f45b839c93347 | |
parent | 9cd02d3967c4f7984102edaa2e4870441c562fb0 (diff) | |
download | nova-queens-eol.tar.gz |
[stable-only] Fix sphinx doc jobqueens-eol
This is a combination of 2 commits to fix gate failure due to recent
failure of build-sphinx-docs-job since python 2 was replaced in it to
python 3.
1. tox: Make everything work with Python 3
Nothing too fancy here except that we've to work around a really ugly
side-effect of blockdiag.
Conflicts:
tox.ini
Change-Id: Ibd32d30aacae65702d0ccbdb8a02b1667ec4e8ee
(cherry picked from commit b862f6ff35d1611d0d63623a6254fc889012bfb9)
2. Python 3 fix for sphinx doc
In Python 3, dict methods dict.keys() return “views” instead of lists.
Therefore, the code:
impls = sorted(matrix.targets.keys())
impls.sort()
should be replaced by:
impls = sorted(matrix.targets.keys())
to be Python 3 compatible.
Change-Id: I50477b0ac43adff9e9b0220bd7c48d6ebb6471b3
(cherry picked from commit 8ca01a3abbeb088cab618e856e1d3cddfc5f0d35)
-rw-r--r-- | doc/ext/feature_matrix.py | 6 | ||||
-rw-r--r-- | doc/source/conf.py | 13 | ||||
-rw-r--r-- | tox.ini | 3 |
3 files changed, 15 insertions, 7 deletions
diff --git a/doc/ext/feature_matrix.py b/doc/ext/feature_matrix.py index 16577509bc..4934e5894f 100644 --- a/doc/ext/feature_matrix.py +++ b/doc/ext/feature_matrix.py @@ -337,8 +337,7 @@ class FeatureMatrixDirective(rst.Directive): summaryhead.append(header) # then one column for each hypervisor driver - impls = matrix.targets.keys() - impls.sort() + impls = sorted(matrix.targets.keys()) for key in impls: target = matrix.targets[key] implcol = nodes.entry() @@ -378,8 +377,7 @@ class FeatureMatrixDirective(rst.Directive): classes=["fm_maturity_" + feature.maturity])) # and then one column for each hypervisor driver - impls = matrix.targets.keys() - impls.sort() + impls = sorted(matrix.targets.keys()) for key in impls: target = matrix.targets[key] impl = feature.implementations[key] diff --git a/doc/source/conf.py b/doc/source/conf.py index 2d5ccc0d77..61d4850405 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -181,13 +181,26 @@ def monkey_patch_blockdiag(): text width rather than on word boundaries. There's a patch submitted to resolve this [1]_ but it's unlikely to merge anytime soon. + In addition, blockdiag monkey patches a core library function, + ``codecs.getreader`` [2]_, to work around some Python 3 issues. Because + this operates in the same environment as other code that uses this library, + it ends up causing issues elsewhere. We undo these destructive changes + pending a fix. + TODO: Remove this once blockdiag is bumped to 1.6, which will hopefully include the fix. .. [1] https://bitbucket.org/blockdiag/blockdiag/pull-requests/16/ + .. [2] https://bitbucket.org/blockdiag/blockdiag/src/1.5.3/src/blockdiag/utils/compat.py # noqa """ + import codecs + from codecs import getreader + from blockdiag.imagedraw import textfolder + # oh, blockdiag. Let's undo the mess you made. + codecs.getreader = getreader + def splitlabel(text): """Split text to lines as generator. @@ -142,9 +142,6 @@ commands = commands = {posargs} [testenv:docs] -# TODO(melwitt): This can be removed when the docs target can be run -# with python 3.x -basepython = python2.7 commands = rm -rf doc/source/api doc/build api-guide/build api-ref/build placement-api-ref/build python setup.py build_sphinx |