summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-08-02 15:41:39 +0000
committerKitware Robot <kwrobot@kitware.com>2017-08-02 11:41:44 -0400
commitb162e5c0f052935cabb93823e1c36093333e545c (patch)
treee756bc726e70df4fd745dcbd76dd82c459b729be
parentbf0ef8c461bdb277a77cb9a80ac6f4bc6f5c50ee (diff)
parent2a68ff7fd739860f117d9bf80fe38ec331edd596 (diff)
downloadcmake-b162e5c0f052935cabb93823e1c36093333e545c.tar.gz
Merge topic 'sphinx-pre-1.2'
2a68ff7f Utilities/Sphinx: Restore compatibility with Sphinx pre-1.2 Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1089
-rw-r--r--Utilities/Sphinx/cmake.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/Utilities/Sphinx/cmake.py b/Utilities/Sphinx/cmake.py
index 6f273f91d5..cfda2d4795 100644
--- a/Utilities/Sphinx/cmake.py
+++ b/Utilities/Sphinx/cmake.py
@@ -46,7 +46,20 @@ from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType
from sphinx.roles import XRefRole
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):
required_arguments = 1
@@ -124,7 +137,7 @@ class _cmake_index_entry:
def __call__(self, title, targetid, main = 'main'):
# 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)
else:
return ('pair', u'%s ; %s' % (self.desc, title), targetid, main, None)