From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.5442.1685059794045210915 for ; Thu, 25 May 2023 17:09:54 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CCVpnLc5; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: gua.guo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685059794; x=1716595794; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/+Zfxvw6+MJ6K7oUeOvBHDz6Pn7is7/T9hUuFAFg/KM=; b=CCVpnLc5Mk0mbF35v9ktHjEK4QfTjhMMCfDohqntk4d4tAGv6UxKGi7p aHp6CVTdjJASXsAx28Aw3/Bt9x4TpTohU33Q0fw/1EglRGgieBrzqMvz2 r97v3MYcK5nLHs1OrmC8OMAPzPq5iu2DEocClUuaYcYYgaZofz9uhB8YJ wDUrfGMmmSwGr43C6Ou5jhoQhWhNqpEj2nDNi9SntW6FRj0XozqmbdxdJ tI8tYGeTeo2MKh7h2X27CmA/ryUfMU1jia3PCY8xXB0ln6oXm3cgJ4NC2 2V8eZ9VjeWrZ8Peoab4vdpOIGqe3GHVqmb6HThjDWvn68TlZTd1y8+D1Z A==; X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="354083923" X-IronPort-AV: E=Sophos;i="6.00,192,1681196400"; d="scan'208";a="354083923" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 17:09:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="699218635" X-IronPort-AV: E=Sophos;i="6.00,192,1681196400"; d="scan'208";a="699218635" Received: from gguo-desk.gar.corp.intel.com ([10.5.215.23]) by orsmga007.jf.intel.com with ESMTP; 25 May 2023 17:09:51 -0700 From: "Guo, Gua" To: devel@edk2.groups.io Cc: gua.guo@intel.com, Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME Date: Fri, 26 May 2023 08:09:48 +0800 Message-Id: <20230526000948.1862-1-gua.guo@intel.com> X-Mailer: git-send-email 2.39.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Gua Guo Ideally behavior is like below order that can support one local build machine, clone multiple Edk2, some of edk2 repo use old tag and some of edk2 repo use new tag, they can both support on one machine. 1. if defined PYTHON_COMMAND only - use PYTHON_COMMAND =3D user assigned 2. if not defined PYTHON_COMMAND, auto detect py -3 - use PYTHON_COMMAND =3D py -3 3. if defined PYTHON_COMMAND and PYTHON_HOME, use PYTHON_COMMAND - use PYTHON_COMMAND =3D user assigned 4. if defined PYTHON_HOME only, - use PYTHON_COMMAND =3D %PYTHON_HOME%/python.exe SCRIPT_ERROR should return for paraent batch file to consume for error handle. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Gua Guo --- BaseTools/toolsetup.bat | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 9521f67c02..8aef28192e 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -313,23 +313,25 @@ if not defined PYTHON_COMMAND ( )=0D )=0D =0D -if defined PYTHON_HOME (=0D - if EXIST "%PYTHON_HOME%" (=0D - set PYTHON_COMMAND=3D%PYTHON_HOME%\python.exe=0D - ) else (=0D - echo .=0D - echo !!! ERROR !!! PYTHON_HOME=3D"%PYTHON_HOME%" does not exist.=0D - echo .=0D - goto end=0D +if not defined PYTHON_COMMAND (=0D + if defined PYTHON_HOME (=0D + if EXIST "%PYTHON_HOME%" (=0D + set PYTHON_COMMAND=3D%PYTHON_HOME%\python.exe=0D + ) else (=0D + echo .=0D + echo !!! ERROR !!! PYTHON_HOME=3D"%PYTHON_HOME%" does not exist.=0D + echo .=0D + goto end=0D + )=0D )=0D -)=0D =0D -%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% = %PYTHON_VER_MINOR% >NUL 2>NUL=0D -if %ERRORLEVEL% EQU 1 (=0D - echo.=0D - echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer= is required.=0D - echo.=0D - goto end=0D + %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR= % %PYTHON_VER_MINOR% >NUL 2>NUL=0D + if %ERRORLEVEL% EQU 1 (=0D + echo.=0D + echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or new= er is required.=0D + echo.=0D + goto end=0D + )=0D )=0D if %ERRORLEVEL% NEQ 0 (=0D echo.=0D @@ -447,5 +449,4 @@ set VS2015=3D set VSTool=3D=0D set PYTHON_VER_MAJOR=3D=0D set PYTHON_VER_MINOR=3D=0D -set SCRIPT_ERROR=3D=0D popd=0D --=20 2.39.2.windows.1