Browse Source

Utilities/Sphinx: Clarify check for sphinx < 1.4

Brad King 5 years ago
parent
commit
e0f643dddc
1 changed files with 4 additions and 8 deletions
  1. 4 8
      Utilities/Sphinx/cmake.py

+ 4 - 8
Utilities/Sphinx/cmake.py

@@ -92,18 +92,14 @@ from sphinx.roles import XRefRole
 from sphinx.util.nodes import make_refnode
 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
-
+sphinx_before_1_4 = False
 try:
     from sphinx import version_info
     if version_info < (1, 4):
-        old_sphinx = True
+        sphinx_before_1_4 = True
 except ImportError:
     # The `sphinx.version_info` tuple was added in Sphinx v1.2:
-    old_sphinx = True
-
+    sphinx_before_1_4 = True
 
 class CMakeModule(Directive):
     required_arguments = 1
@@ -181,7 +177,7 @@ class _cmake_index_entry:
 
     def __call__(self, title, targetid, main = 'main'):
         # See https://github.com/sphinx-doc/sphinx/issues/2673
-        if old_sphinx:
+        if sphinx_before_1_4:
             return ('pair', u'%s ; %s' % (self.desc, title), targetid, main)
         else:
             return ('pair', u'%s ; %s' % (self.desc, title), targetid, main, None)