python.cmd 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. @ECHO OFF
  2. REM
  3. REM Copyright (c) Contributors to the Open 3D Engine Project.
  4. REM For complete copyright and license terms please see the LICENSE at the root of this distribution.
  5. REM
  6. REM SPDX-License-Identifier: Apache-2.0 OR MIT
  7. REM
  8. REM
  9. REM This script provides a single entry point that you can trust is present.
  10. REM Depending on this entry point instead of trying to find a python.exe
  11. REM In a subfolder allows you to keep working if the version of python changes or
  12. REM other environmental requirements change.
  13. REM When the project switches to a new version of Python, this file will be updated.
  14. SETLOCAL
  15. SET CMD_DIR=%~dp0
  16. SET CMD_DIR=%CMD_DIR:~0,-1%
  17. SET PYTHONHOME=%CMD_DIR%\runtime\python-3.10.5-rev1-windows\python
  18. IF EXIST "%PYTHONHOME%" GOTO PYTHONHOME_EXISTS
  19. ECHO Python not found in %CMD_DIR%
  20. ECHO Try running %CMD_DIR%\get_python.bat first.
  21. exit /B 1
  22. :PYTHONHOME_EXISTS
  23. SET PYTHON=%PYTHONHOME%\python.exe
  24. SET PYTHON_ARGS=%*
  25. IF [%1] EQU [debug] (
  26. SET PYTHON=%PYTHONHOME%\python_d.exe
  27. SET PYTHON_ARGS=%PYTHON_ARGS:~6%
  28. )
  29. IF EXIST "%PYTHON%" GOTO PYTHON_EXISTS
  30. ECHO Could not find python executable at %PYTHON%
  31. exit /B 1
  32. :PYTHON_EXISTS
  33. SET PYTHONNOUSERSITE=1
  34. "%PYTHON%" %PYTHON_ARGS%
  35. exit /B %ERRORLEVEL%