Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions tools/maint/run_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
::
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
::
:: To make modifications to this file, edit `tools\run_python.bat` and then run
:: `tools\maint\create_entry_points.py`
:: To make modifications to this file, edit `tools\maint\run_python.bat` and
:: then run `tools\maint\create_entry_points.py`

:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
:: or there will be a parsing error.
Expand Down Expand Up @@ -70,17 +70,24 @@
)
)

:: N.b. when passing the -E flag to Python (ignore PYTHON* environment
:: variables (such as PYTHONPATH)), Python will revert to cp1252 encoding
:: on Windows by default, if stdout/stderr is redirected.
:: https://github.com/buildbot/buildbot/issues/9047
:: To avoid this from causing issues, explicitly specify the -X utf8 encoding
:: on tool invocations.

:NORMAL_EXIT
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*
@"%_EM_PY%" -E -X utf8 "%MYDIR%%~n0.py" %*
@exit %ERRORLEVEL%

:MUTE_STDIN
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
@"%_EM_PY%" -E -X utf8 "%MYDIR%%~n0.py" %* < NUL
@exit /b %ERRORLEVEL%

:MUTE_STDIN_EXIT
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
@"%_EM_PY%" -E -X utf8 "%MYDIR%%~n0.py" %* < NUL
@exit %ERRORLEVEL%

:NORMAL
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*
@"%_EM_PY%" -E -X utf8 "%MYDIR%%~n0.py" %*
9 changes: 8 additions & 1 deletion tools/maint/run_python_compiler.bat
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,17 @@
)
:FOUND_MYDIR

:: N.b. when passing the -E flag to Python (ignore PYTHON* environment
:: variables (such as PYTHONPATH)), Python will revert to cp1252 encoding
:: on Windows by default, if stdout/stderr is redirected.
:: https://github.com/buildbot/buildbot/issues/9047
:: To avoid this from causing issues, explicitly specify the -X utf8 encoding
:: on tool invocations.

:: If _EMCC_CCACHE is not set, do a regular invocation of the python compiler driver.
:: Otherwise remove the ccache env. var, and then reinvoke this script with ccache enabled.
@if "%_EMCC_CCACHE%"=="" (
set CMD="%_EM_PY%" -E "%MYDIR%%~n0.py"
set CMD="%_EM_PY%" -E -X utf8 "%MYDIR%%~n0.py"
) else (
set _EMCC_CCACHE=
set CMD=ccache "%MYDIR%%~n0.bat"
Expand Down
Loading