Ver Fonte

Double-quote windows command calls to support spaces in paths (#18429)

* Double-quote windows command calls to support spaces in paths
* Add double quote for python venv hash location

Signed-off-by: Steve Pham <[email protected]>
Steve Pham há 10 meses atrás
pai
commit
d929950f24
1 ficheiros alterados com 5 adições e 5 exclusões
  1. 5 5
      python/python.cmd

+ 5 - 5
python/python.cmd

@@ -50,7 +50,7 @@ IF [%1] EQU [debug] (
     SET PYTHON_VENV_PYTHON=%PYTHON_VENV%\Scripts\python.exe
     SET PYTHON_ARGS=%*
 )
-IF EXIST %PYTHON_VENV_PYTHON% GOTO PYTHON_VENV_EXISTS
+IF EXIST "%PYTHON_VENV_PYTHON%" GOTO PYTHON_VENV_EXISTS
 ECHO Python has not been setup completely for O3DE. Missing Python venv %PYTHON_VENV_PYTHON%
 ECHO Try running %CMD_DIR%\get_python.bat to setup Python for O3DE.
 exit /b 1
@@ -71,7 +71,7 @@ exit /b 1
 REM Make sure there a .hash file that serves as the marker for the source python package the venv is from
 SET PYTHON_VENV_HASH=%PYTHON_VENV%\.hash
 
-IF EXIST %PYTHON_VENV_HASH% GOTO PYTHON_VENV_HASH_EXISTS
+IF EXIST "%PYTHON_VENV_HASH%" GOTO PYTHON_VENV_HASH_EXISTS
 ECHO Python has not been setup completely for O3DE. Missing venv hash %PYTHON_VENV_HASH%
 ECHO Try running %CMD_DIR%\get_python.bat to setup Python for O3DE.
 exit /b 1
@@ -79,7 +79,7 @@ exit /b 1
 :PYTHON_VENV_HASH_EXISTS
 
 REM Read in the .hash from the venv to see if we need to update the version of python
-SET /p VENV_PACKAGE_HASH=<%PYTHON_VENV_HASH%
+SET /p VENV_PACKAGE_HASH=<"%PYTHON_VENV_HASH%"
 
 IF "%VENV_PACKAGE_HASH%" == "%CURRENT_PACKAGE_HASH%" GOTO PYTHON_VENV_MATCHES
 ECHO Python needs to be updated against the current version.
@@ -89,11 +89,11 @@ exit /b 1
 :PYTHON_VENV_MATCHES
 REM Execute the python call from the arguments within the python venv environment
 
-call %PYTHON_VENV_ACTIVATE%
+call "%PYTHON_VENV_ACTIVATE%"
 
 call "%PYTHON_VENV_PYTHON%" %PYTHON_ARGS%
 SET PYTHON_RESULT=%ERRORLEVEL%
 
-call %PYTHON_VENV_DEACTIVATE%
+call "%PYTHON_VENV_DEACTIVATE%"
 
 exit /B %PYTHON_RESULT%