BaseTools: Treat Ecc.py as a python module
authorGary Lin <glin@suse.com>
Fri, 13 Jul 2018 10:18:41 +0000 (18:18 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 16 Jul 2018 03:22:16 +0000 (11:22 +0800)
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 <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
BaseTools/BinWrappers/PosixLike/Ecc
BaseTools/BinWrappers/WindowsLike/Ecc.bat

index 01ae23d..bca1bae 100755 (executable)
@@ -11,4 +11,4 @@ dir=$(dirname "$full_cmd")
 cmd=${full_cmd##*/}
 
 export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
 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 "$@"\r
index 9fbb704..98095cf 100644 (file)
@@ -1,3 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
+@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %*\r