[commit: ghc] ghc-8.6: user-guide: Allow build with sphinx < 1.8 (af0bf16)
git at git.haskell.org
git at git.haskell.org
Thu Sep 20 22:18:41 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.6
Link : http://ghc.haskell.org/trac/ghc/changeset/af0bf169a4fb70b7cf371026906663df04e2023e/ghc
>---------------------------------------------------------------
commit af0bf169a4fb70b7cf371026906663df04e2023e
Author: Ben Gamari <ben at smart-cactus.org>
Date: Thu Sep 20 17:35:05 2018 -0400
user-guide: Allow build with sphinx < 1.8
Apparently the override argument to add_directive_to_domain was added in sphinx
1.8.
(cherry picked from commit a257782f56e5e330349d4cc7db71e297d8396c67)
>---------------------------------------------------------------
af0bf169a4fb70b7cf371026906663df04e2023e
docs/users_guide/flags.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/docs/users_guide/flags.py b/docs/users_guide/flags.py
index df23f38..21c7ae3 100644
--- a/docs/users_guide/flags.py
+++ b/docs/users_guide/flags.py
@@ -46,9 +46,11 @@
from docutils import nodes
from docutils.parsers.rst import Directive, directives
+import sphinx
from sphinx import addnodes
from sphinx.domains.std import GenericObject
from sphinx.errors import SphinxError
+from distutils.version import LooseVersion
from utils import build_table_from_list
### Settings
@@ -597,15 +599,18 @@ def purge_flags(app, env, docname):
### Initialization
def setup(app):
+ # The override argument to add_directive_to_domain is only supported by >= 1.8
+ sphinx_version = LooseVersion(sphinx.__version__)
+ override_arg = {'override': True} if sphinx_version >= LooseVersion('1.8') else {}
# Add ghc-flag directive, and override the class with our own
app.add_object_type('ghc-flag', 'ghc-flag')
- app.add_directive_to_domain('std', 'ghc-flag', Flag, override=True)
+ app.add_directive_to_domain('std', 'ghc-flag', Flag, **override_arg)
# Add extension directive, and override the class with our own
app.add_object_type('extension', 'extension')
app.add_directive_to_domain('std', 'extension', LanguageExtension,
- override=True)
+ **override_arg)
# NB: language-extension would be misinterpreted by sphinx, and produce
# lang="extensions" XML attributes
More information about the ghc-commits
mailing list