[PATCH rtems-docs 2/2] common/waf.py: Add option to check maximum Sphinx version
Joel Sherrill
joel at rtems.org
Tue Jul 25 20:25:46 UTC 2023
Updates #4928.
---
common/waf.py | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/common/waf.py b/common/waf.py
index 0bd166a..6efe038 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -16,7 +16,11 @@ from waflib.Build import BuildContext
import latex
import conf
+# Sphinx >= 6 are currently broken.
+# If you do not want to check for a maximum version, set it to None.
sphinx_min_version = (1, 3)
+sphinx_max_version = (5, 9)
+#sphinx_max_version = None
def version_cmdline(ctx):
return '-Drelease="%s" -Dversion="%s" -Drtems_major="%s" ' \
@@ -84,7 +88,7 @@ class linkcheck(BuildContext):
cmd = 'linkcheck'
fun = 'cmd_linkcheck'
-def check_sphinx_version(ctx, minver):
+def check_sphinx_version(ctx, minver, maxver):
try:
import sphinx
except:
@@ -115,6 +119,9 @@ def check_sphinx_version(ctx, minver):
ctx.fatal("Sphinx version cannot be checked or Sphinx is not installed")
if ver < minver:
ctx.fatal("Sphinx version is too old: %s" % ".".join(map(str, ver)))
+ if maxver is not None:
+ if ver > maxver:
+ ctx.fatal("Sphinx version is too new: %s" % ".".join(map(str, ver)))
return ver
def sphinx_options(ctx):
@@ -206,8 +213,12 @@ def cmd_configure(ctx):
ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD", mandatory = True)
ctx.find_program("aspell", var = "BIN_ASPELL", mandatory = False)
- ctx.start_msg("Checking if Sphinx is at least %s.%s" % sphinx_min_version)
- ver = check_sphinx_version(ctx, sphinx_min_version)
+ if sphinx_max_version is None:
+ ctx.start_msg("Checking if Sphinx is at least %s.%s" % sphinx_min_version)
+ else:
+ ctx.start_msg("Checking if Sphinx is between %s.%s and %s.%s" % (sphinx_min_version + sphinx_max_version))
+
+ ver = check_sphinx_version(ctx, sphinx_min_version, sphinx_max_version)
ctx.end_msg("yes (%s)" % ".".join(map(str, ver)))
ctx.start_msg("Checking Sphinx Options ")
--
2.31.1
More information about the devel
mailing list