]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update PYTHON env to PYTHON_COMMAND
authorLiming Gao <liming.gao@intel.com>
Fri, 28 Dec 2018 08:25:04 +0000 (16:25 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Fri, 1 Feb 2019 03:09:23 +0000 (11:09 +0800)
Update PYTHON env to PYTHON_COMMAND.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
41 files changed:
BaseTools/Bin/CYGWIN_NT-5.1-i686/Ecc
BaseTools/Bin/CYGWIN_NT-5.1-i686/GenDepex
BaseTools/Bin/CYGWIN_NT-5.1-i686/GenFds
BaseTools/Bin/CYGWIN_NT-5.1-i686/TargetTool
BaseTools/Bin/CYGWIN_NT-5.1-i686/Trim
BaseTools/Bin/CYGWIN_NT-5.1-i686/build
BaseTools/BinWrappers/PosixLike/BPDG
BaseTools/BinWrappers/PosixLike/Ecc
BaseTools/BinWrappers/PosixLike/GenDepex
BaseTools/BinWrappers/PosixLike/GenFds
BaseTools/BinWrappers/PosixLike/GenPatchPcdTable
BaseTools/BinWrappers/PosixLike/GenerateCapsule
BaseTools/BinWrappers/PosixLike/PatchPcdValue
BaseTools/BinWrappers/PosixLike/Pkcs7Sign
BaseTools/BinWrappers/PosixLike/Rsa2048Sha256GenerateKeys
BaseTools/BinWrappers/PosixLike/Rsa2048Sha256Sign
BaseTools/BinWrappers/PosixLike/TargetTool
BaseTools/BinWrappers/PosixLike/Trim
BaseTools/BinWrappers/PosixLike/UPT
BaseTools/BinWrappers/PosixLike/build
BaseTools/BinWrappers/WindowsLike/BPDG.bat
BaseTools/BinWrappers/WindowsLike/Ecc.bat
BaseTools/BinWrappers/WindowsLike/GenDepex.bat
BaseTools/BinWrappers/WindowsLike/GenFds.bat
BaseTools/BinWrappers/WindowsLike/GenPatchPcdTable.bat
BaseTools/BinWrappers/WindowsLike/GenerateCapsule.bat
BaseTools/BinWrappers/WindowsLike/PatchPcdValue.bat
BaseTools/BinWrappers/WindowsLike/Pkcs7Sign.bat
BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
BaseTools/BinWrappers/WindowsLike/Rsa2048Sha256Sign.bat
BaseTools/BinWrappers/WindowsLike/TargetTool.bat
BaseTools/BinWrappers/WindowsLike/Trim.bat
BaseTools/BinWrappers/WindowsLike/UPT.bat
BaseTools/BinWrappers/WindowsLike/build.bat
BaseTools/Makefile
BaseTools/Source/C/Makefile
BaseTools/Source/Python/build/build.py
BaseTools/Tests/GNUmakefile
BaseTools/Tests/PythonTest.py [new file with mode: 0644]
BaseTools/toolsetup.bat
edksetup.sh

index 8532fe510df48f721b582c50a0e821728240a43d..1ba451cf5ef01994beda2a66bdbf4e561bc2b127 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 8532fe510df48f721b582c50a0e821728240a43d..1ba451cf5ef01994beda2a66bdbf4e561bc2b127 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 8532fe510df48f721b582c50a0e821728240a43d..1ba451cf5ef01994beda2a66bdbf4e561bc2b127 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 8532fe510df48f721b582c50a0e821728240a43d..1ba451cf5ef01994beda2a66bdbf4e561bc2b127 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 54e09c039bb44584c783364f6831895a7099bcb9..b53b79bba408400ebba2e314299807715ac2e0a9 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 8532fe510df48f721b582c50a0e821728240a43d..1ba451cf5ef01994beda2a66bdbf4e561bc2b127 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index e9f570b52cef8f72ba0f691739f4f73e96a81405..c894384908544bb09ccff3c853f55b8ad420b4be 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index ed4b7cd3845bca07f9d30d117da3e25746349010..15edf52106bd81b6b8ac43b3183e5c3fa9a3b1f7 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d99e54f222896a15f563bf1563232afe2295ca68..183cf582244b00ccc72bfd1490829b4141a80fb6 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index e9f570b52cef8f72ba0f691739f4f73e96a81405..c894384908544bb09ccff3c853f55b8ad420b4be 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 91bbd2273808f23b145beda61b2775fc3b8b6249..023048c61d5d7247e4052d42942e230d6304bf96 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index b42a1268404943049aa9ae3c97409db0be68ba72..ea71c7c61ad6aa354a49dddd162eee98d06a1e9b 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d64b834006cf53a32f41aab0a4b9ad331d2ed192..1dd28e966288f6ea4fc52d42e2dc7b1f74226c23 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index d8b8b8f14527883111fb6fa443523d39583f7a03..f3770eed42b4dfec0dfa971294dea6124a52ee67 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a ${PYTHON} command is available, use it in preference to python
-if command -v ${PYTHON} >/dev/null 2>&1; then
-    python_exe=${PYTHON}
+# If a ${PYTHON_COMMAND} command is available, use it in preference to python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
 fi
 
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
index 4a43e5353ef8cb9beb2c4e98a658c5205956f6d5..f43dba81f117c0a65bc2a157544045abf1c175a0 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON% -m %ToolName%.%ToolName% %*\r
+@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*\r
index e63ef501356ea02493d84109b7ce5c2f8885f437..ba1a15b3b8b04a20b6461b20245068496cd32c70 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON% -m %ToolName%.EccMain %*\r
+@%PYTHON_COMMAND% -m %ToolName%.EccMain %*\r
index 6c7250f00867eefca89bdcbed75f2cbdfbbc1f69..f8f3eefacfa66e3277d4239f5f92f76a06042b3c 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*\r
index 4a43e5353ef8cb9beb2c4e98a658c5205956f6d5..f43dba81f117c0a65bc2a157544045abf1c175a0 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON% -m %ToolName%.%ToolName% %*\r
+@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 1ab7d33f986b665cbe2c4285b05ef1ea368054db..11b4a48aec140ad857b693541047991fd0530b78 100644 (file)
@@ -1 +1 @@
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 32da349b312dfc1a06db00df690b9cc547748f86..6d4443b608da2978b77e79e4a363d7d58529d277 100644 (file)
@@ -1 +1 @@
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 82e0a90d6cdf0749016fdaf804ebbb2640656760..9616cd893bec9902451e6d8591f537cc408bd5e5 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 2569ea2ff49863d991c22678745878b20e95f07f..de98e0b61739a2ac0bec4fd6b1c00fa6c12e37b1 100644 (file)
@@ -20,17 +20,21 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
 all: c\r
 \r
 c :\r
-  @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $(BASE_TOOLS_PATH)\Source\C\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $(BASE_TOOLS_PATH)\Source\C\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $(BASE_TOOLS_PATH)\Source\C\r
 \r
 \r
 subdirs: $(SUBDIRS)\r
-  @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**\r
 \r
 .PHONY: clean\r
 clean:\r
-  $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)\r
 \r
 .PHONY: cleanall\r
 cleanall:\r
