From e0c39d9378cc6b3514f7726a94587fba7e3cb74f Mon Sep 17 00:00:00 2001 From: "Paul m. p. Peny" Date: Mon, 13 Jun 2022 18:48:17 +0200 Subject: [PATCH] Run python with -E to ignore incoming PYTHONPATH/etc environment variables (#16736) --- em++ | 6 +++++- em++.bat | 6 ++++-- em-config | 6 +++++- em-config.bat | 12 +++++++----- emar | 6 +++++- emar.bat | 12 +++++++----- embuilder | 6 +++++- embuilder.bat | 12 +++++++----- emcc | 6 +++++- emcc.bat | 6 ++++-- emcc.py | 2 +- emcmake | 6 +++++- emcmake.bat | 12 +++++++----- emconfigure | 6 +++++- emconfigure.bat | 12 +++++++----- emdump | 6 +++++- emdump.bat | 12 +++++++----- emdwp | 6 +++++- emdwp.bat | 12 +++++++----- emmake | 6 +++++- emmake.bat | 12 +++++++----- emnm | 6 +++++- emnm.bat | 12 +++++++----- emprofile | 6 +++++- emprofile.bat | 12 +++++++----- emranlib | 6 +++++- emranlib.bat | 12 +++++++----- emrun | 6 +++++- emrun.bat | 12 +++++++----- emscons | 6 +++++- emscons.bat | 12 +++++++----- emsize | 6 +++++- emsize.bat | 12 +++++++----- emstrip | 6 +++++- emstrip.bat | 12 +++++++----- emsymbolizer | 6 +++++- emsymbolizer.bat | 12 +++++++----- tests/runner | 6 +++++- tests/runner.bat | 12 +++++++----- tools/building.py | 2 +- tools/file_packager | 6 +++++- tools/file_packager.bat | 12 +++++++----- tools/run_python.bat | 12 +++++++----- tools/run_python.sh | 6 +++++- tools/run_python_compiler.bat | 6 ++++-- tools/run_python_compiler.sh | 6 +++++- tools/shared.py | 1 + tools/webidl_binder | 6 +++++- tools/webidl_binder.bat | 12 +++++++----- 49 files changed, 270 insertions(+), 131 deletions(-) diff --git a/em++ b/em++ index 00851011f769..0ca8082a2cc0 100755 --- a/em++ +++ b/em++ @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python_compiler.sh` and # then run `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -29,7 +33,7 @@ if [ -z "$PYTHON" ]; then fi if [ -z "$_EMCC_CCACHE" ]; then - exec "$PYTHON" "$0.py" "$@" + exec "$PYTHON" -E "$0.py" "$@" else unset _EMCC_CCACHE exec ccache "$0" "$@" diff --git a/em++.bat b/em++.bat index 9de276dadece..cc5e8d3cfd59 100644 --- a/em++.bat +++ b/em++.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -16,7 +18,7 @@ :: 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%" "%~dp0\%~n0.py" + set CMD="%EM_PY%" -E "%~dp0\%~n0.py" ) else ( set _EMCC_CCACHE= set CMD=ccache "%~dp0\%~n0.bat" diff --git a/em-config b/em-config index 8464d365b479..1a3a1c969168 100755 --- a/em-config +++ b/em-config @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/em-config.bat b/em-config.bat index 2d981b116889..84872e7a0b93 100644 --- a/em-config.bat +++ b/em-config.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emar b/emar index 8464d365b479..1a3a1c969168 100755 --- a/emar +++ b/emar @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emar.bat b/emar.bat index 2d981b116889..84872e7a0b93 100644 --- a/emar.bat +++ b/emar.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/embuilder b/embuilder index 8464d365b479..1a3a1c969168 100755 --- a/embuilder +++ b/embuilder @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/embuilder.bat b/embuilder.bat index 2d981b116889..84872e7a0b93 100644 --- a/embuilder.bat +++ b/embuilder.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emcc b/emcc index 00851011f769..0ca8082a2cc0 100755 --- a/emcc +++ b/emcc @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python_compiler.sh` and # then run `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -29,7 +33,7 @@ if [ -z "$PYTHON" ]; then fi if [ -z "$_EMCC_CCACHE" ]; then - exec "$PYTHON" "$0.py" "$@" + exec "$PYTHON" -E "$0.py" "$@" else unset _EMCC_CCACHE exec ccache "$0" "$@" diff --git a/emcc.bat b/emcc.bat index 9de276dadece..cc5e8d3cfd59 100644 --- a/emcc.bat +++ b/emcc.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -16,7 +18,7 @@ :: 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%" "%~dp0\%~n0.py" + set CMD="%EM_PY%" -E "%~dp0\%~n0.py" ) else ( set _EMCC_CCACHE= set CMD=ccache "%~dp0\%~n0.bat" diff --git a/emcc.py b/emcc.py index 21ab27baf249..1c9742af68b5 100755 --- a/emcc.py +++ b/emcc.py @@ -1104,7 +1104,7 @@ def run(args): args = [x for x in args if x != '--cflags'] with misc_temp_files.get_file(suffix='.o') as temp_target: input_file = 'hello_world.c' - cmd = [shared.PYTHON, sys.argv[0], utils.path_from_root('tests', input_file), '-v', '-c', '-o', temp_target] + args + cmd = [shared.PYTHON, "-E", sys.argv[0], utils.path_from_root('tests', input_file), '-v', '-c', '-o', temp_target] + args proc = run_process(cmd, stderr=PIPE, check=False) if proc.returncode != 0: print(proc.stderr) diff --git a/emcmake b/emcmake index 8464d365b479..1a3a1c969168 100755 --- a/emcmake +++ b/emcmake @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emcmake.bat b/emcmake.bat index 2d981b116889..84872e7a0b93 100644 --- a/emcmake.bat +++ b/emcmake.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emconfigure b/emconfigure index 8464d365b479..1a3a1c969168 100755 --- a/emconfigure +++ b/emconfigure @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emconfigure.bat b/emconfigure.bat index 2d981b116889..84872e7a0b93 100644 --- a/emconfigure.bat +++ b/emconfigure.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emdump b/emdump index 4f6cfc2c25c6..b60c6e008346 100755 --- a/emdump +++ b/emdump @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$(dirname $0)/tools/emdump.py" "$@" +exec "$PYTHON" -E "$(dirname $0)/tools/emdump.py" "$@" diff --git a/emdump.bat b/emdump.bat index ed920be00048..3b921317678c 100644 --- a/emdump.bat +++ b/emdump.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\tools\emdump.py" %* +@"%EM_PY%" -E "%~dp0\tools\emdump.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\tools\emdump.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emdump.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\tools\emdump.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emdump.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\tools\emdump.py" %* +@"%EM_PY%" -E "%~dp0\tools\emdump.py" %* diff --git a/emdwp b/emdwp index 60f190e779aa..f39d54e64288 100755 --- a/emdwp +++ b/emdwp @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$(dirname $0)/tools/emdwp.py" "$@" +exec "$PYTHON" -E "$(dirname $0)/tools/emdwp.py" "$@" diff --git a/emdwp.bat b/emdwp.bat index 29d98d66cce7..cfae2d0a47f2 100644 --- a/emdwp.bat +++ b/emdwp.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\tools\emdwp.py" %* +@"%EM_PY%" -E "%~dp0\tools\emdwp.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\tools\emdwp.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emdwp.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\tools\emdwp.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emdwp.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\tools\emdwp.py" %* +@"%EM_PY%" -E "%~dp0\tools\emdwp.py" %* diff --git a/emmake b/emmake index 8464d365b479..1a3a1c969168 100755 --- a/emmake +++ b/emmake @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emmake.bat b/emmake.bat index 2d981b116889..84872e7a0b93 100644 --- a/emmake.bat +++ b/emmake.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emnm b/emnm index d160da3e6492..4920cf701724 100755 --- a/emnm +++ b/emnm @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$(dirname $0)/tools/emnm.py" "$@" +exec "$PYTHON" -E "$(dirname $0)/tools/emnm.py" "$@" diff --git a/emnm.bat b/emnm.bat index 9415f162435e..d22226e2fb38 100644 --- a/emnm.bat +++ b/emnm.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\tools\emnm.py" %* +@"%EM_PY%" -E "%~dp0\tools\emnm.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\tools\emnm.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emnm.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\tools\emnm.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emnm.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\tools\emnm.py" %* +@"%EM_PY%" -E "%~dp0\tools\emnm.py" %* diff --git a/emprofile b/emprofile index 16678aaf9ded..998a39e28d0c 100755 --- a/emprofile +++ b/emprofile @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$(dirname $0)/tools/emprofile.py" "$@" +exec "$PYTHON" -E "$(dirname $0)/tools/emprofile.py" "$@" diff --git a/emprofile.bat b/emprofile.bat index c9e327a82637..78aeb4ed8b06 100644 --- a/emprofile.bat +++ b/emprofile.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\tools\emprofile.py" %* +@"%EM_PY%" -E "%~dp0\tools\emprofile.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\tools\emprofile.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emprofile.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\tools\emprofile.py" %* < NUL +@"%EM_PY%" -E "%~dp0\tools\emprofile.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\tools\emprofile.py" %* +@"%EM_PY%" -E "%~dp0\tools\emprofile.py" %* diff --git a/emranlib b/emranlib index 8464d365b479..1a3a1c969168 100755 --- a/emranlib +++ b/emranlib @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emranlib.bat b/emranlib.bat index 2d981b116889..84872e7a0b93 100644 --- a/emranlib.bat +++ b/emranlib.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emrun b/emrun index 8464d365b479..1a3a1c969168 100755 --- a/emrun +++ b/emrun @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emrun.bat b/emrun.bat index 2d981b116889..84872e7a0b93 100644 --- a/emrun.bat +++ b/emrun.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emscons b/emscons index 8464d365b479..1a3a1c969168 100755 --- a/emscons +++ b/emscons @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emscons.bat b/emscons.bat index 2d981b116889..84872e7a0b93 100644 --- a/emscons.bat +++ b/emscons.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emsize b/emsize index 8464d365b479..1a3a1c969168 100755 --- a/emsize +++ b/emsize @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emsize.bat b/emsize.bat index 2d981b116889..84872e7a0b93 100644 --- a/emsize.bat +++ b/emsize.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emstrip b/emstrip index 8464d365b479..1a3a1c969168 100755 --- a/emstrip +++ b/emstrip @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emstrip.bat b/emstrip.bat index 2d981b116889..84872e7a0b93 100644 --- a/emstrip.bat +++ b/emstrip.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/emsymbolizer b/emsymbolizer index 8464d365b479..1a3a1c969168 100755 --- a/emsymbolizer +++ b/emsymbolizer @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/emsymbolizer.bat b/emsymbolizer.bat index 2d981b116889..84872e7a0b93 100644 --- a/emsymbolizer.bat +++ b/emsymbolizer.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/tests/runner b/tests/runner index 8464d365b479..1a3a1c969168 100755 --- a/tests/runner +++ b/tests/runner @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/tests/runner.bat b/tests/runner.bat index 2d981b116889..84872e7a0b93 100644 --- a/tests/runner.bat +++ b/tests/runner.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/tools/building.py b/tools/building.py index 2620ebe0aa23..827a6288a304 100644 --- a/tools/building.py +++ b/tools/building.py @@ -1432,7 +1432,7 @@ def emit_wasm_source_map(wasm_file, map_file, final_wasm): # source file paths must be relative to the location of the map (which is # emitted alongside the wasm) base_path = os.path.dirname(os.path.abspath(final_wasm)) - sourcemap_cmd = [PYTHON, path_from_root('tools/wasm-sourcemap.py'), + sourcemap_cmd = [PYTHON, "-E", path_from_root('tools/wasm-sourcemap.py'), wasm_file, '--dwarfdump=' + LLVM_DWARFDUMP, '-o', map_file, diff --git a/tools/file_packager b/tools/file_packager index 8464d365b479..1a3a1c969168 100755 --- a/tools/file_packager +++ b/tools/file_packager @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/tools/file_packager.bat b/tools/file_packager.bat index 2d981b116889..84872e7a0b93 100644 --- a/tools/file_packager.bat +++ b/tools/file_packager.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/tools/run_python.bat b/tools/run_python.bat index 2d981b116889..84872e7a0b93 100644 --- a/tools/run_python.bat +++ b/tools/run_python.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* diff --git a/tools/run_python.sh b/tools/run_python.sh index 8464d365b479..1a3a1c969168 100755 --- a/tools/run_python.sh +++ b/tools/run_python.sh @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/tools/run_python_compiler.bat b/tools/run_python_compiler.bat index 9de276dadece..cc5e8d3cfd59 100644 --- a/tools/run_python_compiler.bat +++ b/tools/run_python_compiler.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -16,7 +18,7 @@ :: 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%" "%~dp0\%~n0.py" + set CMD="%EM_PY%" -E "%~dp0\%~n0.py" ) else ( set _EMCC_CCACHE= set CMD=ccache "%~dp0\%~n0.bat" diff --git a/tools/run_python_compiler.sh b/tools/run_python_compiler.sh index 00851011f769..0ca8082a2cc0 100644 --- a/tools/run_python_compiler.sh +++ b/tools/run_python_compiler.sh @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python_compiler.sh` and # then run `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -29,7 +33,7 @@ if [ -z "$PYTHON" ]; then fi if [ -z "$_EMCC_CCACHE" ]; then - exec "$PYTHON" "$0.py" "$@" + exec "$PYTHON" -E "$0.py" "$@" else unset _EMCC_CCACHE exec ccache "$0" "$@" diff --git a/tools/shared.py b/tools/shared.py index 1408eec778bb..1d12c935c0a6 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -104,6 +104,7 @@ def run_process(cmd, check=True, input=None, *args, **kw): sys.stdout.flush() sys.stderr.flush() kw.setdefault('universal_newlines', True) + kw.setdefault('encoding', 'utf-8') ret = subprocess.run(cmd, check=check, input=input, *args, **kw) debug_text = '%sexecuted %s' % ('successfully ' if check else '', shlex_join(cmd)) logger.debug(debug_text) diff --git a/tools/webidl_binder b/tools/webidl_binder index 8464d365b479..1a3a1c969168 100755 --- a/tools/webidl_binder +++ b/tools/webidl_binder @@ -11,6 +11,10 @@ # To make modifications to this file, edit `tools/run_python.sh` and then run # `tools/create_entry_points.py` +# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +# of cpython used in cross compilation via setup.py. +unset _PYTHON_SYSCONFIGDATA_NAME + if [ -z "$PYTHON" ]; then PYTHON=$EMSDK_PYTHON fi @@ -28,4 +32,4 @@ if [ -z "$PYTHON" ]; then exit 1 fi -exec "$PYTHON" "$0.py" "$@" +exec "$PYTHON" -E "$0.py" "$@" diff --git a/tools/webidl_binder.bat b/tools/webidl_binder.bat index 2d981b116889..84872e7a0b93 100644 --- a/tools/webidl_binder.bat +++ b/tools/webidl_binder.bat @@ -7,7 +7,9 @@ :: All env. vars specified in this file are to be local only to this script. @setlocal - +:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal +:: of cpython used in cross compilation via setup.py. +@set _PYTHON_SYSCONFIGDATA_NAME= @set EM_PY=%EMSDK_PYTHON% @if "%EM_PY%"=="" ( set EM_PY=python @@ -45,16 +47,16 @@ ) :NORMAL_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %* @exit %ERRORLEVEL% :MUTE_STDIN -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit /b %ERRORLEVEL% :MUTE_STDIN_EXIT -@"%EM_PY%" "%~dp0\%~n0.py" %* < NUL +@"%EM_PY%" -E "%~dp0\%~n0.py" %* < NUL @exit %ERRORLEVEL% :NORMAL -@"%EM_PY%" "%~dp0\%~n0.py" %* +@"%EM_PY%" -E "%~dp0\%~n0.py" %*