From: Gary Lin Date: Fri, 13 Jul 2018 10:18:38 +0000 (+0800) Subject: BaseTools: Treat BPDG.py as a python module X-Git-Tag: edk2-stable201903~1408 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=9f3594782de9051cbf599f9af006903ed3f6669e;hp=0ff3b52e065cc702a64d5a9016ee7926025dfbc7 BaseTools: Treat BPDG.py as a python module Since BPDG.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 --- diff --git a/BaseTools/BinWrappers/PosixLike/BPDG b/BaseTools/BinWrappers/PosixLike/BPDG index 01ae23ddeb..bca1bae96a 100755 --- a/BaseTools/BinWrappers/PosixLike/BPDG +++ b/BaseTools/BinWrappers/PosixLike/BPDG @@ -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/BPDG.bat b/BaseTools/BinWrappers/WindowsLike/BPDG.bat index 9fbb704a6e..98095cfbd4 100644 --- a/BaseTools/BinWrappers/WindowsLike/BPDG.bat +++ b/BaseTools/BinWrappers/WindowsLike/BPDG.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% %*