From 80bda9053fd8c4ce29941ab690a601a8314187ba Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 26 Jul 2021 16:26:14 +0100 Subject: [PATCH] sphinxext: Resolve compatibility with Sphinx 4.x This necessitates bumping the lowest version supported to avoid having to maintain shims. Change-Id: I6c324a5a7c2b7296a15aaa57fc8b98491099702c Signed-off-by: Stephen Finucane --- doc/requirements.txt | 2 +- test-requirements.txt | 2 +- wsmeext/sphinxext.py | 17 ++++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index da0972d..054e963 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1 +1 @@ -sphinx!=1.6.6,!=1.6.7,>=1.6.2,<4.0.0 # BSD +sphinx>=3.0.0 # BSD diff --git a/test-requirements.txt b/test-requirements.txt index e00c42c..e0b5dbc 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ transaction pecan -sphinx!=1.6.6,!=1.6.7,>=1.6.2,<4.0.0 # BSD +sphinx>=3.0.0 # BSD Flask flask-restful nose diff --git a/wsmeext/sphinxext.py b/wsmeext/sphinxext.py index f2dde7b..a513f53 100644 --- a/wsmeext/sphinxext.py +++ b/wsmeext/sphinxext.py @@ -5,10 +5,13 @@ import sys from docutils.parsers.rst import Directive from docutils.parsers.rst import directives from sphinx import addnodes -from sphinx.ext import autodoc -from sphinx.domains.python import PyClasslike, PyClassmember -from sphinx.domains import Domain, ObjType from sphinx.directives import ObjectDescription +from sphinx.domains import Domain +from sphinx.domains import ObjType +from sphinx.domains.python import PyAttribute +from sphinx.domains.python import PyClasslike +from sphinx.domains.python import PyMethod +from sphinx.ext import autodoc from sphinx.locale import _ from sphinx.roles import XRefRole from sphinx.util.docfields import Field @@ -153,7 +156,7 @@ class TypeDirective(PyClasslike): return ret -class AttributeDirective(PyClassmember): +class AttributeDirective(PyAttribute): doc_field_types = [ Field('datatype', label=_('Type'), has_arg=False, names=('type', 'datatype')) @@ -368,7 +371,7 @@ class ServiceDocumenter(autodoc.ClassDocumenter): return '/' + '/'.join(path) -class FunctionDirective(PyClassmember): +class FunctionDirective(PyMethod): name = 'function' objtype = 'function' @@ -592,5 +595,5 @@ def setup(app): app.add_config_value('wsme_root', None, 'env') app.add_config_value('wsme_webpath', '/', 'env') app.add_config_value('wsme_protocols', ['restjson', 'restxml'], 'env') - app.add_javascript('toggle.js') - app.add_stylesheet('toggle.css') + app.add_js_file('toggle.js') + app.add_css_file('toggle.css')