diff options
author | Richard Campbell <richard.campbell@OARCorp.com> | 2018-02-22 10:23:08 -0600 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2018-03-09 13:28:45 -0600 |
commit | 2a0664402bae83ece869b1f9f729952df0fb91a0 (patch) | |
tree | 07f10453510d142709927d431a5febc5f47bcdf6 /common/waf.py | |
parent | posix-compliance: Add description of standards (diff) | |
download | rtems-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 '')
-rw-r--r-- | common/waf.py | 27 |
1 files changed, 23 insertions, 4 deletions
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 |