mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
BaseTools: Remove Python2/Python3 detection from toolset.bat
Since Python3 is now required, we can remove the checks for PYTHON3_ENABLE and PYTHON3 and simplify the code in toolsetup.bat. Also, remove the leftover from when we supported freezing Python code. While here, fix a couple of typos and improve error messages. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
6eeb58ece3
commit
db7e6291c0
@ -305,18 +305,8 @@ goto check_build_environment
|
|||||||
)
|
)
|
||||||
|
|
||||||
:defined_python
|
:defined_python
|
||||||
if defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (
|
|
||||||
goto check_python_available
|
if not defined PYTHON_COMMAND (
|
||||||
)
|
|
||||||
if defined PYTHON3_ENABLE (
|
|
||||||
if "%PYTHON3_ENABLE%" EQU "TRUE" (
|
|
||||||
set PYTHON_COMMAND=py -3
|
|
||||||
goto check_python_available
|
|
||||||
) else (
|
|
||||||
goto check_python2
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (
|
|
||||||
set PYTHON_COMMAND=py -3
|
set PYTHON_COMMAND=py -3
|
||||||
py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
|
py -3 %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
@ -328,55 +318,39 @@ if not defined PYTHON_COMMAND if not defined PYTHON3_ENABLE (
|
|||||||
set PYTHON_COMMAND=
|
set PYTHON_COMMAND=
|
||||||
echo.
|
echo.
|
||||||
echo !!! ERROR !!! Binary python tools are missing.
|
echo !!! ERROR !!! Binary python tools are missing.
|
||||||
echo PYTHON_COMMAND, PYTHON3_ENABLE or PYTHON_HOME
|
echo PYTHON_COMMAND or PYTHON_HOME
|
||||||
echo Environment variable is not set successfully.
|
echo Environment variable is not set correctly.
|
||||||
echo They is required to build or execute the python tools.
|
echo They are required to build or execute the python tools.
|
||||||
echo.
|
echo.
|
||||||
goto end
|
goto end
|
||||||
) else (
|
|
||||||
goto check_python2
|
|
||||||
)
|
)
|
||||||
) else (
|
|
||||||
goto check_freezer_path
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
:check_python2
|
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
if defined PYTHON_HOME (
|
if defined PYTHON_HOME (
|
||||||
if EXIST "%PYTHON_HOME%" (
|
if EXIST "%PYTHON_HOME%" (
|
||||||
set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
|
set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
|
||||||
goto check_python_available
|
) else (
|
||||||
)
|
|
||||||
)
|
|
||||||
if defined PYTHONHOME (
|
|
||||||
if EXIST "%PYTHONHOME%" (
|
|
||||||
set PYTHON_HOME=%PYTHONHOME%
|
|
||||||
set PYTHON_COMMAND=%PYTHON_HOME%\python.exe
|
|
||||||
goto check_python_available
|
|
||||||
)
|
|
||||||
)
|
|
||||||
echo .
|
echo .
|
||||||
echo !!! ERROR !!! PYTHON_HOME is not defined or The value of this variable does not exist
|
echo !!! ERROR !!! PYTHON_HOME="%PYTHON_HOME%" does not exist.
|
||||||
echo .
|
echo .
|
||||||
goto end
|
goto end
|
||||||
:check_python_available
|
)
|
||||||
|
)
|
||||||
|
|
||||||
%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
|
%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py >PythonCheck.txt 2>&1
|
||||||
setlocal enabledelayedexpansion
|
setlocal enabledelayedexpansion
|
||||||
set /p PythonCheck=<"PythonCheck.txt"
|
set /p PythonCheck=<"PythonCheck.txt"
|
||||||
del PythonCheck.txt
|
del PythonCheck.txt
|
||||||
if "!PythonCheck!" NEQ "TRUE" (
|
if "!PythonCheck!" NEQ "TRUE" (
|
||||||
echo.
|
echo.
|
||||||
echo ! ERROR ! "%PYTHON_COMMAND%" is not installed or added to environment variables
|
echo ! ERROR ! PYTHON_COMMAND="%PYTHON_COMMAND%" is not installed or added to environment variables
|
||||||
echo.
|
echo.
|
||||||
goto end
|
goto end
|
||||||
) else (
|
|
||||||
goto check_freezer_path
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:check_freezer_path
|
|
||||||
endlocal
|
endlocal
|
||||||
|
|
||||||
%PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL
|
%PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL
|
||||||
@ -404,13 +378,7 @@ goto end
|
|||||||
|
|
||||||
:print_python_info
|
:print_python_info
|
||||||
echo PATH = %PATH%
|
echo PATH = %PATH%
|
||||||
if defined PYTHON3_ENABLE if "%PYTHON3_ENABLE%" EQU "TRUE" (
|
|
||||||
echo PYTHON3_ENABLE = %PYTHON3_ENABLE%
|
|
||||||
echo PYTHON3 = %PYTHON_COMMAND%
|
|
||||||
) else (
|
|
||||||
echo PYTHON3_ENABLE = FALSE
|
|
||||||
echo PYTHON_COMMAND = %PYTHON_COMMAND%
|
echo PYTHON_COMMAND = %PYTHON_COMMAND%
|
||||||
)
|
|
||||||
echo PYTHONPATH = %PYTHONPATH%
|
echo PYTHONPATH = %PYTHONPATH%
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user