From patchwork Wed Sep 18 16:14:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 11150683 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9B06A76 for ; Wed, 18 Sep 2019 16:16:21 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75385218AF for ; Wed, 18 Sep 2019 16:16:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Rd48+Gnb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 75385218AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=eu.citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iAcaw-0004BY-23; Wed, 18 Sep 2019 16:14:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iAcau-0004BC-Nl for xen-devel@lists.xenproject.org; Wed, 18 Sep 2019 16:14:16 +0000 X-Inumbo-ID: 5a1fe7fe-da2f-11e9-963c-12813bfff9fa Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5a1fe7fe-da2f-11e9-963c-12813bfff9fa; Wed, 18 Sep 2019 16:14:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1568823253; h=from:to:cc:subject:date:message-id:mime-version; bh=V2xEulYZR53SyAEl4/oduUhssb81FbTNQ1iN/Fe4JvY=; b=Rd48+Gnb0AhPYpqdR1OmnFdx3IDZndwgIv2vsLp0ru+zFUJVxN7CuzW3 kcOb26wAMfp7XiF/VKs/Yb5x27w+p2tlZysXaAkP7Fk/cDYo7BTy0WVu4 fX45D4s73jhCYDwnO/R4kLe33QJYRamPB0OfpUkiDocLNvOmOUlrGQf2k c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=ian.jackson@eu.citrix.com; spf=Pass smtp.mailfrom=Ian.Jackson@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of ian.jackson@eu.citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="ian.jackson@eu.citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of Ian.Jackson@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="Ian.Jackson@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="Ian.Jackson@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: wxag333C8jjSBPa7+VxD56j2cSLCpg/EsYJXuy36WB5SLg5dKu6T86QfvW1PPPJDrK7stdLAuI NNtH2V9UcjIlXZQcWy/FZbVQyCOqIiVV1e/kUEFmMjMha2jPdihmkiVR58GPD0h1TZxwCvTQTv ZASfbdduEC+nCqXHkzLoD5HWVBv+uyP4RZjOQkXs5O/aXZpMvWeDKKswCI+1V1BT0EIUITokE6 NJy198fnjC58zflwvmJM2AdmdpAvTqHJui8eaDWFw7lzYXe8m+XdDSs+MCDURnqqupBoptelBo Grw= X-SBRS: 2.7 X-MesageID: 5739459 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,521,1559534400"; d="scan'208";a="5739459" From: Ian Jackson To: Date: Wed, 18 Sep 2019 17:14:06 +0100 Message-ID: <20190918161406.19208-1-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] tools/configure: Allow specifying python to be found from path X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Doug Goldstein , Ian Jackson , George Dunlap , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ./configure takes a PYTHON=... argument. You can use this to specify the python interpreter. However, for no good reason, it expects an absolute path. Fix this. The new logic is: * if not set, default to `python' * if not absolute, look it up with type -p * split into directory and executable name The results in config/Tools.mk (which contains @PYTHON@ and @PYTHONPATH@) are identical for both ./configure ./configure PYTHON=/usr/bin/python so I assert this has no functional change except that now you can say ./configure PYTHON=python In particular you can now say ./configure PYTHON=python2 ./configure PYTHON=python3 The latter is useful if you want python3 (which should probably be the default, but does not work right now). The former is useful if you want python2 but your distro has foolishly made "python" refer to python3. CC: Doug Goldstein CC: Wei Liu CC: George Dunlap Signed-off-by: Ian Jackson Acked-by: Wei Liu --- tools/configure | 13 +++++++------ tools/configure.ac | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/configure b/tools/configure index 1baacea9ac..f2c66dfce9 100755 --- a/tools/configure +++ b/tools/configure @@ -6925,16 +6925,17 @@ then as_fn_error $? "Unable to find bash, please install bash" "$LINENO" 5 fi;; esac +if test -z "$PYTHON"; then : + PYTHON="python" +fi if echo "$PYTHON" | grep -q "^/"; then : - PYTHONPATH=$PYTHON - PYTHON=`basename $PYTHONPATH` - -elif test -z "$PYTHON"; then : - PYTHON="python" else - as_fn_error $? "PYTHON specified, but is not an absolute path" "$LINENO" 5 + PYTHON=`type -p "$PYTHON"` fi +PYTHONPATH=$PYTHON +PYTHON=`basename $PYTHONPATH` + # Extract the first word of "$PYTHON", so it can be a program name with args. set dummy $PYTHON; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 diff --git a/tools/configure.ac b/tools/configure.ac index 3fe04907a2..674bd5809d 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -337,11 +337,11 @@ case "$host_os" in freebsd*) ;; *) AX_PATH_PROG_OR_FAIL([BASH], [bash]);; esac -AS_IF([echo "$PYTHON" | grep -q "^/"], [ - PYTHONPATH=$PYTHON - PYTHON=`basename $PYTHONPATH` -],[test -z "$PYTHON"], [PYTHON="python"], -[AC_MSG_ERROR([PYTHON specified, but is not an absolute path])]) +AS_IF([test -z "$PYTHON"], [PYTHON="python"]) +AS_IF([echo "$PYTHON" | grep -q "^/"], [], [PYTHON=`type -p "$PYTHON"`]) +PYTHONPATH=$PYTHON +PYTHON=`basename $PYTHONPATH` + AX_PATH_PROG_OR_FAIL([PYTHONPATH], [$PYTHON]) AX_CHECK_PYTHON_VERSION([2], [6])