From patchwork Thu Feb 6 17:30:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 183107 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp1836390ile; Thu, 6 Feb 2020 09:36:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxMmJh1Cg/SntmO7nITvHep/lY3Wc3gZSHY0FfAgDR9N0AgD420p4HFYIep4NH21cRcL3uE X-Received: by 2002:a05:620a:1327:: with SMTP id p7mr3558454qkj.148.1581010616431; Thu, 06 Feb 2020 09:36:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581010616; cv=none; d=google.com; s=arc-20160816; b=vSDh9r+Do7pa4X7dshPdNm/51T4EkXHRuuhEubC20u34as2cLHSreL4Tc4QrzLTJMI 3xKFTKIm84r7vWCsxagwwgaOzZx1ozGguYgh93+64rzF3i4q7O9zHFdHMfC1ER1n8coI cV7HsAIsW8tPg9UM+6T+rVlOs3UWFkwd6CeLi2V7xYyAPxJWyD9gsGCQQiKjxzCdYENW C81bI7XKvU/H8FDMOlxcsc6v7wUZRv1t+WnWHjcY35ZhsDRX5BY8h+2QhB21F63kXxHU hb5ZPY1OkcRqRB0QozS1W3Fqp7qPjQmeW3VLxVe+kKwzyBiPf0wDDvHfdAMrLhBOe8Eu cYlw== 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=wr8RlgOBQK+lZKQOUvmEh0ytBymCGpyT+5O+C4ZgoYs=; b=mJgKktLRlMvOvCW6WrggXfuS8YPQT2Z4bEFXzUbJuBSQGEzGt9JFcSuKZgyuqDZPNm Pp6K8XrZMbHLAQiqQeQ9/BtBck4BPhI5H8TIAzalXjhPH1/CjFmPP43vhhXShlrcuUbj YHWUFvEYzqkq2XfSWQZLjnaSCJkNibQDjaOTkuVDL2y8qCwZ3Q4fw0PWgyFm6dhFpoyF NGZXpPvVSXyCPLwwvYkQwphch9VFcfryCH3II0OMygYFuyaO3Z5vgk2qnq5Ilx1vbTZ3 tUN6C9b48r/p3Ss6lnng4A/ScTMAbPg61tnTdIEu+yG/6CiBSQVIVHfw44+IsZSAvWO4 XHyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AG4Qohl8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c188si1715921qkb.310.2020.02.06.09.36.56 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Feb 2020 09:36:56 -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=fail header.i=@linaro.org header.s=google header.b=AG4Qohl8; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:43416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izl5D-00062J-S8 for patch@linaro.org; Thu, 06 Feb 2020 12:36:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43304) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izkzM-00065H-GX for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:30:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izkzL-0003xh-BL for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:30:52 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:44167) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izkzK-0003pP-59 for qemu-devel@nongnu.org; Thu, 06 Feb 2020 12:30:51 -0500 Received: by mail-wr1-x431.google.com with SMTP id m16so8168129wrx.11 for ; Thu, 06 Feb 2020 09:30:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wr8RlgOBQK+lZKQOUvmEh0ytBymCGpyT+5O+C4ZgoYs=; b=AG4Qohl8KXnqXx7w1lxhvhIjoRFVP/mtyDy7TzyzuWUDFyG2HCwN6JaSrmqnz+Hg9s RJMYJAVXA6gsl09QeiusAZg61TmewYZch16aHJ5d+OeiAG4/RN2YWYP2c0FGHr0IwKGL olObe3TeoBPytc53Phc7RcuVY6XpFDguTNHPdYQYg+pFimpLvKsbQfZVfQbYybbZRqaL ADpXQmy+AITpQz4sir9M5oI6iiAdABTl6g7qZWxmCVidBeNjc5KOeD80Iw7lnAQOo85k +6b+S0qjcQCGtEVsb4sZmwzOmvh6twdwcaU5k8Df2pHPqGo06nnKJhoBfZwk8kLOIDaa Hyig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wr8RlgOBQK+lZKQOUvmEh0ytBymCGpyT+5O+C4ZgoYs=; b=UHk2/hMKmlwkiYRaZ5xgXuU3BdXhQTouU1qx6HIyDB4abEbCoHGu5987ovGlLnvOsA a6AWfFubN23Io9XON+R3jTIcJfOLnfI6Ttf0tfR3kprvQRaywLabWE6EapzxmuqdvpN+ +RcLKbGkzEhjAqGIvI9dawVphMFm99A/N4Hk/G/EqWwqA1Gw8FPalXuegi2UHW35VUHD XsbfUUcWP51TohGkAtT7h7cWUQzGGaPUoELdbP2u4R1YAXJHS3VVIaiFEAzAuOD2Wh8M 9q7FXcLpygFgEosWjOrXhWASSOcEp8O8fFmESF0E7ZtzT4Pr3/3QVVEsnPsT1zt4cnAK Uuiw== X-Gm-Message-State: APjAAAXyidt/UGY9p6OpqgZ25/Yi6qjbNfBZ0U8CnodhNotwSM7HVa8O nABaxA95Jesj6cKgqgwKVtckueiISao= X-Received: by 2002:a05:6000:1201:: with SMTP id e1mr4969750wrx.386.1581010248573; Thu, 06 Feb 2020 09:30:48 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w15sm5204214wrs.80.2020.02.06.09.30.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 09:30:47 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 02/29] configure: Check that sphinx-build is using Python 3 Date: Thu, 6 Feb 2020 17:30:13 +0000 Message-Id: <20200206173040.17337-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200206173040.17337-1-peter.maydell@linaro.org> References: <20200206173040.17337-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 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: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Markus Armbruster , Michael Roth , Stefan Hajnoczi , John Snow Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 --- configure | 12 ++++++++++-- docs/conf.py | 10 ++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) -- 2.20.1 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.