From ed9df1e6bdbd09224762ef0bff4aa790a1516958 Mon Sep 17 00:00:00 2001 From: Saurabh Chaturvedi Date: Sun, 9 Feb 2020 03:27:26 +0530 Subject: [PATCH] Port documentation to build via Python3 --- documentation/sphinx/Makefile | 4 +--- documentation/sphinx/extensions/rubydomain.py | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/documentation/sphinx/Makefile b/documentation/sphinx/Makefile index ea672b8aa4..e64216f08f 100644 --- a/documentation/sphinx/Makefile +++ b/documentation/sphinx/Makefile @@ -68,9 +68,7 @@ buildsphinx: if [ ! -e $(SPHINXBUILD) ]; then \ mkdir $(BUILDDIR); \ cd $(BUILDDIR); \ - curl -OL $(VENV_URL); \ - tar zxvf $(VENV_VERSION).tar.gz; \ - python2 ./$(VENV_VERSION)/virtualenv.py venv; \ + python3 -m venv venv; \ fi . $(VENVDIR)/bin/activate && \ cp .pip.conf $(VENVDIR)/pip.conf && \ diff --git a/documentation/sphinx/extensions/rubydomain.py b/documentation/sphinx/extensions/rubydomain.py index 540f8487d3..1e5fb0bce4 100755 --- a/documentation/sphinx/extensions/rubydomain.py +++ b/documentation/sphinx/extensions/rubydomain.py @@ -502,7 +502,7 @@ class RubyModuleIndex(Index): ignores = self.domain.env.config['modindex_common_prefix'] ignores = sorted(ignores, key=len, reverse=True) # list of all modules, sorted by module name - modules = sorted(self.domain.data['modules'].iteritems(), + modules = sorted(iter(self.domain.data['modules'].items()), key=lambda x: x[0].lower()) # sort out collapsable modules prev_modname = '' @@ -551,7 +551,7 @@ class RubyModuleIndex(Index): collapse = len(modules) - num_toplevels < num_toplevels # sort by first letter - content = sorted(content.iteritems()) + content = sorted(content.items()) return content, collapse @@ -609,10 +609,10 @@ class RubyDomain(Domain): ] def clear_doc(self, docname): - for fullname, (fn, _) in self.data['objects'].items(): + for fullname, (fn, _) in list(self.data['objects'].items()): if fn == docname: del self.data['objects'][fullname] - for modname, (fn, _, _, _) in self.data['modules'].items(): + for modname, (fn, _, _, _) in list(self.data['modules'].items()): if fn == docname: del self.data['modules'][modname] @@ -704,9 +704,9 @@ class RubyDomain(Domain): contnode, name) def get_objects(self): - for modname, info in self.data['modules'].iteritems(): + for modname, info in self.data['modules'].items(): yield (modname, modname, 'module', info[0], 'module-' + modname, 0) - for refname, (docname, type) in self.data['objects'].iteritems(): + for refname, (docname, type) in self.data['objects'].items(): yield (refname, refname, type, docname, refname, 1)