Since GenFds.py import modules from its own directory, add "-m" to the
python parameters so that they can import its own modules after adopting
absolute import.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong....@intel.com>
Cc: Liming Gao <liming....@intel.com>
Signed-off-by: Gary Lin <g...@suse.com>
---
 BaseTools/BinWrappers/PosixLike/GenFds       | 2 +-
 BaseTools/BinWrappers/WindowsLike/GenFds.bat | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/BaseTools/BinWrappers/PosixLike/GenFds 
b/BaseTools/BinWrappers/PosixLike/GenFds
index 01ae23ddeb4f..276c7ea20733 100755
--- a/BaseTools/BinWrappers/PosixLike/GenFds
+++ b/BaseTools/BinWrappers/PosixLike/GenFds
@@ -11,4 +11,4 @@ dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
 export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
-exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"
+exec "${python_exe:-python}" -m $cmd.$cmd "$@"
diff --git a/BaseTools/BinWrappers/WindowsLike/GenFds.bat 
b/BaseTools/BinWrappers/WindowsLike/GenFds.bat
index 9fbb704a6eb0..98095cfbd439 100644
--- a/BaseTools/BinWrappers/WindowsLike/GenFds.bat
+++ b/BaseTools/BinWrappers/WindowsLike/GenFds.bat
@@ -1,3 +1,4 @@
 @setlocal
 @set ToolName=%~n0%
-@%PYTHON_HOME%\python.exe 
%BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*
+@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
+@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %*
-- 
2.18.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to