From nobody Wed May 15 18:04:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1586972099; cv=none; d=zohomail.com; s=zohoarc; b=O+MZ/CSgkMAdNSlP8cqAKnKY8jIZHdxAKDWKyGwzRFJsaZ9aJch6rWjQiz6jykFcHCVpj25jmzLydSNK6mhSaARau1bPnqJ+Rm0XqrgRoRr8XsLo10h4Gg5isJky0H8/Pi6+hujmcDnq8EYss+bhVPp1mU3kNNVdIxkgbPbIYA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586972099; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Az/gQbOKfUzruycPEWSy5QuYUfbuKgZBYvnLcR55WV8=; b=nB9Ieldm9WHEX5/KP6L0WPJCBLLz+Y/Y6EEWHpZUz9vUMdIlDKlYa2KUIDLT8B8DbczCfVfcBcA7b7hXFRWkJKTG32tL95/91dzxovtOx/NXaRkb7XCXwqhai+GkSl1ST5pT8YjH48/DEQOYiQE+Ui9WBkP4IfPmCEoM6hveOCQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1586972099289670.9078614993099; Wed, 15 Apr 2020 10:34:59 -0700 (PDT) Received: from localhost ([::1]:53141 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOlw9-0001pi-Mq for importer@patchew.org; Wed, 15 Apr 2020 13:34:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44764) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jOlus-0000gd-LX for qemu-devel@nongnu.org; Wed, 15 Apr 2020 13:33:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jOlur-0004HI-0V for qemu-devel@nongnu.org; Wed, 15 Apr 2020 13:33:38 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:48803 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 1jOluq-0004G8-PQ for qemu-devel@nongnu.org; Wed, 15 Apr 2020 13:33:36 -0400 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-101-KHugAyvnMuuViLQUwUIZRg-1; Wed, 15 Apr 2020 13:33:31 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DA1E0107ACC4; Wed, 15 Apr 2020 17:33:30 +0000 (UTC) Received: from probe.redhat.com (ovpn-119-33.rdu2.redhat.com [10.10.119.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B3EB19488; Wed, 15 Apr 2020 17:33:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586972015; 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; bh=Az/gQbOKfUzruycPEWSy5QuYUfbuKgZBYvnLcR55WV8=; b=Y2l2hgpxsAUKiOJiOUd2Zu/nTa1ymbmc8ZkRpvZqikEVkmXIScBbIGQcvkgNdzupZz65Ws JYlP30kDZNNFb53x6/ts4z+XLSRMuPIHttvE/1+4mpi8sH6/2gdfidcpsoNpiOMYPVELMS ggXurqiCmAr7Yi/qHHJ9/I0Yl38xJWA= X-MC-Unique: KHugAyvnMuuViLQUwUIZRg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH RFC] configure: prefer sphinx-build to sphinx-build-3 Date: Wed, 15 Apr 2020 13:33:29 -0400 Message-Id: <20200415173329.4920-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.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: John Snow , peter.maydell@linaro.org, philmd@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" sphinx-build is the name of the script entry point from the sphinx package itself. sphinx-build-3 is a pacakging convention by Linux distributions. Prefer, where possible, the canonical package name. In the event that this resolves to a python2 version, test the suitability of the binary early in the configuration process, and continue looking for sphinx-build-3 if necessary. This prioritizes a virtual environment version of sphinx above any distribution versions, if attempting to build of a virtual python environment. Signed-off-by: John Snow --- configure | 50 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/configure b/configure index 233c671aaa..82143e8a41 100755 --- a/configure +++ b/configure @@ -928,13 +928,34 @@ do fi done =20 +# Check we have a new enough version of sphinx-build +test_sphinx_build() { + sphinx=3D$1 + # This is a bit awkward but works: create a trivial document and + # try to run it with our configuration file (which enforces a + # version requirement). This will fail if either + # sphinx-build doesn't exist at all or if it is too old. + mkdir -p "$TMPDIR1/sphinx" + touch "$TMPDIR1/sphinx/index.rst" + "$sphinx" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMPDIR1/s= phinx/out" >/dev/null 2>&1 +} + +# We require the python3 version of sphinx, but sphinx-build-3 is a +# distro package. prefer 'sphinx-build' to find the venv version, if +# any, but ensure it is a suitable version. sphinx_build=3D -for binary in sphinx-build-3 sphinx-build +sphinx_ok=3D +for binary in sphinx-build sphinx-build-3 do if has "$binary" then - sphinx_build=3D$(command -v "$binary") - break + sphinx_candidate=3D$(command -v "$binary") + if test_sphinx_build "$sphinx_candidate" + then + sphinx_build=3D$sphinx_candidate + sphinx_ok=3Dyes + break + fi fi done =20 @@ -4928,24 +4949,17 @@ if check_include sys/kcov.h ; then kcov=3Dyes fi =20 -# Check we have a new enough version of sphinx-build -has_sphinx_build() { - # This is a bit awkward but works: create a trivial document and - # try to run it with our configuration file (which enforces a - # version requirement). This will fail if either - # sphinx-build doesn't exist at all or if it is too old. - mkdir -p "$TMPDIR1/sphinx" - touch "$TMPDIR1/sphinx/index.rst" - "$sphinx_build" -c "$source_path/docs" -b html "$TMPDIR1/sphinx" "$TMP= DIR1/sphinx/out" >/dev/null 2>&1 -} - # Check if tools are available to build documentation. if test "$docs" !=3D "no" ; then - if has_sphinx_build; then - sphinx_ok=3Dyes - else - sphinx_ok=3Dno + + if [ "$sphinx_ok" !=3D "yes" ]; then + if test_sphinx_build "$sphinx_build"; then + sphinx_ok=3Dyes + else + sphinx_ok=3Dno + fi fi + if has makeinfo && has pod2man && test "$sphinx_ok" =3D "yes"; then docs=3Dyes else --=20 2.21.1