All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Michael Roth" <mdroth@linux.vnet.ibm.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"John Snow" <jsnow@redhat.com>
Subject: [PATCH v2 02/30] configure: Check that sphinx-build is using Python 3
Date: Thu, 13 Feb 2020 17:56:19 +0000	[thread overview]
Message-ID: <20200213175647.17628-3-peter.maydell@linaro.org> (raw)
In-Reply-To: <20200213175647.17628-1-peter.maydell@linaro.org>

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 <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 configure    | 12 ++++++++++--
 docs/conf.py | 10 ++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 0aceb8e50db..2c5cad13edd 100755
--- a/configure
+++ b/configure
@@ -4808,11 +4808,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
diff --git a/docs/conf.py b/docs/conf.py
index ee7faa6b4e7..7588bf192ee 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.
-- 
2.20.1



  parent reply	other threads:[~2020-02-13 17:58 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13 17:56 [PATCH v2 00/30] Convert QAPI doc comments to generate rST instead of texinfo Peter Maydell
2020-02-13 17:56 ` [PATCH v2 01/30] configure: Allow user to specify sphinx-build binary Peter Maydell
2020-02-14  6:33   ` Markus Armbruster
2020-02-14  9:21     ` Peter Maydell
2020-02-14 12:20       ` Markus Armbruster
2020-02-14 12:39         ` Peter Maydell
2020-02-14 17:18           ` Markus Armbruster
2020-02-14 17:36             ` Peter Maydell
2020-02-15 10:37               ` Markus Armbruster
2020-02-13 17:56 ` Peter Maydell [this message]
2020-02-13 17:56 ` [PATCH v2 03/30] Makefile: Fix typo in dependency list for interop manpages Peter Maydell
2020-02-13 17:56 ` [PATCH v2 04/30] qga/qapi-schema.json: Fix missing '-' in GuestDiskBusType doc comment Peter Maydell
2020-02-13 17:56 ` [PATCH v2 05/30] qga/qapi-schema.json: Fix indent level on doc comments Peter Maydell
2020-02-14 12:36   ` Markus Armbruster
2020-02-14 12:40     ` Peter Maydell
2020-02-14 14:26       ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 06/30] qga/qapi-schema.json: minor format fixups for rST Peter Maydell
2020-02-14 12:46   ` Markus Armbruster
2020-02-14 14:33     ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 07/30] qapi/block-core.json: Use literal block for ascii art Peter Maydell
2020-02-13 22:59   ` Aleksandar Markovic
2020-02-15 20:56     ` Philippe Mathieu-Daudé
2020-02-15 21:01       ` Aleksandar Markovic
2020-02-17  0:44         ` Philippe Mathieu-Daudé
2020-02-17  5:53           ` Samuel Thibault
2020-02-14 12:53   ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 08/30] qapi: Use ':' after @argument in doc comments Peter Maydell
2020-02-14 13:02   ` Markus Armbruster
2020-02-14 13:28     ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 09/30] qapi: Fix indent level on doc comments in json files Peter Maydell
2020-02-14 13:45   ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 10/30] qapi: Remove hardcoded tabs Peter Maydell
2020-02-13 17:56 ` [PATCH v2 11/30] qapi/ui.json: Put input-send-event body text in the right place Peter Maydell
2020-02-13 17:56 ` [PATCH v2 12/30] qapi/ui.json: Avoid `...' texinfo style quoting Peter Maydell
2020-02-13 17:56 ` [PATCH v2 13/30] qapi/block-core.json: Use explicit bulleted lists Peter Maydell
2020-02-13 17:56 ` [PATCH v2 14/30] qapi/ui.json: " Peter Maydell
2020-02-14 14:20   ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 15/30] qapi/{block, misc, tmp, net}.json: " Peter Maydell
2020-02-14 14:23   ` Markus Armbruster
2020-02-14 14:28     ` Peter Maydell
2020-02-14 15:46       ` Markus Armbruster
2020-02-14 15:48         ` Peter Maydell
2020-02-13 17:56 ` [PATCH v2 16/30] qapi: Add blank lines before " Peter Maydell
2020-02-14 14:33   ` Markus Armbruster
2020-02-14 16:02     ` Markus Armbruster
2020-02-14 16:16       ` Peter Maydell
2020-02-14 17:11         ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 17/30] qapi/migration.json: Replace _this_ with *this* Peter Maydell
2020-02-13 19:02   ` Philippe Mathieu-Daudé
2020-02-14 14:35   ` Markus Armbruster
2020-02-13 17:56 ` [PATCH v2 18/30] qapi: Delete all the "foo: dropped in n.n" notes Peter Maydell
2020-02-14  6:55   ` Markus Armbruster
2020-02-14 15:13     ` Markus Armbruster
2020-02-14 15:20       ` Peter Maydell
2020-02-13 17:56 ` [PATCH v2 19/30] qapi/qapi-schema.json: Put headers in their own doc-comment blocks Peter Maydell
2020-02-13 17:56 ` [PATCH v2 20/30] qapi/machine.json: Escape a literal '*' in doc comment Peter Maydell
2020-02-13 19:01   ` Philippe Mathieu-Daudé
2020-02-13 17:56 ` [PATCH v2 21/30] tests/qapi/doc-good.json: Clean up markup Peter Maydell
2020-02-13 17:56 ` [PATCH v2 22/30] scripts/qapi: Move doc-comment whitespace stripping to doc.py Peter Maydell
2020-02-13 17:56 ` [PATCH v2 23/30] scripts/qapi/parser.py: improve doc comment indent handling Peter Maydell
2020-02-13 17:56 ` [PATCH v2 24/30] docs/sphinx: Add new qapi-doc Sphinx extension Peter Maydell
2020-02-13 17:56 ` [PATCH v2 25/30] docs/interop: Convert qemu-ga-ref to rST Peter Maydell
2020-02-13 17:56 ` [PATCH v2 26/30] docs/interop: Convert qemu-qmp-ref " Peter Maydell
2020-02-17 15:10   ` Peter Maydell
2020-02-13 17:56 ` [PATCH v2 27/30] qapi: Use rST markup for literal blocks Peter Maydell
2020-02-13 17:56 ` [PATCH v2 28/30] qga/qapi-schema.json: Add some headings Peter Maydell
2020-02-13 17:56 ` [PATCH v2 29/30] scripts/qapi: Remove texinfo generation support Peter Maydell
2020-02-13 17:56 ` [PATCH v2 30/30] docs/devel/qapi-code-gen.txt: Update to new rST backend conventions Peter Maydell
2020-02-13 20:51 ` [PATCH v2 00/30] Convert QAPI doc comments to generate rST instead of texinfo no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200213175647.17628-3-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.