public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME
@ 2023-05-26  0:09 Guo, Gua
  2023-05-26 16:29 ` Rebecca Cran
  0 siblings, 1 reply; 4+ messages in thread
From: Guo, Gua @ 2023-05-26  0:09 UTC (permalink / raw)
  To: devel; +Cc: gua.guo, Rebecca Cran, Liming Gao, Bob Feng, Yuwei Chen

From: Gua Guo <gua.guo@intel.com>

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 = user assigned
2. if not defined PYTHON_COMMAND, auto detect py -3
   - use PYTHON_COMMAND = py -3
3. if defined PYTHON_COMMAND and PYTHON_HOME, use PYTHON_COMMAND
   - use PYTHON_COMMAND = user assigned
4. if defined PYTHON_HOME only,
   - use PYTHON_COMMAND = %PYTHON_HOME%/python.exe

SCRIPT_ERROR should return for paraent batch file to consume
for error handle.

Cc: Rebecca Cran <rebecca@bsdio.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Gua Guo <gua.guo@intel.com>
---
 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 (
   )
 )
 
-if defined PYTHON_HOME (
-  if EXIST "%PYTHON_HOME%" (
-    set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
-  ) else (
-    echo .
-    echo !!! ERROR !!!  PYTHON_HOME="%PYTHON_HOME%" does not exist.
-    echo .
-    goto end
+if not defined PYTHON_COMMAND (
+  if defined PYTHON_HOME (
+    if EXIST "%PYTHON_HOME%" (
+      set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
+    ) else (
+      echo .
+      echo !!! ERROR !!!  PYTHON_HOME="%PYTHON_HOME%" does not exist.
+      echo .
+      goto end
+    )
   )
-)
 
-%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% %PYTHON_VER_MINOR% >NUL 2>NUL
-if %ERRORLEVEL% EQU 1 (
-  echo.
-  echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer is required.
-  echo.
-  goto end
+  %PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% %PYTHON_VER_MINOR% >NUL 2>NUL
+  if %ERRORLEVEL% EQU 1 (
+    echo.
+    echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer is required.
+    echo.
+    goto end
+  )
 )
 if %ERRORLEVEL% NEQ 0 (
   echo.
@@ -447,5 +449,4 @@ set VS2015=
 set VSTool=
 set PYTHON_VER_MAJOR=
 set PYTHON_VER_MINOR=
-set SCRIPT_ERROR=
 popd
-- 
2.39.2.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-26 17:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-26  0:09 [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME Guo, Gua
2023-05-26 16:29 ` Rebecca Cran
2023-05-26 16:56   ` Guo, Gua
2023-05-26 17:12     ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox