[rtems-docs commit] RTEMS Docs: Check sphinx version
Joel Sherrill
joel at rtems.org
Fri Mar 9 19:29:08 UTC 2018
Module: rtems-docs
Branch: master
Commit: 2a0664402bae83ece869b1f9f729952df0fb91a0
Changeset: http://git.rtems.org/rtems-docs/commit/?id=2a0664402bae83ece869b1f9f729952df0fb91a0
Author: Richard Campbell <richard.campbell at OARCorp.com>
Date: Thu Feb 22 10:23:08 2018 -0600
RTEMS Docs: Check sphinx version
Sphinx.util.compat module was removed at Sphinx version 1.7.
Imported module was not being used.
Closes #3311.
---
common/rtemsdomain.py | 1 -
common/waf.py | 27 +++++++++++++++++++++++----
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
More information about the vc
mailing list