summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/cdomain.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2016-09-07 09:12:56 +0200
committerJonathan Corbet <corbet@lwn.net>2016-09-16 09:53:23 -0600
commitb495360e30621e22f7a69a239de0d68bc4e383dd (patch)
tree4c85b7e16dd7b3d258d1b2577579ea313448d3f0 /Documentation/sphinx/cdomain.py
parent3d8819b761e5bfb25a83b9c843694c19d0a82c94 (diff)
downloadlinux-b495360e30621e22f7a69a239de0d68bc4e383dd.tar.bz2
doc-rst:c-domain: fix sphinx version incompatibility
The self.indexnode's tuple has changed in sphinx version 1.4, from a former 4 element tuple to a 5 element tuple. https://github.com/sphinx-doc/sphinx/commit/e6a5a3a92e938fcd75866b4227db9e0524d58f7c Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/sphinx/cdomain.py')
-rw-r--r--Documentation/sphinx/cdomain.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Documentation/sphinx/cdomain.py b/Documentation/sphinx/cdomain.py
index 9eb714ada394..5f0c7ed0ddc7 100644
--- a/Documentation/sphinx/cdomain.py
+++ b/Documentation/sphinx/cdomain.py
@@ -29,11 +29,15 @@ u"""
from docutils.parsers.rst import directives
+import sphinx
from sphinx.domains.c import CObject as Base_CObject
from sphinx.domains.c import CDomain as Base_CDomain
__version__ = '1.0'
+# Get Sphinx version
+major, minor, patch = map(int, sphinx.__version__.split("."))
+
def setup(app):
app.override_domain(CDomain)
@@ -85,8 +89,14 @@ class CObject(Base_CObject):
indextext = self.get_index_text(name)
if indextext:
- self.indexnode['entries'].append(('single', indextext,
- targetname, '', None))
+ if major == 1 and minor < 4:
+ # indexnode's tuple changed in 1.4
+ # https://github.com/sphinx-doc/sphinx/commit/e6a5a3a92e938fcd75866b4227db9e0524d58f7c
+ self.indexnode['entries'].append(
+ ('single', indextext, targetname, ''))
+ else:
+ self.indexnode['entries'].append(
+ ('single', indextext, targetname, '', None))
class CDomain(Base_CDomain):