From nobody Thu May 16 03:10:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.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=1566835301; cv=none; d=zoho.com; s=zohoarc; b=JMUGhF/u4pkBPrX5IB0Yo1GdcQr47nG4E/35wWjkuRQ1AU35At73yA4sRvq/moT2UiPgYf7Tb0sQavhODgu4iBLZTsdQVLsl1JXKD0y+sYEE1ehoRWdZZKTRDNwgo7mOP99dPrPxkGcNLuckkxSIR22Lg6RV1mFLrDnxd6IDMvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566835301; h=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:ARC-Authentication-Results; bh=4vjawQHO5XjoC74RQZ4+LHIpLcmAE0HCkI9KKJdN2Jc=; b=lKJqfEEF4+t9cF5bz72I8cPGAtoV6J0Hvf0HybMTMvtgif09GcEPKyt3Acc4/uXzL5s1bvIaK01+JCNllBiIj49v+RqRMPCLMkyOVOiuSlE3sKmhW9Aflodk3WXy7zgrjNCA1IVAWywI5/n4ZirbNgqhIKJWwc3KnIAkUFZ1FhA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1566835301465336.3655795603322; Mon, 26 Aug 2019 09:01:41 -0700 (PDT) Received: from localhost ([::1]:55082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2HR0-0007Tb-RU for importer@patchew.org; Mon, 26 Aug 2019 12:01:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34263) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i2HOB-00061a-BN for qemu-devel@nongnu.org; Mon, 26 Aug 2019 11:58:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i2HO8-0008Ew-TS for qemu-devel@nongnu.org; Mon, 26 Aug 2019 11:58:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34028) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i2HO8-0008Ea-OU for qemu-devel@nongnu.org; Mon, 26 Aug 2019 11:58:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B7D9105786B; Mon, 26 Aug 2019 15:58:36 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-124-81.rdu2.redhat.com [10.10.124.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDC1D1001F43; Mon, 26 Aug 2019 15:58:34 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org, Peter Maydell Date: Mon, 26 Aug 2019 11:58:32 -0400 Message-Id: <20190826155832.17427-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Mon, 26 Aug 2019 15:58:36 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] configure: more resilient Python version capture 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: Julio Montes , tony.nguyen@bt.com, Eduardo Habkost , Cleber Rosa Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The current approach to capture the Python version is fragile, as it was demonstrated by a very specific build of Python 3 on Fedora 29 that, under non-interactive shells would print multiline version information. The (badly) stripped version output would be sent to config-host.mak, producing bad syntax and rendering the makefiles unusable. Now, the Python versions is printed by configure, but only a simple (and better controlled variable) indicating whether the build system is using Python 2 is kept on config-host.mak. Signed-off-by: Cleber Rosa Reviewed-by: Tony Nguyen --- v2: Use python from '$python' variable instead of hardcoded 'python2' --- configure | 5 +++-- tests/Makefile.include | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index e44e454c43..95134c0180 100755 --- a/configure +++ b/configure @@ -1864,7 +1864,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_inf= o < (2,7))'; then fi =20 # Preserve python version since some functionality is dependent on it -python_version=3D$($python -V 2>&1 | sed -e 's/Python\ //') +python_version=3D$($python -c 'import sys; print("%d.%d.%d" % (sys.version= _info[0], sys.version_info[1], sys.version_info[2]))' 2>/dev/null) =20 # Suppress writing compiled files python=3D"$python -B" @@ -6511,6 +6511,7 @@ if ! $python -c 'import sys; sys.exit(sys.version_inf= o < (3,0))'; then echo echo "warning: Python 2 support is deprecated" >&2 echo "warning: Python 3 will be required for building future versions of= QEMU" >&2 + python2=3D"y" fi =20 config_host_mak=3D"config-host.mak" @@ -7333,7 +7334,7 @@ echo "INSTALL_DATA=3D$install -c -m 0644" >> $config_= host_mak echo "INSTALL_PROG=3D$install -c -m 0755" >> $config_host_mak echo "INSTALL_LIB=3D$install -c -m 0644" >> $config_host_mak echo "PYTHON=3D$python" >> $config_host_mak -echo "PYTHON_VERSION=3D$python_version" >> $config_host_mak +echo "PYTHON2=3D$python2" >> $config_host_mak echo "CC=3D$cc" >> $config_host_mak if $iasl -h > /dev/null 2>&1; then echo "IASL=3D$iasl" >> $config_host_mak diff --git a/tests/Makefile.include b/tests/Makefile.include index 49684fd4f4..f5ac09549c 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1135,7 +1135,7 @@ TESTS_RESULTS_DIR=3D$(BUILD_DIR)/tests/results AVOCADO_SHOW=3Dapp AVOCADO_TAGS=3D$(patsubst %-softmmu,-t arch:%, $(filter %-softmmu,$(TARGET= _DIRS))) =20 -ifneq ($(findstring v2,"v$(PYTHON_VERSION)"),v2) +ifneq ($(PYTHON2),y) $(TESTS_VENV_DIR): $(TESTS_VENV_REQ) $(call quiet-command, \ $(PYTHON) -m venv --system-site-packages $@, \ --=20 2.21.0