]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/toolsetup.bat
BaseTools: Add --uefi option to enable UefiCompress method
[mirror_edk2.git] / BaseTools / toolsetup.bat
index 33d50f58ad87df6909ae7dbcc691cd5503e3789e..0d4028db785f573e9ddf4a3f9b3694d3e4bfac09 100755 (executable)
@@ -299,18 +299,32 @@ goto end
      )\r
   )\r
 \r
-  if not defined PYTHON_HOME (\r
-    if defined PYTHONHOME (\r
-      set PYTHON_HOME=%PYTHONHOME%\r
-    ) else (\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.\r
-      goto end\r
+set PYTHON3=py -3\r
+:check_python_version\r
+  %PYTHON3% --version >NUL 2>&1\r
+  if %ERRORLEVEL% NEQ 0 (\r
+    if defined PYTHON_HOME (\r
+      if EXIST "%PYTHON_HOME%" (\r
+        set PYTHON3=%PYTHON_HOME%\python.exe\r
+      )\r
     )\r
   )\r
+  %PYTHON3% --version >NUL 2>&1\r
+  if %ERRORLEVEL% NEQ 0 (\r
+     echo.\r
+     echo !!! ERROR !!!  %PYTHON3% not install.\r
+     echo.\r
+     goto end\r
+   )\r
+  FOR /F "TOKENS=1,2" %%i IN ('%PYTHON3% --version') DO set VERSION=%%j\r
+  if /I "%VERSION%" LSS "3.6" (\r
+     echo.\r
+     echo !!! ERROR !!!  python version should greater than or equal to version 3.6.\r
+     echo.\r
+     goto end\r
+  )\r
 \r
+:check_freezer_path\r
   @REM We have Python, now test for FreezePython application\r
   if not defined PYTHON_FREEZER_PATH (\r
     echo.\r