summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorRichard Campbell <richard.campbell@OARCorp.com>2018-02-22 10:23:08 -0600
committerJoel Sherrill <joel@rtems.org>2018-03-09 13:28:45 -0600
commit2a0664402bae83ece869b1f9f729952df0fb91a0 (patch)
tree07f10453510d142709927d431a5febc5f47bcdf6 /common
parent9c9ba8f8bce5ad05bc0affbca74e73bc7e8fe20d (diff)
downloadrtems-docs-2a0664402bae83ece869b1f9f729952df0fb91a0.tar.bz2
RTEMS Docs: Check sphinx version
Sphinx.util.compat module was removed at Sphinx version 1.7. Imported module was not being used. Closes #3311.
Diffstat (limited to 'common')
-rw-r--r--common/rtemsdomain.py1
-rw-r--r--common/waf.py27
2 files changed, 23 insertions, 5 deletions
diff --git a/common/rtemsdomain.py b/common/rtemsdomain.py
index a8bcd28..8bd976f 100644
--- a/common/rtemsdomain.py
+++ b/common/rtemsdomain.py
@@ -6,7 +6,6 @@ from sphinx.roles import XRefRole
from sphinx.locale import l_, _
from sphinx.directives import ObjectDescription
from sphinx.domains import Domain, ObjType, Index
-from sphinx.util.compat import Directive
from sphinx.util.nodes import make_refnode
from sphinx.util.docfields import Field, TypedField
diff --git a/common/waf.py b/common/waf.py
index ed9af48..ae287cb 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -81,12 +81,31 @@ class linkcheck(BuildContext):
fun = 'cmd_linkcheck'
def check_sphinx_version(ctx, minver):
- version = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD +
- ['--version']).split(" ")[-1:][0].strip()
try:
- ver = tuple(map(int, re.split('[\D]', version)))
+ import sphinx
+ # sphinx.version_info was introduced in sphinx ver 1.2
+ version = sphinx.version_info
+ # version looks like (1, 7, 0, 'final', 0))
+ ver = version[0:2]
except:
- ctx.fatal("Sphinx version cannot be checked: %s" % version)
+ try:
+ # sphinx-build returns its version info in stderr
+ (out, err) = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD +
+ ['--version'], output=Context.BOTH)
+ # err looks like 'sphinx-build 1.7.0\n'
+ version = err.split(" ")[-1:][0].strip()
+ ver = tuple(map(int, re.split('[\D]', version)))
+ except:
+ try:
+ # sphinx-build returns its version info in stdout
+ version = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD +
+ ['--version']).split(" ")[-1:][0].strip()
+ try:
+ ver = tuple(map(int, re.split('[\D]', version)))
+ except:
+ ctx.fatal("Sphinx version cannot be checked")
+ except:
+ ctx.fatal("Sphinx version cannot be checked: %s" % version)
if ver < minver:
ctx.fatal("Sphinx version is too old: %s" % ".".join(map(str, ver)))
return ver