From e52b39ab8e9911dacb2c83a87bfe483397f1ea5f Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Fri, 13 Jul 2018 18:18:41 +0800 Subject: [PATCH] BaseTools: Treat Ecc.py as a python module Since Ecc.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 Cc: Liming Gao Signed-off-by: Gary Lin Reviewed-by: Jaben Carsey --- BaseTools/BinWrappers/PosixLike/Ecc | 2 +- BaseTools/BinWrappers/WindowsLike/Ecc.bat | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/Ecc index 01ae23ddeb..bca1bae96a 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -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/Ecc.bat b/BaseTools/BinWrappers/WindowsLike/Ecc.bat index 9fbb704a6e..98095cfbd4 100644 --- a/BaseTools/BinWrappers/WindowsLike/Ecc.bat +++ b/BaseTools/BinWrappers/WindowsLike/Ecc.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.39.2