sphinxext: Fix Sphinx 3.0 compatibility

Sphinx is currently issuing the following warnings for projects using
this extension.

  RemovedInSphinx30Warning: sphinx.locale.l_() is deprecated.  Please
  use `_()` instead.

Head this off before it becomes an issue.

Change-Id: I108d36ab909a7afd4fd28bfb565812f69ae02118
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane 2019-04-02 10:56:45 +01:00 committed by Michael Johnson
parent a54cdfb6c7
commit 2be89e587c

View File

@ -10,7 +10,7 @@ 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.locale import l_, _
from sphinx.locale import _
from sphinx.roles import XRefRole
from sphinx.util.docfields import Field
from sphinx.util.nodes import make_refnode
@ -156,7 +156,7 @@ class TypeDirective(PyClasslike):
class AttributeDirective(PyClassmember):
doc_field_types = [
Field('datatype', label=l_('Type'), has_arg=False,
Field('datatype', label=_('Type'), has_arg=False,
names=('type', 'datatype'))
]
@ -237,7 +237,7 @@ class TypeDocumenter(autodoc.ClassDocumenter):
if protocols:
sample_obj = make_sample_object(self.object)
content.extend([
l_(u'Data samples:'),
_(u'Data samples:'),
u'',
u'.. cssclass:: toggle',
u''
@ -441,7 +441,7 @@ def document_function(funcdef, docstrings=None, protocols=['restjson']):
make_sample_object(arg.datatype)
))
codesamples.extend([
u':%s:' % l_(u'Parameters samples'),
u':%s:' % _(u'Parameters samples'),
u' .. cssclass:: toggle',
u''
])
@ -460,7 +460,7 @@ def document_function(funcdef, docstrings=None, protocols=['restjson']):
if funcdef.return_type:
codesamples.extend([
u':%s:' % l_(u'Return samples'),
u':%s:' % _(u'Return samples'),
u' .. cssclass:: toggle',
u''
])
@ -547,8 +547,8 @@ class WSMEDomain(Domain):
label = 'WSME'
object_types = {
'type': ObjType(l_('type'), 'type', 'obj'),
'service': ObjType(l_('service'), 'service', 'obj')
'type': ObjType(_('type'), 'type', 'obj'),
'service': ObjType(_('service'), 'service', 'obj')
}
directives = {