mirror of
https://github.com/reactos/CMake.git
synced 2024-11-29 06:20:23 +00:00
Utilities/Sphinx: Restore compatibility with Sphinx pre-1.2
Since commit v3.8.0-rc2~28^2~2 (Utilities/Sphinx: Port cmake extension to Sphinx 1.4, 2017-02-09) we use the `sphinx.version_info` tuple. However, it was added in Sphinx v1.2 so the check breaks compatibility with older versions. Revise our check to assume Sphinx pre-1.2 if the version tuple does not exist.
This commit is contained in:
parent
f15cfd891d
commit
2a68ff7fd7
@ -46,7 +46,20 @@ from sphinx.directives import ObjectDescription
|
|||||||
from sphinx.domains import Domain, ObjType
|
from sphinx.domains import Domain, ObjType
|
||||||
from sphinx.roles import XRefRole
|
from sphinx.roles import XRefRole
|
||||||
from sphinx.util.nodes import make_refnode
|
from sphinx.util.nodes import make_refnode
|
||||||
from sphinx import addnodes, version_info
|
from sphinx import addnodes
|
||||||
|
|
||||||
|
# Needed for checking if Sphinx version is >= 1.4.
|
||||||
|
# See https://github.com/sphinx-doc/sphinx/issues/2673
|
||||||
|
old_sphinx = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
from sphinx import version_info
|
||||||
|
if version_info < (1, 4):
|
||||||
|
old_sphinx = True
|
||||||
|
except ImportError:
|
||||||
|
# The `sphinx.version_info` tuple was added in Sphinx v1.2:
|
||||||
|
old_sphinx = True
|
||||||
|
|
||||||
|
|
||||||
class CMakeModule(Directive):
|
class CMakeModule(Directive):
|
||||||
required_arguments = 1
|
required_arguments = 1
|
||||||
@ -124,7 +137,7 @@ class _cmake_index_entry:
|
|||||||
|
|
||||||
def __call__(self, title, targetid, main = 'main'):
|
def __call__(self, title, targetid, main = 'main'):
|
||||||
# See https://github.com/sphinx-doc/sphinx/issues/2673
|
# See https://github.com/sphinx-doc/sphinx/issues/2673
|
||||||
if version_info < (1, 4):
|
if old_sphinx:
|
||||||
return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
|
return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
|
||||||
else:
|
else:
|
||||||
return ('pair', u'%s ; %s' % (self.desc, title), targetid, main, None)
|
return ('pair', u'%s ; %s' % (self.desc, title), targetid, main, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user