public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat
@ 2023-05-09  4:25 Rebecca Cran
  2023-05-09  4:25 ` [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE Rebecca Cran
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rebecca Cran @ 2023-05-09  4:25 UTC (permalink / raw)
  To: devel, Andrew Fish, Leif Lindholm, Michael D Kinney, Liming Gao,
	Bob Feng, Yuwei Chen
  Cc: Rebecca Cran

Fix some issues in BaseTools:

- When the Pip BaseTools are used, make sure PYTHONPATH is set.
- Fix Tests\TestTools.py so it works on Windows.
- Cleanup toolsetup.bat

Rebecca Cran (3):
  BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE
  BaseTools: only print the environment once in toolsetup.bat
  BaseTools: Update Tests/TestTools.py to allow it to work on Windows

 BaseTools/Tests/TestTools.py |  4 +-
 BaseTools/toolsetup.bat      | 40 +++++++++-----------
 2 files changed, 21 insertions(+), 23 deletions(-)

-- 
2.40.0.windows.1


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

* [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE
  2023-05-09  4:25 [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
@ 2023-05-09  4:25 ` Rebecca Cran
  2023-05-09  4:25 ` [edk2-stable202305 PATCH 2/3] BaseTools: only print the environment once in toolsetup.bat Rebecca Cran
  2023-05-10 22:30 ` [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
  2 siblings, 0 replies; 5+ messages in thread
From: Rebecca Cran @ 2023-05-09  4:25 UTC (permalink / raw)
  To: devel, Andrew Fish, Leif Lindholm, Michael D Kinney, Liming Gao,
	Bob Feng, Yuwei Chen
  Cc: Rebecca Cran

The BASETOOLS_PYTHON_SOURCE environment variable is only used temporarily to
set PYTHONPATH. Since it doesn't help improve clarity, remove it.

While here, make sure we set PYTHONPATH when we're using Pip BaseTools
so that build etc. can be found.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/toolsetup.bat | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index dc6288effd7d..85104aa224da 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -371,14 +371,13 @@ if %ERRORLEVEL% EQU 0 (
   @echo Using EDK2 in-source Basetools
   if defined BASETOOLS_PYTHON_SOURCE goto print_python_info
   set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"
-  set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
-  set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
+  set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python;%PYTHONPATH%
   goto print_python_info
 
 :use_pip_basetools
   @echo Using Pip Basetools
   set "PATH=%BASE_TOOLS_PATH%\BinPipWrappers\WindowsLike;%PATH%"
-  set BASETOOLS_PYTHON_SOURCE=edk2basetools
+  set PYTHONPATH=%BASE_TOOLS_PATH%\Source\Python;%PYTHONPATH%
   goto print_python_info
 
 :print_python_info
-- 
2.40.0.windows.1


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

* [edk2-stable202305 PATCH 2/3] BaseTools: only print the environment once in toolsetup.bat
  2023-05-09  4:25 [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
  2023-05-09  4:25 ` [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE Rebecca Cran
@ 2023-05-09  4:25 ` Rebecca Cran
  2023-05-10 22:30 ` [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
  2 siblings, 0 replies; 5+ messages in thread
From: Rebecca Cran @ 2023-05-09  4:25 UTC (permalink / raw)
  To: devel, Andrew Fish, Leif Lindholm, Michael D Kinney, Liming Gao,
	Bob Feng, Yuwei Chen
  Cc: Rebecca Cran

Avoid printing %PATH% twice: move the printing of the environment down
to print_python_info.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
---
 BaseTools/toolsetup.bat | 35 +++++++++-----------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 85104aa224da..9521f67c024e 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -250,24 +250,6 @@ if NOT exist %CONF_PATH%\build_rule.txt (
   if defined RECONFIG copy /Y %EDK_TOOLS_PATH%\Conf\build_rule.template %CONF_PATH%\build_rule.txt > nul
 )
 
-echo           PATH      = %PATH%
-echo.
-if defined WORKSPACE (
-  echo      WORKSPACE      = %WORKSPACE%
-)
-if defined PACKAGES_PATH (
-  echo  PACKAGES_PATH      = %PACKAGES_PATH%
-)
-echo EDK_TOOLS_PATH      = %EDK_TOOLS_PATH%
-if defined BASE_TOOLS_PATH (
-  echo BASE_TOOLS_PATH     = %BASE_TOOLS_PATH%
-)
-if defined EDK_TOOLS_BIN (
-  echo  EDK_TOOLS_BIN      = %EDK_TOOLS_BIN%
-)
-echo      CONF_PATH      = %CONF_PATH%
-echo.
-
 :skip_reconfig
 
 @REM
@@ -381,7 +363,22 @@ if %ERRORLEVEL% EQU 0 (
   goto print_python_info
 
 :print_python_info
-  echo                PATH = %PATH%
+  echo           PATH      = %PATH%
+  echo.
+  if defined WORKSPACE (
+    echo      WORKSPACE      = %WORKSPACE%
+  )
+  if defined PACKAGES_PATH (
+    echo  PACKAGES_PATH      = %PACKAGES_PATH%
+  )
+  echo EDK_TOOLS_PATH      = %EDK_TOOLS_PATH%
+  if defined BASE_TOOLS_PATH (
+    echo BASE_TOOLS_PATH     = %BASE_TOOLS_PATH%
+  )
+  if defined EDK_TOOLS_BIN (
+    echo  EDK_TOOLS_BIN      = %EDK_TOOLS_BIN%
+  )
+  echo      CONF_PATH      = %CONF_PATH%
   echo      PYTHON_COMMAND = %PYTHON_COMMAND%
   echo          PYTHONPATH = %PYTHONPATH%
   echo.
-- 
2.40.0.windows.1


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

* Re: [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat
  2023-05-09  4:25 [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
  2023-05-09  4:25 ` [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE Rebecca Cran
  2023-05-09  4:25 ` [edk2-stable202305 PATCH 2/3] BaseTools: only print the environment once in toolsetup.bat Rebecca Cran
@ 2023-05-10 22:30 ` Rebecca Cran
  2023-05-11  1:37   ` 回复: [edk2-devel] " gaoliming
  2 siblings, 1 reply; 5+ messages in thread
From: Rebecca Cran @ 2023-05-10 22:30 UTC (permalink / raw)
  To: devel, Andrew Fish, Leif Lindholm, Michael D Kinney, Liming Gao,
	Bob Feng, Yuwei Chen

Mike/Liming:


I'd like to get this in for the upcoming stable tag.

The PR is https://github.com/tianocore/edk2/pull/4363 .


-- 
Rebecca Cran


On 5/8/23 22:25, Rebecca Cran wrote:
> Fix some issues in BaseTools:
>
> - When the Pip BaseTools are used, make sure PYTHONPATH is set.
> - Fix Tests\TestTools.py so it works on Windows.
> - Cleanup toolsetup.bat
>
> Rebecca Cran (3):
>    BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE
>    BaseTools: only print the environment once in toolsetup.bat
>    BaseTools: Update Tests/TestTools.py to allow it to work on Windows
>
>   BaseTools/Tests/TestTools.py |  4 +-
>   BaseTools/toolsetup.bat      | 40 +++++++++-----------
>   2 files changed, 21 insertions(+), 23 deletions(-)
>

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

* 回复: [edk2-devel] [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat
  2023-05-10 22:30 ` [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
@ 2023-05-11  1:37   ` gaoliming
  0 siblings, 0 replies; 5+ messages in thread
From: gaoliming @ 2023-05-11  1:37 UTC (permalink / raw)
  To: devel, rebecca, 'Andrew Fish', 'Leif Lindholm',
	'Michael D Kinney', 'Bob Feng',
	'Yuwei Chen'

Rebecca:
  I just add PUSH label for this change. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Rebecca Cran
> 发送时间: 2023年5月11日 6:30
> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Leif
> Lindholm <quic_llindhol@quicinc.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Bob Feng <bob.c.feng@intel.com>; Yuwei Chen <yuwei.chen@intel.com>
> 主题: Re: [edk2-devel] [edk2-stable202305 PATCH 0/3] BaseTools: Fix
> PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat
> 
> Mike/Liming:
> 
> 
> I'd like to get this in for the upcoming stable tag.
> 
> The PR is https://github.com/tianocore/edk2/pull/4363 .
> 
> 
> --
> Rebecca Cran
> 
> 
> On 5/8/23 22:25, Rebecca Cran wrote:
> > Fix some issues in BaseTools:
> >
> > - When the Pip BaseTools are used, make sure PYTHONPATH is set.
> > - Fix Tests\TestTools.py so it works on Windows.
> > - Cleanup toolsetup.bat
> >
> > Rebecca Cran (3):
> >    BaseTools: Update toolsetup.bat to not use
> BASETOOLS_PYTHON_SOURCE
> >    BaseTools: only print the environment once in toolsetup.bat
> >    BaseTools: Update Tests/TestTools.py to allow it to work on Windows
> >
> >   BaseTools/Tests/TestTools.py |  4 +-
> >   BaseTools/toolsetup.bat      | 40 +++++++++-----------
> >   2 files changed, 21 insertions(+), 23 deletions(-)
> >
> 
> 
> 
> 




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

end of thread, other threads:[~2023-05-11  1:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-09  4:25 [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
2023-05-09  4:25 ` [edk2-stable202305 PATCH 1/3] BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE Rebecca Cran
2023-05-09  4:25 ` [edk2-stable202305 PATCH 2/3] BaseTools: only print the environment once in toolsetup.bat Rebecca Cran
2023-05-10 22:30 ` [edk2-stable202305 PATCH 0/3] BaseTools: Fix PYTHONPATH on Windows, Tests\TestTools.py and cleanup toolsetup.bat Rebecca Cran
2023-05-11  1:37   ` 回复: [edk2-devel] " gaoliming

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