diff options
author | Joel Sherrill <joel@rtems.org> | 2023-07-25 15:19:16 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2023-07-25 15:20:22 -0500 |
commit | fbcae108102bb73bff1f6c7dbcba969612a387e5 (patch) | |
tree | dc2a97018a22d0a74f56492bea7762c78d3ee45b /common/waf.py | |
parent | layout.html: Revert patch forcing Spinx to >= 6.0 (diff) | |
download | rtems-docs-fbcae108102bb73bff1f6c7dbcba969612a387e5.tar.bz2 |
common/waf.py: Add option to check maximum Sphinx version
Updates #4928.
Diffstat (limited to 'common/waf.py')
-rw-r--r-- | common/waf.py | 17 |
1 files 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 ") |