-  $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)\r
 \r
index dd39661272e765014187862759588818b0cbca26..08f00812122364a478662b6598c20766f5644ccd 100644 (file)
@@ -38,7 +38,8 @@ libs: $(LIBRARIES)
        @echo # Build libraries\r
        @echo ######################\r
        @if not exist $(LIB_PATH) mkdir $(LIB_PATH)\r
-       @$(PYTHON) Makefiles\NmakeSubdirs.py all $**\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py all $**\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**\r
 \r
 apps: $(APPLICATIONS)\r
        @echo.\r
@@ -46,7 +47,8 @@ apps: $(APPLICATIONS)
        @echo # Build executables\r
        @echo ######################\r
        @if not exist $(BIN_PATH) mkdir $(BIN_PATH)\r
-       @$(PYTHON) Makefiles\NmakeSubdirs.py all $**\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py all $**\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**\r
 \r
 install: $(LIB_PATH) $(BIN_PATH)\r
        @echo.\r
@@ -60,11 +62,13 @@ install: $(LIB_PATH) $(BIN_PATH)
 \r
 .PHONY: clean\r
 clean:\r
-  @$(PYTHON) Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)\r
 \r
 .PHONY: cleanall\r
 cleanall:\r
-  @$(PYTHON) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)\r
+  @if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)\r
+  @if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(PYTHON_COMMAND) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)\r
 \r
 !INCLUDE Makefiles\ms.rule\r
 \r
