From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by mx.groups.io with SMTP id smtpd.web10.38455.1683393865387617806 for ; Sat, 06 May 2023 10:24:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="signature has expired" header.i=@bsdio.com header.s=fm1 header.b=0YtKGEZD; spf=pass (domain: bsdio.com, ip: 66.111.4.27, mailfrom: rebecca@bsdio.com) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B41C15C0258; Sat, 6 May 2023 13:24:24 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sat, 06 May 2023 13:24:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdio.com; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1683393864; x= 1683480264; bh=lFHSN7K3IVQProLkXPocQxApzV3DgTrDNoGBlwxgM28=; b=0 YtKGEZDOdmhUNlqChD4yXvCXVXLjDG9pMpoJ1TZ1gju9RyJgO2HzTDOrt5XkHpxc HFWVVOfo0RrZNZCx/Hl10q3tDeDknqEFpdxlDJr8MqJKQKFJ6o8Ctu1MVpP/lnt4 F42oDX0+tkRyMHG87dVN1/8rDAm5GeibsEEbNJD6YxlB7BQyQ1bpbVbh24mhm5bO QSMPr/xvN7lcAcEk44NjhUdepIna+KjqD1LNX+wKmr9y8y9UhC7QX5eBAhLZiXb/ 7FvF7kFuxg/emnRKUgtVdyLAkIsBkTLda7h4yDubyzg/J0T2c8pT/bNA9UYE5Lth /AOkd53haVizfo8ydwP7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1683393864; x= 1683480264; bh=lFHSN7K3IVQProLkXPocQxApzV3DgTrDNoGBlwxgM28=; b=Y t2Gtdu/ZvQpzbeuZs4rzDV+3mzQa488Fb8jqltC3dDQCka3IUG6rSXlBXjnK+l+p iiSLWJW/u4yln8/DgXD6ZLLixe6UCdVXUdV6jfnagfBaF9+nhAkhW+69CDLob1bX 2A6DFwHYuj9BtolOVT7sGolOtysaRX6fD+wf1PDPh10IeGS8aA/GgWoqSONvx1Cd alJgG0zHgmeI7ydkInf2urB9/M58Ja8McSqbsVMGXA+wsKTfzhYmJ/vFHWrNB05A lK6J3kVojyCX8nCXKq5bBCyNmh10BJ6/6zp+9h72oW7O75TDU/SRIlUl22Zvjo6M BW4COJRkOmLlQFJjP9YNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeefgedgkeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptfgvsggv tggtrgcuvehrrghnuceorhgvsggvtggtrgessghsughiohdrtghomheqnecuggftrfgrth htvghrnhepgeffueeuledvgefgvddvgfetvdduhfefkedukeeikedtudekfeetteeifedv leefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprh gvsggvtggtrgessghsughiohdrtghomh X-ME-Proxy: Feedback-ID: i5b994698:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 6 May 2023 13:24:23 -0400 (EDT) From: "Rebecca Cran" To: devel@edk2.groups.io, Andrew Fish , Leif Lindholm , Michael D Kinney , Liming Gao , Bob Feng , Yuwei Chen Cc: Rebecca Cran Subject: [PATCH v2 4/7] BaseTools: Remove Python2/Python3 detection from toolset.bat Date: Sat, 6 May 2023 11:23:59 -0600 Message-Id: <20230506172402.116-5-rebecca@bsdio.com> X-Mailer: git-send-email 2.40.0.windows.1 In-Reply-To: <20230506172402.116-1-rebecca@bsdio.com> References: <20230506172402.116-1-rebecca@bsdio.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since Python3 is now required, we can remove the checks for PYTHON3_ENABLE and PYTHON3 and simplify the code in toolsetup.bat. Also, remove the leftover from when we supported freezing Python code. While here, fix a couple of typos and improve error messages. Signed-off-by: Rebecca Cran --- BaseTools/toolsetup.bat | 64 +++++--------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 25d13d559cd6..3d13e9fad286 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -305,18 +305,8 @@ goto check_build_environment ) :defined_python -if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE ( - goto check_python_available -) -if defined PYTHON3_ENABLE ( - if "%PYTHON3_ENABLE%" EQU "TRUE" ( - set PYTHON_COMMAND=py -3 - goto check_python_available - ) else ( - goto check_python2 - ) -) -if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE ( + +if not defined PYTHON_COMMAND ( set PYTHON_COMMAND=py -3 py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1 setlocal enabledelayedexpansion @@ -328,56 +318,40 @@ if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE ( set PYTHON_COMMAND= echo. echo !!! ERROR !!! Binary python tools are missing. - echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME - echo Environment variable is not set successfully. - echo They is required to build or execute the python tools. + echo PYTHON_COMMAND or PYTHON_HOME + echo Environment variable is not set correctly. + echo They are required to build or execute the python tools. echo. goto end - ) else ( - goto check_python2 ) - ) else ( - goto check_freezer_path ) ) -:check_python2 endlocal + if defined PYTHON_HOME ( if EXIST "%PYTHON_HOME%" ( set PYTHON_COMMAND=%PYTHON_HOME%\python.exe - goto check_python_available + ) else ( + echo . + echo !!! ERROR !!! PYTHON_HOME="%PYTHON_HOME%" does not exist. + echo . + goto end ) ) -if defined PYTHONHOME ( - if EXIST "%PYTHONHOME%" ( - set PYTHON_HOME=%PYTHONHOME% - set PYTHON_COMMAND=%PYTHON_HOME%\python.exe - goto check_python_available - ) -) -echo. -echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist -echo. -goto end -:check_python_available + %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1 setlocal enabledelayedexpansion set /p PythonCheck=<"PythonCheck.txt" del PythonCheck.txt if "!PythonCheck!" NEQ "TRUE" ( echo. - echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables + echo ! ERROR ! PYTHON_COMMAND="%PYTHON_COMMAND%" is not installed or added to environment variables echo. goto end - ) else ( - goto check_freezer_path - ) +) - - -:check_freezer_path - endlocal +endlocal %PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL if %ERRORLEVEL% EQU 0 ( @@ -404,13 +378,7 @@ goto end :print_python_info echo PATH = %PATH% - if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" ( - echo PYTHON3_ENABLE = %PYTHON3_ENABLE% - echo PYTHON3 = %PYTHON_COMMAND% - ) else ( - echo PYTHON3_ENABLE = FALSE - echo PYTHON_COMMAND = %PYTHON_COMMAND% - ) + echo PYTHON_COMMAND = %PYTHON_COMMAND% echo PYTHONPATH = %PYTHONPATH% echo. -- 2.40.0.windows.1