From: "Guo, Gua" <gua.guo@intel.com>
To: devel@edk2.groups.io
Cc: gua.guo@intel.com, Rebecca Cran <rebecca@bsdio.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Bob Feng <bob.c.feng@intel.com>,
Yuwei Chen <yuwei.chen@intel.com>
Subject: [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME
Date: Fri, 26 May 2023 08:09:48 +0800 [thread overview]
Message-ID: <20230526000948.1862-1-gua.guo@intel.com> (raw)
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
next reply other threads:[~2023-05-26 0:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-26 0:09 Guo, Gua [this message]
2023-05-26 16:29 ` [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME Rebecca Cran
2023-05-26 16:56 ` Guo, Gua
2023-05-26 17:12 ` Rebecca Cran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230526000948.1862-1-gua.guo@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox