mirror of
https://git.rtems.org/rtems-docs/
synced 2025-05-14 19:29:44 +08:00
Add minimum version check for Sphinx.
Some distributions have ancient versions we require at least 1.3.
This commit is contained in:
parent
9b5801a6e6
commit
14bbcb1ea9
@ -1,6 +1,9 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
from waflib.Build import BuildContext
|
from waflib.Build import BuildContext
|
||||||
|
|
||||||
|
|
||||||
|
sphinx_min_version = (1,3)
|
||||||
|
|
||||||
def cmd_spell(ctx):
|
def cmd_spell(ctx):
|
||||||
from waflib import Options
|
from waflib import Options
|
||||||
from sys import argv
|
from sys import argv
|
||||||
@ -32,17 +35,37 @@ class spell(BuildContext):
|
|||||||
fun = 'cmd_spell'
|
fun = 'cmd_spell'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def check_sphinx_version(ctx, minver):
|
||||||
|
# try:
|
||||||
|
version = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD + ['--version']).split(" ")[-1:][0]
|
||||||
|
ver = tuple(map(int, version.split(".")))
|
||||||
|
# except Exception:
|
||||||
|
# ctx.fatal("Version check failed please report")
|
||||||
|
|
||||||
|
if ver < minver:
|
||||||
|
ctx.fatal("Sphinx version is too old: %s" % ".".join(map(str, ver)))
|
||||||
|
|
||||||
|
return ver
|
||||||
|
|
||||||
def cmd_configure(ctx):
|
def cmd_configure(ctx):
|
||||||
ctx.load('tex')
|
ctx.load('tex')
|
||||||
|
|
||||||
|
|
||||||
if not ctx.env.PDFLATEX:
|
if not ctx.env.PDFLATEX:
|
||||||
conf.fatal('The program LaTex is required')
|
conf.fatal('The program LaTex is required')
|
||||||
|
|
||||||
ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD", mandatory=True)
|
ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD", mandatory=True)
|
||||||
# ctx.find_program("pdflatex", var="BIN_PDFLATEX", mandatory=True)
|
|
||||||
ctx.find_program("aspell", var="BIN_ASPELL", mandatory=False)
|
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)
|
||||||
|
|
||||||
|
ctx.end_msg("yes (%s)" % ".".join(map(str, ver)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cmd_build(ctx, conf_dir=".", source_dir="."):
|
def cmd_build(ctx, conf_dir=".", source_dir="."):
|
||||||
srcnode = ctx.srcnode.abspath()
|
srcnode = ctx.srcnode.abspath()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user