From patchwork Sat Feb 15 11:41:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 183553 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2901042ile; Sat, 15 Feb 2020 03:52:49 -0800 (PST) X-Google-Smtp-Source: APXvYqy6BeOAJwrWbHDQvN1wLag6PWDdCIhNGWW2+V0n3hzxd48JNutnmAB+3j2TsYMqiqJ/aKDf X-Received: by 2002:ac8:1ca:: with SMTP id b10mr6054005qtg.314.1581767569202; Sat, 15 Feb 2020 03:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581767569; cv=none; d=google.com; s=arc-20160816; b=iQcsZkjyOxoyAdVpL9rTqhZFyOFVIheKdeRFd4uuCjbX1W3AMK9tG/LRLSpavshZUl f/NE7YTxOKrWLi8/psX50Q9X8dJRZcXdLGCLsZDYyFfDyC7hOMSMlLY5oXhcPlnEiTW8 CSppgeFKEqbHLg6CdQETu8eP8+K+sL9GXJJcV9U/QFglFhrf1tpD+HWfK1XVbHT1Xhxn vTTPrm1+/rEXj2rd3iETWGWmgXbgSqI3gDcI0l5hcaFNhH7O3OdWkFgEIdJioUiS4p4m XVxx15ZQBPc28RVudQFc4AhRFYMUcTmks51Ngv6trgvk1HUtemWhRdoEaWCYuTzn+yMR zA4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=sCc+5qLPVPb3mft6U9NkHFVFzv2oQYRT4mLOTm9h+10=; b=cvBOB+e4Ocm1kxd8ewkycAb5sKVZq6i1HIsuMEYDnPkuoBsTsZ6JuXRxQBMH1jrKqv x8Ht2anI7iX5cpJoqTjCkhwb5C315sEHkxSZpBlDhsqxx9o+GLkXlCz2WKZh4XZsVCvl vWiRlWEv8OZLHvdkmih4+1aY3gY0XBNfyLCy4H5ndmzD5hGeGLcJubs1jvihF6f0uRMv 8lJkSFeOMylyrgiY7zChQPTwnfLSRltpcNuS4kGANJwQh+hsIGiPbfZqz/CLf2PNE7b5 ywYxKxXGSNn5DBGnANT3IeBkOLeMgEwmGLy2xH2DCQeyH3b61daZUKYHzKKZyX8g39Yc sv+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FGJjFVsq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d21si4026716qtg.277.2020.02.15.03.52.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Feb 2020 03:52:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FGJjFVsq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:50512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2w08-0003nv-PU for patch@linaro.org; Sat, 15 Feb 2020 06:52:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49821) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2vpT-0004bc-M2 for qemu-devel@nongnu.org; Sat, 15 Feb 2020 06:41:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2vpS-0006ur-BP for qemu-devel@nongnu.org; Sat, 15 Feb 2020 06:41:47 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:54846 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j2vpS-0006ub-6A for qemu-devel@nongnu.org; Sat, 15 Feb 2020 06:41:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581766905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sCc+5qLPVPb3mft6U9NkHFVFzv2oQYRT4mLOTm9h+10=; b=FGJjFVsqqHf/9EYdd2FLECDUhSYKCaJ+oK9ciR0mj904XDTTwxBkKjn5wyhu8UpHzbWd5E 8wlMqqSfTiACJHY6V3V6vkiyQSXt/0T0WWCWHnQhUMn4R7hqFTzPvE56JzsBgJTRQAzjBF zfMiz9XfAAHCL/ulXn4jfJwzsGuZnRo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-184-vEpWlTpbPQiGWTZ6Pc670A-1; Sat, 15 Feb 2020 06:41:38 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56D971005510; Sat, 15 Feb 2020 11:41:37 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-117-234.ams2.redhat.com [10.36.117.234]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A97D15C1C3; Sat, 15 Feb 2020 11:41:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 27A7411366C8; Sat, 15 Feb 2020 12:41:33 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 04/18] configure: Check that sphinx-build is using Python 3 Date: Sat, 15 Feb 2020 12:41:19 +0100 Message-Id: <20200215114133.15097-5-armbru@redhat.com> In-Reply-To: <20200215114133.15097-1-armbru@redhat.com> References: <20200215114133.15097-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: vEpWlTpbPQiGWTZ6Pc670A-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Reviewed-by: Alex Bennée Reviewed-by: Wainer dos Santos Moschetta Message-Id: <20200213175647.17628-3-peter.maydell@linaro.org> Signed-off-by: Markus Armbruster --- docs/conf.py | 10 ++++++++++ configure | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) -- 2.21.1 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