mirror of
https://github.com/qemu/qemu.git
synced 2024-11-24 03:13:44 +08:00
docs/conf.py: Raise ConfigError for bad Sphinx Python version
Raise ConfigError rather than VersionRequirementError when we detect
that the Python being used by Sphinx is too old.
Currently the way we flag the Python version problem up to the user
causes Sphinx to print an unnecessary Python stack trace as well as
the information about the problem; in most versions of Sphinx this is
unavoidable.
The upstream Sphinx developers kindly added a feature to allow
conf.py to report errors to the user without the backtrace:
be608ca231
but the exception type they chose for this was ConfigError.
Switch to ConfigError, which won't make any difference with currently
deployed Sphinx versions, but will be prettier one day when the user
is using a Sphinx version with the new feature.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20200313163616.30674-1-peter.maydell@linaro.org
This commit is contained in:
parent
34d8df2a1d
commit
e22684e34d
@ -29,14 +29,15 @@
|
||||
import os
|
||||
import sys
|
||||
import sphinx
|
||||
from sphinx.errors import VersionRequirementError
|
||||
from sphinx.errors import ConfigError
|
||||
|
||||
# Make Sphinx fail cleanly if using an old Python, rather than obscurely
|
||||
# failing because some code in one of our extensions doesn't work there.
|
||||
# Unfortunately this doesn't display very neatly (there's an unavoidable
|
||||
# Python backtrace) but at least the information gets printed...
|
||||
# In newer versions of Sphinx this will display nicely; in older versions
|
||||
# Sphinx will also produce a Python backtrace but at least the information
|
||||
# gets printed...
|
||||
if sys.version_info < (3,5):
|
||||
raise VersionRequirementError(
|
||||
raise ConfigError(
|
||||
"QEMU requires a Sphinx that uses Python 3.5 or better\n")
|
||||
|
||||
# The per-manual conf.py will set qemu_docdir for a single-manual build;
|
||||
|
Loading…
Reference in New Issue
Block a user