mirror of
https://git.rtems.org/rtems-docs/
synced 2025-05-14 19:52:11 +08:00
RTEMS Docs: Check sphinx version
Sphinx.util.compat module was removed at Sphinx version 1.7. Imported module was not being used. Closes #3311.
This commit is contained in:
parent
9c9ba8f8bc
commit
2a0664402b
@ -6,7 +6,6 @@ from sphinx.roles import XRefRole
|
|||||||
from sphinx.locale import l_, _
|
from sphinx.locale import l_, _
|
||||||
from sphinx.directives import ObjectDescription
|
from sphinx.directives import ObjectDescription
|
||||||
from sphinx.domains import Domain, ObjType, Index
|
from sphinx.domains import Domain, ObjType, Index
|
||||||
from sphinx.util.compat import Directive
|
|
||||||
from sphinx.util.nodes import make_refnode
|
from sphinx.util.nodes import make_refnode
|
||||||
from sphinx.util.docfields import Field, TypedField
|
from sphinx.util.docfields import Field, TypedField
|
||||||
|
|
||||||
|
@ -81,12 +81,31 @@ class linkcheck(BuildContext):
|
|||||||
fun = 'cmd_linkcheck'
|
fun = 'cmd_linkcheck'
|
||||||
|
|
||||||
def check_sphinx_version(ctx, minver):
|
def check_sphinx_version(ctx, minver):
|
||||||
version = ctx.cmd_and_log(ctx.env.BIN_SPHINX_BUILD +
|
|
||||||
['--version']).split(" ")[-1:][0].strip()
|
|
||||||
try:
|
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:
|
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:
|
if ver < minver:
|
||||||
ctx.fatal("Sphinx version is too old: %s" % ".".join(map(str, ver)))
|
ctx.fatal("Sphinx version is too old: %s" % ".".join(map(str, ver)))
|
||||||
return ver
|
return ver
|
||||||
|
Loading…
x
Reference in New Issue
Block a user