]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update windows and linux run scripts file to use Python3
authorZhijux Fan <zhijux.fan@intel.com>
Wed, 19 Dec 2018 05:28:44 +0000 (13:28 +0800)
committerFeng, Bob C <bob.c.feng@intel.com>
Fri, 1 Feb 2019 03:09:22 +0000 (11:09 +0800)
Modify windows script, PosixLike script, edksetup.sh, edksetup.bat to
use Python3 based on PYTHON3_ENABLE environment.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
39 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/Tests/GNUmakefile
BaseTools/toolsetup.bat
edksetup.sh

index 214d88fff1b15a998a523628d97ecbb8d93a2e1a..8532fe510df48f721b582c50a0e821728240a43d 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 214d88fff1b15a998a523628d97ecbb8d93a2e1a..8532fe510df48f721b582c50a0e821728240a43d 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 214d88fff1b15a998a523628d97ecbb8d93a2e1a..8532fe510df48f721b582c50a0e821728240a43d 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 214d88fff1b15a998a523628d97ecbb8d93a2e1a..8532fe510df48f721b582c50a0e821728240a43d 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 7cac4f7c4fff29fbb4981a25c4492d38317a1fca..54e09c039bb44584c783364f6831895a7099bcb9 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 214d88fff1b15a998a523628d97ecbb8d93a2e1a..8532fe510df48f721b582c50a0e821728240a43d 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 276c7ea20733d78a8ebd1fe1152f6e54b1ffc4ce..e9f570b52cef8f72ba0f691739f4f73e96a81405 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 11429640283c69da29429a10c796cdb2adea8126..ed4b7cd3845bca07f9d30d117da3e25746349010 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 dad174788bc3e8515267b76b272ace08ebbc9de1..d99e54f222896a15f563bf1563232afe2295ca68 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 276c7ea20733d78a8ebd1fe1152f6e54b1ffc4ce..e9f570b52cef8f72ba0f691739f4f73e96a81405 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 59a6c8ba431ec1ef634a572a2a3eecc6f9a4e10d..91bbd2273808f23b145beda61b2775fc3b8b6249 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 1bc1054a3452a196cdfa1d2e18dde0f7250f20a2..b42a1268404943049aa9ae3c97409db0be68ba72 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 6c8dde5bec3eae83e0762f8f36eeb3ab279e86df..d64b834006cf53a32f41aab0a4b9ad331d2ed192 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 01ae23ddeb4f8845ce89ec4656d12ef43bf6a58b..d8b8b8f14527883111fb6fa443523d39583f7a03 100755 (executable)
@@ -1,9 +1,9 @@
 #!/usr/bin/env bash
 #python `dirname $0`/RunToolFromSource.py `basename $0` $*
 
-# If a python2 command is available, use it in preference to python
-if command -v python2 >/dev/null 2>&1; then
-    python_exe=python2
+# If a ${PYTHON} command is available, use it in preference to python
+if command -v ${PYTHON} >/dev/null 2>&1; then
+    python_exe=${PYTHON}
 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 98095cfbd4390c89f17ce74d486951933f2e8dc4..4a43e5353ef8cb9beb2c4e98a658c5205956f6d5 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %*\r
+@%PYTHON% -m %ToolName%.%ToolName% %*\r
index 8705e7541e62fd24dba5c3e718700163fdf2fe06..e63ef501356ea02493d84109b7ce5c2f8885f437 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON_HOME%\python.exe -m %ToolName%.EccMain %*\r
+@%PYTHON% -m %ToolName%.EccMain %*\r
index ffc783d2bebf1930b1f194d68f7e87a98488a20d..6c7250f00867eefca89bdcbed75f2cbdfbbc1f69 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*\r
index 98095cfbd4390c89f17ce74d486951933f2e8dc4..4a43e5353ef8cb9beb2c4e98a658c5205956f6d5 100644 (file)
@@ -1,4 +1,4 @@
 @setlocal\r
 @set ToolName=%~n0%\r
 @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python\r
