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
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ See docs/process.md for more on how version tagging works.

4.0.21 (in development)
-----------------------
- The emscripten tools will now warn if they are not run via the launcher
scripts. i.e. it is no longer officially supported to run `python emcc.py`.
Instead, `emcc` should be run directly (via the provided `.bat` or shell
script). (#20437)
- The `-sPROXY_TO_WORKER` setting (along with the corresponding
`--proxy-to-worker` flag) was removed due to lack of usage. If you were
depending on this feature but missed the PSA, please let us know about your
Expand Down
1 change: 1 addition & 0 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
exec "$_EM_PY" -E "$0.py" "$@"
3 changes: 3 additions & 0 deletions bootstrap.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
:: of cpython used in cross compilation via setup.py.
@set _PYTHON_SYSCONFIGDATA_NAME=
Expand Down
1 change: 1 addition & 0 deletions em++
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
if [ -z "$_EMCC_CCACHE" ]; then
exec "$_EM_PY" -E "$0.py" "$@"
else
Expand Down
4 changes: 4 additions & 0 deletions em++.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -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
Expand Down
1 change: 1 addition & 0 deletions emcc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
if [ -z "$_EMCC_CCACHE" ]; then
exec "$_EM_PY" -E "$0.py" "$@"
else
Expand Down
4 changes: 4 additions & 0 deletions emcc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -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
Expand Down
1 change: 1 addition & 0 deletions test/runner
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
exec "$_EM_PY" -E "$0.py" "$@"
3 changes: 3 additions & 0 deletions test/runner.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
:: of cpython used in cross compilation via setup.py.
@set _PYTHON_SYSCONFIGDATA_NAME=
Expand Down
4 changes: 4 additions & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -15210,3 +15210,7 @@ def test_binary_encode(self):
console.log('OK');'''
write_file('test.js', read_file(path_from_root('src/binaryDecode.js')) + '\nvar src = ' + binary_encoded + ';\n' + test_js)
self.assertContained('OK', self.run_js('test.js'))

def test_direct_usage_warning(self):
err = self.run_process([sys.executable, path_from_root('emcc.py'), '--version'], stderr=PIPE).stderr
self.assertContained('emcc: warning: python script (`emcc.py`) was run directly rather than run via launcher', err)
3 changes: 3 additions & 0 deletions tools/maint/run_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
:: of cpython used in cross compilation via setup.py.
@set _PYTHON_SYSCONFIGDATA_NAME=
Expand Down
1 change: 1 addition & 0 deletions tools/maint/run_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
exec "$_EM_PY" -E "$0.py" "$@"
4 changes: 4 additions & 0 deletions tools/maint/run_python_compiler.bat
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@

:: All env. vars specified in this file are to be local only to this script.
@setlocal

@set _EM_LAUNCHER=1

:: -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
Expand Down
1 change: 1 addition & 0 deletions tools/maint/run_python_compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ -z "$_EM_PY" ]; then
exit 1
fi

export _EM_LAUNCHER=1
if [ -z "$_EMCC_CCACHE" ]; then
exec "$_EM_PY" -E "$0.py" "$@"
else
Expand Down
7 changes: 7 additions & 0 deletions tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,13 @@ def get_llvm_target():
def init():
utils.set_version_globals()
setup_temp_dirs()
if '_EM_LAUNCHER' not in os.environ:
actual = bat_suffix(os.path.basename(sys.argv[0]))
launcher = os.path.splitext(actual)[0]
diagnostics.warning('unsupported', f'python script (`{actual}`) was run directly rather than run via launcher. Running via `{launcher}` is recommended')
else:
# We don't want subprocesses to inherit this environment variable.
del os.environ['_EM_LAUNCHER']


# ============================================================================
Expand Down
Loading