[2.1.x] Removed usage of deprecated sphinx APIs.

Backport of cc4bb110d3 from master
This commit is contained in:
Tim Graham 2018-09-10 16:08:21 -04:00
parent 24b3aa0275
commit 780190f6d9
1 changed files with 4 additions and 2 deletions

View File

@ -12,9 +12,11 @@ from sphinx import addnodes
from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.directives import CodeBlock from sphinx.directives import CodeBlock
from sphinx.domains.std import Cmdoption from sphinx.domains.std import Cmdoption
from sphinx.util import logging
from sphinx.util.console import bold from sphinx.util.console import bold
from sphinx.writers.html import HTMLTranslator from sphinx.writers.html import HTMLTranslator
logger = logging.getLogger(__name__)
# RE for option descriptions without a '--' prefix # RE for option descriptions without a '--' prefix
simple_option_desc_re = re.compile( simple_option_desc_re = re.compile(
r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)') r'([-_a-zA-Z0-9]+)(\s*.*?)(?=,\s+(?:/|-|--)|$)')
@ -41,7 +43,7 @@ def setup(app):
rolename="lookup", rolename="lookup",
indextemplate="pair: %s; field lookup type", indextemplate="pair: %s; field lookup type",
) )
app.add_description_unit( app.add_object_type(
directivename="django-admin", directivename="django-admin",
rolename="djadmin", rolename="djadmin",
indextemplate="pair: %s; django-admin command", indextemplate="pair: %s; django-admin command",
@ -179,7 +181,7 @@ class DjangoStandaloneHTMLBuilder(StandaloneHTMLBuilder):
def finish(self): def finish(self):
super().finish() super().finish()
self.info(bold("writing templatebuiltins.js...")) logger.info(bold("writing templatebuiltins.js..."))
xrefs = self.env.domaindata["std"]["objects"] xrefs = self.env.domaindata["std"]["objects"]
templatebuiltins = { templatebuiltins = {
"ttags": [ "ttags": [