index b5b969e876d2d4f526c0517e8025e7e3b1cc304a..c2b22cca701e1871293348a110d3c95e4398e284 100644 (file)
@@ -796,7 +796,8 @@ class Build():
             if PYTHON3_ENABLE != "TRUE":\r
                 PYTHON3_ENABLE = "FALSE"\r
             EdkLogger.quiet("%-16s = %s" % ("PYTHON3_ENABLE", PYTHON3_ENABLE))\r
-        EdkLogger.quiet("%-16s = %s" % ("PYTHON", os.environ["PYTHON"]))\r
+        if "PYTHON_COMMAND" in os.environ:\r
+            EdkLogger.quiet("%-16s = %s" % ("PYTHON_COMMAND", os.environ["PYTHON_COMMAND"]))\r
         self.InitPreBuild()\r
         self.InitPostBuild()\r
         if self.Prebuild:\r
index d6f4e1908b7e6ae93ae900744fbba337a2cc5b65..3eb52b3f8355ef8cfdeb62d69915cd687f657434 100644 (file)
@@ -14,7 +14,7 @@
 all: test\r
 \r
 test:\r
-       @if command -v $(PYTHON) >/dev/null 1; then $(PYTHON) RunTests.py; else python RunTests.py; fi\r
+       @if command -v $(PYTHON_COMMAND) >/dev/null 1; then $(PYTHON_COMMAND) RunTests.py; else python RunTests.py; fi\r
 \r
 clean:\r
        find . -name '*.pyc' -exec rm '{}' ';'\r
diff --git a/BaseTools/Tests/PythonTest.py b/BaseTools/Tests/PythonTest.py
new file mode 100644 (file)
index 0000000..cd49dc5
--- /dev/null
@@ -0,0 +1,15 @@
+## @file\r
+# Test whether PYTHON_COMMAND is available\r
+#\r
+# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution.  The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+\r
+if __name__ == '__main__':\r
+    print('TRUE')\r
index 811b23051fd9a55280d9f54cd13df39c6deca76e..6fe63e4baa1d2fcae3bcfacc838879f17bcebe9b 100755 (executable)
@@ -286,43 +286,77 @@ goto check_build_environment
   )\r
 \r
 :defined_python\r
+if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r
+  goto check_python_available\r
+)\r
 if defined PYTHON3_ENABLE (\r
   if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
-    set PYTHON=py -3\r
-    %PYTHON% --version >NUL 2>&1\r
-    if %ERRORLEVEL% NEQ 0 (\r
+    set PYTHON_COMMAND=py -3\r
+    goto check_python_available\r
+  ) else (\r
+    goto check_python2\r
+  )\r
+)\r
+if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (\r
+  set PYTHON_COMMAND=py -3\r
+  py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r
+  setlocal enabledelayedexpansion\r
+  set /p PythonCheck=<"PythonCheck.txt"\r
+  del PythonCheck.txt\r
+  if "!PythonCheck!" NEQ "TRUE" (\r
+    if not defined PYTHON_HOME if not defined PYTHONHOME (\r
+      endlocal\r
+      set PYTHON_COMMAND=\r
       echo.\r
-      echo !!! ERROR !!!  PYTHON3 is not installed or added to environment variables\r
+      echo !!! ERROR !!! Binary python tools are missing.\r
+      echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME\r
+      echo Environment variable is not set successfully.\r
+      echo They is required to build or execute the python tools.\r
       echo.\r
       goto end\r
     ) else (\r
-      goto check_freezer_path\r
+      goto check_python2\r
     )\r
-  ) \r
+  ) else (\r
+    goto check_freezer_path\r
+  )\r
 )\r
 \r
+:check_python2\r
+endlocal\r
 if defined PYTHON_HOME (\r
   if EXIST "%PYTHON_HOME%" (\r
-    set PYTHON=%PYTHON_HOME%\python.exe\r
-    goto check_freezer_path\r
-    )\r
+    set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+    goto check_python_available\r
   )\r
+)\r
 if defined PYTHONHOME (\r
   if EXIST "%PYTHONHOME%" (\r
     set PYTHON_HOME=%PYTHONHOME%\r
-    set PYTHON=%PYTHON_HOME%\python.exe\r
+    set PYTHON_COMMAND=%PYTHON_HOME%\python.exe\r
+    goto check_python_available\r
+  )\r
+)\r
+echo.\r
+echo !!! ERROR !!!  PYTHON_HOME is not defined or The value of this variable does not exist\r
+echo.\r
+goto end\r
+:check_python_available\r
+%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1\r
+  setlocal enabledelayedexpansion\r
+  set /p PythonCheck=<"PythonCheck.txt"\r
+  del PythonCheck.txt\r
+  if "!PythonCheck!" NEQ "TRUE" (\r
+    echo.\r
+    echo ! ERROR !  "%PYTHON_COMMAND%" is not installed or added to environment variables\r
+    echo.\r
+    goto end\r
+  ) else (\r
     goto check_freezer_path\r
-    )\r
   )\r