-@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %*\r
+@%PYTHON% -m %ToolName%.%ToolName% %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index ca442d181b8d7bc3aeb6c87c7dc2dc62bab9beb1..1ab7d33f986b665cbe2c4285b05ef1ea368054db 100644 (file)
@@ -1 +1 @@
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index df9336567cb56cbc8434397af1b941b3641248d3..32da349b312dfc1a06db00df690b9cc547748f86 100644 (file)
@@ -1 +1 @@
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index 9fbb704a6eb00baca50f39f0cc3fa6b9d30525f3..82e0a90d6cdf0749016fdaf804ebbb2640656760 100644 (file)
@@ -1,3 +1,3 @@
 @setlocal\r
 @set ToolName=%~n0%\r
-@%PYTHON_HOME%\python.exe %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
+@%PYTHON% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*\r
index e6932c77c0e346d87b04b1d372ae1010ce74b4c6..2569ea2ff49863d991c22678745878b20e95f07f 100644 (file)
@@ -20,17 +20,17 @@ SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
 all: c\r
 \r
 c :\r
-  @$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $(BASE_TOOLS_PATH)\Source\C\r
+  @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $(BASE_TOOLS_PATH)\Source\C\r
 \r
 \r
 subdirs: $(SUBDIRS)\r
-  @$(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**\r
+  @$(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $**\r
 \r
 .PHONY: clean\r
 clean:\r
-  $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)\r
+  $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)\r
 \r
 .PHONY: cleanall\r
 cleanall:\r
-  $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)\r
+  $(PYTHON) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  cleanall $(SUBDIRS)\r
 \r
index 5806dcedd9bb0afe843e826f7662eb2495287357..dd39661272e765014187862759588818b0cbca26 100644 (file)
@@ -38,7 +38,7 @@ libs: $(LIBRARIES)
        @echo # Build libraries\r
        @echo ######################\r
        @if not exist $(LIB_PATH) mkdir $(LIB_PATH)\r
-       @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**\r
+       @$(PYTHON) Makefiles\NmakeSubdirs.py all $**\r
 \r
 apps: $(APPLICATIONS)\r
        @echo.\r
@@ -46,7 +46,7 @@ apps: $(APPLICATIONS)
        @echo # Build executables\r
        @echo ######################\r
        @if not exist $(BIN_PATH) mkdir $(BIN_PATH)\r
-       @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py all $**\r
+       @$(PYTHON) Makefiles\NmakeSubdirs.py all $**\r
 \r
 install: $(LIB_PATH) $(BIN_PATH)\r
        @echo.\r
@@ -60,11 +60,11 @@ install: $(LIB_PATH) $(BIN_PATH)
 \r
 .PHONY: clean\r
 clean:\r
-  @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)\r
+  @$(PYTHON) Makefiles\NmakeSubdirs.py clean $(LIBRARIES) $(APPLICATIONS)\r
 \r
 .PHONY: cleanall\r
 cleanall:\r
-  @$(PYTHON_HOME)\python.exe Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)\r
+  @$(PYTHON) Makefiles\NmakeSubdirs.py cleanall $(LIBRARIES) $(APPLICATIONS)\r
 \r
 !INCLUDE Makefiles\ms.rule\r
 \r
index 0c11f6aae94652caab22c79fbba5a492153e3565..d6f4e1908b7e6ae93ae900744fbba337a2cc5b65 100644 (file)
@@ -14,7 +14,7 @@
 all: test\r
 \r
 test:\r
-       @if command -v python2 >/dev/null 2>&1; then python2 RunTests.py; else python RunTests.py; fi\r
+       @if command -v $(PYTHON) >/dev/null 1; then $(PYTHON) RunTests.py; else python RunTests.py; fi\r
 \r
 clean:\r
        find . -name '*.pyc' -exec rm '{}' ';'\r
index 1cac3105c2fbb978412e99e926cd2e1b7c713063..811b23051fd9a55280d9f54cd13df39c6deca76e 100755 (executable)
@@ -274,8 +274,7 @@ goto check_build_environment
   echo.\r
 \r
 :check_build_environment\r
-  set PYTHONHASHSEED=0\r
-  if defined BASETOOLS_PYTHON_SOURCE goto VisualStudioAvailable\r
+  set PYTHONHASHSEED=1\r
 \r
   if not defined BASE_TOOLS_PATH (\r
      if not exist "Source\C\Makefile" (\r
@@ -286,24 +285,60 @@ goto check_build_environment
      )\r
   )\r
 \r
