From 0f8323b44b20c982f303cc01ccf7146556bc3d4d Mon Sep 17 00:00:00 2001 From: Gua Guo Date: Fri, 26 May 2023 07:55:11 +0800 Subject: BaseTools: toolsetup.bat always execute PYTHON_HOME 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 Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Gua Guo Reviewed-by: Rebecca Cran --- BaseTools/toolsetup.bat | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 9521f67c02..22bd0faeb9 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -313,14 +313,16 @@ 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 + ) ) ) @@ -447,5 +449,4 @@ set VS2015= set VSTool= set PYTHON_VER_MAJOR= set PYTHON_VER_MINOR= -set SCRIPT_ERROR= popd -- cgit v1.2.3