-  \r
-  echo.\r
-  echo !!! ERROR !!! Binary python tools are missing.\r
-  echo PYTHON_HOME or PYTHON3_ENABLE environment variable is not set successfully.\r
-  echo PYTHON_HOME or PYTHON3_ENABLE is required to build or execute the python tools.\r
-  echo.\r
-  goto end\r
 \r
 :check_freezer_path\r
+  endlocal\r
   if defined BASETOOLS_PYTHON_SOURCE goto print_python_info\r
   set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"\r
   set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python\r
@@ -330,14 +364,12 @@ if defined PYTHONHOME (
 \r
 :print_python_info\r
   echo                PATH = %PATH%\r
-  if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
+  if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
     echo      PYTHON3_ENABLE = %PYTHON3_ENABLE%\r
-    echo             PYTHON3 = %PYTHON%\r
+    echo             PYTHON3 = %PYTHON_COMMAND%\r
   ) else (\r
-    echo      PYTHON3_ENABLE = %PYTHON3_ENABLE%\r
-    if defined PYTHON_HOME (\r
-      echo         PYTHON_HOME = %PYTHON_HOME%\r
-    )\r
+    echo      PYTHON3_ENABLE = FALSE\r
+    echo      PYTHON_COMMAND = %PYTHON_COMMAND%\r
   )\r
   echo          PYTHONPATH = %PYTHONPATH%\r
   echo.\r
index bfa54ddf708883e18abb9ed51f8c4bdb11ae5f07..a8897d10f80d28144155033ea3e0dbd7e30349e0 100755 (executable)
@@ -90,7 +90,7 @@ function SetupEnv()
   then
     . $WORKSPACE/BaseTools/BuildEnv
   elif [ -n "$PACKAGES_PATH" ]
-  then 
+  then
     PATH_LIST=$PACKAGES_PATH
     PATH_LIST=${PATH_LIST//:/ }
     for DIR in $PATH_LIST
@@ -111,11 +111,9 @@ function SetupEnv()
   fi
 }
 
-function SetupPython()
-{    
-  if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ]
-  then
-    if [ $origin_version ];then
+function SetupPython3()
+{
+  if [ $origin_version ];then
       origin_version=
     fi
     for python in $(whereis python3)
@@ -127,18 +125,35 @@ function SetupPython()
       fi
       if [ -z $origin_version ];then
         origin_version=$python_version
-        export PYTHON=$python
+        export PYTHON_COMMAND=$python
         continue
       fi
       ret=`echo "$origin_version < $python_version" |bc`
       if [ "$ret" -eq 1 ]; then
         origin_version=$python_version
-        export PYTHON=$python
+        export PYTHON_COMMAND=$python
       fi
     done
+    return 0
+}
+
+function SetupPython()
+{
+  if [ $PYTHON_COMMAND ] && [ -z $PYTHON3_ENABLE ];then
+    if ( command -v $PYTHON_COMMAND >/dev/null 2>&1 );then
+      return 0
+    else
+      echo $PYTHON_COMMAND Cannot be used to build or execute the python tools.
+      return 1
+    fi
   fi
-  
-  if [ -z $PYTHON3_ENABLE ] || [ $PYTHON3_ENABLE != TRUE ]
+
+  if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ]
+  then
+    SetupPython3
+  fi
+
+  if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE != TRUE ]
   then
     if [ $origin_version ];then
       origin_version=
@@ -153,16 +168,19 @@ function SetupPython()
       if [ -z $origin_version ]
       then
         origin_version=$python_version
-        export PYTHON=$python
+        export PYTHON_COMMAND=$python
         continue
       fi
       ret=`echo "$origin_version < $python_version" |bc`
       if [ "$ret" -eq 1 ]; then
         origin_version=$python_version
-        export PYTHON=$python
+        export PYTHON_COMMAND=$python
       fi
     done
+    return 0
   fi
+
+  SetupPython3
 }
 
 function SourceEnv()