Add support for older Sphinx versions

This commit is contained in:
Mirko Galimberti 2022-01-23 12:33:21 +01:00
parent c02d716e63
commit 54c6f298c9
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import re
import types
import sys
from os.path import dirname, join
import sphinx
from sphinx.ext.autodoc import MethodDocumenter
class CythonMethodDocumenter(MethodDocumenter):
@ -109,7 +110,10 @@ def setup(app):
sys.path += [join(dirname(kivy.__file__), 'extras')]
from highlight import KivyLexer
app.add_lexer('kv', KivyLexer)
if sphinx.version_info[0] >= 3:
app.add_lexer('kv', KivyLexer)
else:
app.add_lexer('kv', KivyLexer())
app.add_autodocumenter(CythonMethodDocumenter)
app.connect('autodoc-process-docstring', callback_docstring)
app.connect('autodoc-process-signature', callback_signature)