-  if not defined PYTHON_HOME (\r
-    if defined PYTHONHOME (\r
-      set PYTHON_HOME=%PYTHONHOME%\r
-    ) else (\r
+:defined_python\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
       echo.\r
-      echo !!! ERROR !!! Binary python tools are missing. PYTHON_HOME environment variable is not set.\r
-      echo PYTHON_HOME is required to build or execute the python tools.\r
+      echo !!! ERROR !!!  PYTHON3 is not installed or added to environment variables\r
       echo.\r
       goto end\r
+    ) else (\r
+      goto check_freezer_path\r
+    )\r
+  ) \r
+)\r
+\r
+if defined PYTHON_HOME (\r
+  if EXIST "%PYTHON_HOME%" (\r
+    set PYTHON=%PYTHON_HOME%\python.exe\r
+    goto check_freezer_path\r
+    )\r
+  )\r
+if defined PYTHONHOME (\r
+  if EXIST "%PYTHONHOME%" (\r
+    set PYTHON_HOME=%PYTHONHOME%\r
+    set PYTHON=%PYTHON_HOME%\python.exe\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
+  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
   set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%\r
 \r
+:print_python_info\r
   echo                PATH = %PATH%\r
-  echo         PYTHON_HOME = %PYTHON_HOME%\r
+  if "%PYTHON3_ENABLE%" EQU "TRUE" (\r
+    echo      PYTHON3_ENABLE = %PYTHON3_ENABLE%\r
+    echo             PYTHON3 = %PYTHON%\r
+  ) else (\r
+    echo      PYTHON3_ENABLE = %PYTHON3_ENABLE%\r
+    if defined PYTHON_HOME (\r
+      echo         PYTHON_HOME = %PYTHON_HOME%\r
+    )\r
+  )\r
   echo          PYTHONPATH = %PYTHONPATH%\r
   echo.\r
 \r
index 3dee8c5d611ec2358d6392116f70f53ae6562e47..06f95f4b9c278c154c43420770875057d7769526 100755 (executable)
@@ -77,7 +77,7 @@ function SetWorkspace()
   # Set $WORKSPACE
   #
   export WORKSPACE=`pwd`
-  export PYTHONHASHSEED=0\r
+  export PYTHONHASHSEED=1
   return 0
 }
 
@@ -111,10 +111,59 @@ function SetupEnv()
   fi
 }
 
+function SetupPython()
+{    
+  if [ $PYTHON3_ENABLE ] && [ $PYTHON3_ENABLE == TRUE ]
+  then
+    for python in $(which python3)
+    do
+      python=$(echo $python | grep "[[:digit:]]$" || true)
+      python_version=${python##*python}
+      if [ -z "${python_version}" ];then
+        continue
+      fi
+      if [ -z $origin_version ];then
+        origin_version=$python_version
+        export PYTHON=$python
+        continue
+      fi
+      ret=`echo "$origin_version < $python_version" |bc`
+      if [ "$ret" -eq 1 ]; then
+        origin_version=$python_version
+        export PYTHON=$python
+      fi
+    done
+  fi
+  
+  if [ -z $PYTHON3_ENABLE ] || [ $PYTHON3_ENABLE != TRUE ]
+  then
+    for python in $(which python2)
+    do
+      python=$(echo $python | grep "[[:digit:]]$" || true)
+      python_version=${python##*python}
+      if [ -z "${python_version}" ];then
+        continue
+      fi
+      if [ -z $origin_version ] || [ $origin_version -ge 3 ]
+      then
+        origin_version=$python_version
+        export PYTHON=$python
+        continue
+      fi
+      ret=`echo "$origin_version < $python_version" |bc`
+      if [ "$ret" -eq 1 ]; then
+        origin_version=$python_version
+        export PYTHON=$python
+      fi
+    done
+  fi
+}
+
 function SourceEnv()
 {
   SetWorkspace &&
   SetupEnv
+  SetupPython
 }
 
 I=$#