From nobody Mon Nov 25 20:30:54 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592334607; cv=none; d=zohomail.com; s=zohoarc; b=eihx2KBjOgDiip17klSyP+ZOCd//b/abeOD/eF/KPwcApT6Y7BuE/C181mMB9E6+kRfG5O1X0Lpg2O4RrUSaxtYe495Z+YaicakAZpi2BuPWxGiNfFQHw763V8HwJvbV2GPujvScOeetY5YWjkCz74gEP9vKopZjvnFDT7IDcXg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592334607; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JRqczKv1ry8MnbqQzqLLb1v1aqvQHvIx0njYzId9Vh0=; b=TIMvsKbYLYpfgo6EHs7C/dwmhncF8BwUnmX425ZXSV4uyB1gZ5ZGGeJH6Ab2e+75qgb0qk3E7l5IBIKR5Tgp9ZxSX8FKioffTk32rM89+7lQ0+YGjBfawVDy3aGzRuNyQ1yD1Y7Gjh8JVpaEgZfVfyTYEGkBpErkNDUNaPiBlnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1592334607391597.8485143098532; Tue, 16 Jun 2020 12:10:07 -0700 (PDT) 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-171-ii-fZ_J3OgytgTsAj9A5JA-1; Tue, 16 Jun 2020 15:09:57 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7247100CD41; Tue, 16 Jun 2020 19:09:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 08E03768AE; Tue, 16 Jun 2020 19:09:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 26280833B1; Tue, 16 Jun 2020 19:09:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05GJ9loU023696 for ; Tue, 16 Jun 2020 15:09:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C3D760CC0; Tue, 16 Jun 2020 19:09:47 +0000 (UTC) Received: from probe.redhat.com (ovpn-117-188.rdu2.redhat.com [10.10.117.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FCAF60BE2; Tue, 16 Jun 2020 19:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592334605; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JRqczKv1ry8MnbqQzqLLb1v1aqvQHvIx0njYzId9Vh0=; b=Q8VJPSTGSQUpySD8i2Rg+ZHqtS7lhn2aDyZWjbFqKfqNGOuPOqjALvJ9A2rTwB+NPrvwo5 xAcBn+SxP/AJjgX/iAGu/qk+Q44kBZz3mnfYhmvvbO724jThpryF8LXzGzmtLmjtJr0Qrp MVmuj1+4hWcbVPc6w1quK1EmGdkuc18= X-MC-Unique: ii-fZ_J3OgytgTsAj9A5JA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 1/1] configure: prefer python's sphinx module Date: Tue, 16 Jun 2020 15:09:42 -0400 Message-Id: <20200616190942.24624-2-jsnow@redhat.com> In-Reply-To: <20200616190942.24624-1-jsnow@redhat.com> References: <20200616190942.24624-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, peter.maydell@linaro.org, John Snow , ehabkost@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Using an explicit entry path script for sphinx can lead to confusing results: If the python binary belongs to a virtual environment, our configure script may still select a sphinx script that belongs to the system distribution packages. It is likely best to use python itself (whichever one the user provides) to resolve the sphinx script. This has a few benefits: 1. It will always be Python 3. Script entry points like 'sphinx-build' might attempt to invoke python2 -- or indeed, any version of python that the user did not specify with --python. 2. When using a user installation of sphinx, it will naturally prefer that version. 3. When using a virtual environment, it will naturally prefer that version. 4. Removing explicit python script entry points gives us greater control within the QEMU build ecosystem; we can be confident we are respecting the user's --python configuration, if any. It's my hope that this will make it simpler to integrate some optional pipenv functionality into the build for adding regression testing to our python module -- by offloading more of the python environment configuration and testing directly to the python tooling ecosystem. This would, ideally, free us up to use more modern python packages not always offered in older system distributions. (For instance, we already violate this requirement with sphinx, which does not have the necessary versions in our oldest build platforms.) Signed-off-by: John Snow --- docs/system/deprecated.rst | 19 +++++++++++++++++++ configure | 20 +++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 544ece0a45e..a762a8c8043 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -17,6 +17,25 @@ they were first deprecated in the 2.10.0 release. What follows is a list of all features currently marked as deprecated. =20 +Configure script options +------------------------ + +``--sphinx-build=3D`` (since 5.1) +''''''''''''''''''''''''''''''' + +The ``--sphinx-build`` option to select a specific sphinx-build entry +point is replaced by configuring Python accordingly. QEMU will now +default to using ``$python -m sphinx`` to use Python's preferred version +of sphinx. + +Python will generally default to preferring user packages installed with +``pip install --user`` first, and system distribution packages +second. By specifying a custom Python binary or activating a virtual +environment, Python will alter its module search behavior. As a last +resort, the PYTHONPATH environment variable can be modified to specify +an explicit directory. + + System emulator command line arguments -------------------------------------- =20 diff --git a/configure b/configure index b01b5e3bed0..e04b9d836ee 100755 --- a/configure +++ b/configure @@ -932,16 +932,6 @@ do fi done =20 -sphinx_build=3D -for binary in sphinx-build-3 sphinx-build -do - if has "$binary" - then - sphinx_build=3D$(command -v "$binary") - break - fi -done - # Check for ancillary tools used in testing genisoimage=3D for binary in genisoimage mkisofs @@ -1014,7 +1004,9 @@ for opt do ;; --python=3D*) python=3D"$optarg" ;; - --sphinx-build=3D*) sphinx_build=3D"$optarg" + --sphinx-build=3D*) + sphinx_build=3D"$optarg" + echo "--sphinx-build is deprecated. QEMU uses the specified python's= sphinx module." ;; --gcov=3D*) gcov_tool=3D"$optarg" ;; @@ -4996,6 +4988,12 @@ has_sphinx_build() { "$TMPDIR1/sphinx/out" >> config.log 2>&1 } =20 +# While we support --sphinx-build, defer to that. +# Otherwise, use the module execution feature of Python. +if ! has $sphinx_build; then + sphinx_build=3D"$python -m sphinx" +fi + # Check if tools are available to build documentation. if test "$docs" !=3D "no" ; then if has_sphinx_build; then --=20 2.21.3