summaryrefslogtreecommitdiffstats
path: root/BaseTools/toolsetup.bat
diff options
context:
space:
mode:
authorZhijux Fan <zhijux.fan@intel.com>2018-12-19 13:28:44 +0800
committerFeng, Bob C <bob.c.feng@intel.com>2019-02-01 11:09:22 +0800
commit9c2d68c0a29909d23266395fc48d0b81b118e341 (patch)
tree7d5600bbae95ee71ac5ff416d1a285c49732f098 /BaseTools/toolsetup.bat
parent94c912950c2f588ab8c3725d7aaa3d7c07aaa995 (diff)
downloadedk2-9c2d68c0a29909d23266395fc48d0b81b118e341.tar.gz
edk2-9c2d68c0a29909d23266395fc48d0b81b118e341.tar.bz2
edk2-9c2d68c0a29909d23266395fc48d0b81b118e341.zip
BaseTools: Update windows and linux run scripts file to use Python3
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>
Diffstat (limited to 'BaseTools/toolsetup.bat')
-rwxr-xr-xBaseTools/toolsetup.bat53
1 files changed, 44 insertions, 9 deletions
diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat
index 1cac3105c2..811b23051f 100755
--- a/BaseTools/toolsetup.bat
+++ b/BaseTools/toolsetup.bat
@@ -274,8 +274,7 @@ goto check_build_environment
echo.
:check_build_environment
- set PYTHONHASHSEED=0
- if defined BASETOOLS_PYTHON_SOURCE goto VisualStudioAvailable
+ set PYTHONHASHSEED=1
if not defined BASE_TOOLS_PATH (
if not exist "Source\C\Makefile" (
@@ -286,24 +285,60 @@ goto check_build_environment
)
)
- if not defined PYTHON_HOME (
- if defined PYTHONHOME (
- set PYTHON_HOME=%PYTHONHOME%
- ) else (
+:defined_python
+if defined PYTHON3_ENABLE (
+ if "%PYTHON3_ENABLE%" EQU "TRUE" (
+ set PYTHON=py -3
+ %PYTHON% --version >NUL 2>&1
+ if %ERRORLEVEL% NEQ 0 (
echo.
- echo !!! ERROR !!! Binary python tools are missing. PYTHON_HOME environment variable is not set.
- echo PYTHON_HOME is required to build or execute the python tools.
+ echo !!! ERROR !!! PYTHON3 is not installed or added to environment variables
echo.
goto end
+ ) else (
+ goto check_freezer_path
+ )
+ )
+)
+
+if defined PYTHON_HOME (
+ if EXIST "%PYTHON_HOME%" (
+ set PYTHON=%PYTHON_HOME%\python.exe
+ goto check_freezer_path
+ )
+ )
+if defined PYTHONHOME (
+ if EXIST "%PYTHONHOME%" (
+ set PYTHON_HOME=%PYTHONHOME%
+ set PYTHON=%PYTHON_HOME%\python.exe
+ goto check_freezer_path
)
)
+
+ echo.
+ echo !!! ERROR !!! Binary python tools are missing.
+ echo PYTHON_HOME or PYTHON3_ENABLE environment variable is not set successfully.
+ echo PYTHON_HOME or PYTHON3_ENABLE is required to build or execute the python tools.
+ echo.
+ goto end
+:check_freezer_path
+ if defined BASETOOLS_PYTHON_SOURCE goto print_python_info
set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"
set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python
set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%
+:print_python_info
echo PATH = %PATH%
- echo PYTHON_HOME = %PYTHON_HOME%
+ if "%PYTHON3_ENABLE%" EQU "TRUE" (
+ echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
+ echo PYTHON3 = %PYTHON%
+ ) else (
+ echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
+ if defined PYTHON_HOME (
+ echo PYTHON_HOME = %PYTHON_HOME%
+ )
+ )
echo PYTHONPATH = %PYTHONPATH%
echo.