[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 04/18] configure: Check that sphinx-build is using Python 3
From: |
Markus Armbruster |
Subject: |
[PULL 04/18] configure: Check that sphinx-build is using Python 3 |
Date: |
Sat, 15 Feb 2020 12:41:19 +0100 |
From: Peter Maydell <address@hidden>
Currently configure's has_sphinx_build() check simply runs a dummy
sphinx-build and either passes or fails. This means that "no
sphinx-build at all" and "sphinx-build exists but is too old" are
both reported the same way.
Further, we want to assume that all the Python we write is running
with at least Python 3.5; configure checks that for our scripts, but
Sphinx extensions run with whatever Python version sphinx-build
itself is using.
Add a check to our conf.py which makes sphinx-build fail if it would
be running our extensions with an old Python, and handle this
in configure so we can report failure helpfully to the user.
This will mean that configure --enable-docs will fail like this
if the sphinx-build provided is not suitable:
Warning: sphinx-build exists but it is either too old or uses too old a Python
version
ERROR: User requested feature docs
configure was not able to find it.
Install texinfo, Perl/perl-podlators and a Python 3 version of
python-sphinx
(As usual, the default is to simply not build the docs, as we would
if sphinx-build wasn't present at all.)
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Reviewed-by: Wainer dos Santos Moschetta <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
docs/conf.py | 10 ++++++++++
configure | 12 ++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index ee7faa6b4e..7588bf192e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -28,6 +28,16 @@
import os
import sys
+import sphinx
+from sphinx.errors import VersionRequirementError
+
+# 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...
+if sys.version_info < (3,5):
+ raise VersionRequirementError(
+ "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;
# otherwise set it here if this is an entire-manual-set build.
diff --git a/configure b/configure
index 9f7bded369..7a826cbd26 100755
--- a/configure
+++ b/configure
@@ -4818,11 +4818,19 @@ has_sphinx_build() {
# Check if tools are available to build documentation.
if test "$docs" != "no" ; then
- if has makeinfo && has pod2man && has_sphinx_build; then
+ if has_sphinx_build; then
+ sphinx_ok=yes
+ else
+ sphinx_ok=no
+ fi
+ if has makeinfo && has pod2man && test "$sphinx_ok" = "yes"; then
docs=yes
else
if test "$docs" = "yes" ; then
- feature_not_found "docs" "Install texinfo, Perl/perl-podlators and
python-sphinx"
+ if has $sphinx_build && test "$sphinx_ok" != "yes"; then
+ echo "Warning: $sphinx_build exists but it is either too old or uses
too old a Python version" >&2
+ fi
+ feature_not_found "docs" "Install texinfo, Perl/perl-podlators and a
Python 3 version of python-sphinx"
fi
docs=no
fi
--
2.21.1
- [PULL 18/18] qapi: Delete all the "foo: dropped in n.n" notes, (continued)
- [PULL 18/18] qapi: Delete all the "foo: dropped in n.n" notes, Markus Armbruster, 2020/02/15
- [PULL 10/18] qapi: Fix incorrect "Not documented" claims in QMP documentation, Markus Armbruster, 2020/02/15
- [PULL 14/18] qapi/ui.json: Avoid `...' Texinfo style quoting, Markus Armbruster, 2020/02/15
- [PULL 02/18] configure: Allow user to specify sphinx-build binary, Markus Armbruster, 2020/02/15
- [PULL 16/18] qapi: Add blank lines before bulleted lists, Markus Armbruster, 2020/02/15
- [PULL 09/18] qapi/block-core.json: Use literal block for ascii art, Markus Armbruster, 2020/02/15
- [PULL 08/18] qga/qapi-schema.json: minor format fixups for rST, Markus Armbruster, 2020/02/15
- [PULL 15/18] qapi: Use explicit bulleted lists, Markus Armbruster, 2020/02/15
- [PULL 17/18] qapi/migration.json: Replace _this_ with *this*, Markus Armbruster, 2020/02/15
- [PULL 12/18] qapi: Remove hardcoded tabs, Markus Armbruster, 2020/02/15
- [PULL 04/18] configure: Check that sphinx-build is using Python 3,
Markus Armbruster <=
- [PULL 11/18] qapi: Fix indent level on doc comments in json files, Markus Armbruster, 2020/02/15
- Re: [PULL 00/18] QAPI patches for 2020-02-15, Peter Maydell, 2020/02/17