From nobody Mon Apr 29 03:44:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1490706596218451.9399526692614; Tue, 28 Mar 2017 06:09:56 -0700 (PDT) Received: from localhost ([::1]:53235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csqsj-0001G7-Qq for importer@patchew.org; Tue, 28 Mar 2017 09:09:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csqrt-0000y5-F4 for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:09:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csqrq-00007a-5l for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:09:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1csqrp-00007H-TH for qemu-devel@nongnu.org; Tue, 28 Mar 2017 09:08:58 -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 mx1.redhat.com (Postfix) with ESMTPS id DDC0BC7062; Tue, 28 Mar 2017 13:08:55 +0000 (UTC) Received: from localhost (ovpn-117-247.ams2.redhat.com [10.36.117.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 563868FF77; Tue, 28 Mar 2017 13:08:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DDC0BC7062 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=stefanha@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DDC0BC7062 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Date: Tue, 28 Mar 2017 14:08:43 +0100 Message-Id: <20170328130843.1931-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 28 Mar 2017 13:08:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] configure: eliminate Python dependency for --help X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ./configure script should produce --help output even if Python is not installed. Listing trace backends is simple: show the names of all Python modules in scripts/tracetool/backend/ whose source code contains 'PUBLIC =3D True'. Perform the backend enumeration in shell instead of Python so that we can move the Python check until after ./configure --help. Reported-by: Peter Maydell Signed-off-by: Stefan Hajnoczi --- configure | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/configure b/configure index d1ce33b..52b6ab3 100755 --- a/configure +++ b/configure @@ -1186,21 +1186,6 @@ for opt do esac done =20 -if ! has $python; then - error_exit "Python not found. Use --python=3D/path/to/python" -fi - -# Note that if the Python conditional here evaluates True we will exit -# with status 1 which is a shell 'false' value. -if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.vers= ion_info >=3D (3,))'; then - error_exit "Cannot use '$python', Python 2.6 or later is required." \ - "Note that Python 3 or later is not yet supported." \ - "Use --python=3D/path/to/python to specify a supported Python." -fi - -# Suppress writing compiled files -python=3D"$python -B" - case "$cpu" in ppc) CPU_CFLAGS=3D"-m32" @@ -1328,7 +1313,7 @@ Advanced options (experts only): set block driver read-only whitelist (affects only QEMU, not qemu-img) --enable-trace-backends=3DB Set trace backend - Available backends: $($python $source_path/scri= pts/tracetool.py --list-backends) + Available backends: $(grep -le '^PUBLIC\s*=3D\s= *True$' scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/' | = xargs echo) --with-trace-file=3DNAME Full PATH,NAME of file to store traces Default:trace- --disable-slirp disable SLIRP userspace network connectivity @@ -1428,6 +1413,21 @@ EOF exit 0 fi =20 +if ! has $python; then + error_exit "Python not found. Use --python=3D/path/to/python" +fi + +# Note that if the Python conditional here evaluates True we will exit +# with status 1 which is a shell 'false' value. +if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.vers= ion_info >=3D (3,))'; then + error_exit "Cannot use '$python', Python 2.6 or later is required." \ + "Note that Python 3 or later is not yet supported." \ + "Use --python=3D/path/to/python to specify a supported Python." +fi + +# Suppress writing compiled files +python=3D"$python -B" + # Now we have handled --enable-tcg-interpreter and know we're not just # printing the help message, bail out if the host CPU isn't supported. if test "$ARCH" =3D "unknown"; then --=20 2.9.3