Skip to content

Commit 77bc5ff

Browse files
authored
Rename internal environment variables 'PYTHON' and 'EM_PY' in launcher scripts. (#25867)
Rename internal environment variables 'PYTHON' and 'EM_PY' used by Linux/macOS and Windows launcher scripts to a underscore-prefixed '_EM_PY' variable, to make it clear these are internal variable names, and not meant to be defined from the outside. Also clean up a couple of comment typos.
1 parent e33466c commit 77bc5ff

File tree

15 files changed

+104
-116
lines changed

15 files changed

+104
-116
lines changed

bootstrap

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,23 @@
1111
# To make modifications to this file, edit `tools/run_python.sh` and then run
1212
# `tools/maint/create_entry_points.py`
1313

14-
# $PYTHON -E does not ignore _PYTHON_SYSCONFIGDATA_NAME, an internal of cpython
14+
# $_EM_PY -E does not ignore _PYTHON_SYSCONFIGDATA_NAME, an internal of cpython
1515
# used in cross compilation via setup.py, so we unset it explicitly here.
1616
unset _PYTHON_SYSCONFIGDATA_NAME
1717

18-
if [ -z "$PYTHON" ]; then
19-
PYTHON=$EMSDK_PYTHON
20-
fi
18+
_EM_PY=$EMSDK_PYTHON
2119

22-
if [ -z "$PYTHON" ]; then
23-
PYTHON=$(command -v python3 2> /dev/null)
20+
if [ -z "$_EM_PY" ]; then
21+
_EM_PY=$(command -v python3 2> /dev/null)
2422
fi
2523

26-
if [ -z "$PYTHON" ]; then
27-
PYTHON=$(command -v python 2> /dev/null)
24+
if [ -z "$_EM_PY" ]; then
25+
_EM_PY=$(command -v python 2> /dev/null)
2826
fi
2927

30-
if [ -z "$PYTHON" ]; then
28+
if [ -z "$_EM_PY" ]; then
3129
echo 'unable to find python in $PATH'
3230
exit 1
3331
fi
3432

35-
exec "$PYTHON" -E "$0.py" "$@"
33+
exec "$_EM_PY" -E "$0.py" "$@"

bootstrap.bat

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
::
33
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
44
::
5-
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6-
:: `tools/maint/create_entry_points.py`
5+
:: To make modifications to this file, edit `tools\run_python.bat` and then run
6+
:: `tools\maint\create_entry_points.py`
77

88
:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
99
:: or there will be a parsing error.
@@ -13,9 +13,9 @@
1313
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1414
:: of cpython used in cross compilation via setup.py.
1515
@set _PYTHON_SYSCONFIGDATA_NAME=
16-
@set EM_PY=%EMSDK_PYTHON%
17-
@if "%EM_PY%"=="" (
18-
set EM_PY=python
16+
@set _EM_PY=%EMSDK_PYTHON%
17+
@if "%_EM_PY%"=="" (
18+
set _EM_PY=python
1919
)
2020

2121
:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
@@ -71,16 +71,16 @@
7171
)
7272

7373
:NORMAL_EXIT
74-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
74+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*
7575
@exit %ERRORLEVEL%
7676

7777
:MUTE_STDIN
78-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
78+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
7979
@exit /b %ERRORLEVEL%
8080

8181
:MUTE_STDIN_EXIT
82-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
82+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
8383
@exit %ERRORLEVEL%
8484

8585
:NORMAL
86-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
86+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*

em++

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@
88
#
99
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
1010
#
11-
# To make modifications to this file, edit `tools/run_python_compiler.sh` and
12-
# then run `tools/create_entry_points.py`
11+
# To make modifications to this file, edit `tools/maint/run_python_compiler.sh` and
12+
# then run `tools/maint/create_entry_points.py`
1313

14-
# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
14+
# $_EM_PY -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1515
# of cpython used in cross compilation via setup.py.
1616
unset _PYTHON_SYSCONFIGDATA_NAME
1717

18-
if [ -z "$PYTHON" ]; then
19-
PYTHON=$EMSDK_PYTHON
20-
fi
18+
_EM_PY=$EMSDK_PYTHON
2119

22-
if [ -z "$PYTHON" ]; then
23-
PYTHON=$(command -v python3 2> /dev/null)
20+
if [ -z "$_EM_PY" ]; then
21+
_EM_PY=$(command -v python3 2> /dev/null)
2422
fi
2523

26-
if [ -z "$PYTHON" ]; then
27-
PYTHON=$(command -v python 2> /dev/null)
24+
if [ -z "$_EM_PY" ]; then
25+
_EM_PY=$(command -v python 2> /dev/null)
2826
fi
2927

30-
if [ -z "$PYTHON" ]; then
28+
if [ -z "$_EM_PY" ]; then
3129
echo 'unable to find python in $PATH'
3230
exit 1
3331
fi
3432

3533
if [ -z "$_EMCC_CCACHE" ]; then
36-
exec "$PYTHON" -E "$0.py" "$@"
34+
exec "$_EM_PY" -E "$0.py" "$@"
3735
else
3836
unset _EMCC_CCACHE
3937
exec ccache "$0" "$@"

em++.bat

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
::
33
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
44
::
5-
:: To make modifications to this file, edit `tools/run_python_compiler.bat` and
6-
:: then run `tools/create_entry_points.py`
5+
:: To make modifications to this file, edit `tools\maint\run_python_compiler.bat` and
6+
:: then run `tools\maint\create_entry_points.py`
77

88
:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
99
:: or there will be a parsing error.
@@ -13,9 +13,9 @@
1313
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1414
:: of cpython used in cross compilation via setup.py.
1515
@set _PYTHON_SYSCONFIGDATA_NAME=
16-
@set EM_PY=%EMSDK_PYTHON%
17-
@if "%EM_PY%"=="" (
18-
set EM_PY=python
16+
@set _EM_PY=%EMSDK_PYTHON%
17+
@if "%_EM_PY%"=="" (
18+
set _EM_PY=python
1919
)
2020

2121
:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
@@ -42,7 +42,7 @@
4242
:: If _EMCC_CCACHE is not set, do a regular invocation of the python compiler driver.
4343
:: Otherwise remove the ccache env. var, and then reinvoke this script with ccache enabled.
4444
@if "%_EMCC_CCACHE%"=="" (
45-
set CMD="%EM_PY%" -E "%MYDIR%%~n0.py"
45+
set CMD="%_EM_PY%" -E "%MYDIR%%~n0.py"
4646
) else (
4747
set _EMCC_CCACHE=
4848
set CMD=ccache "%MYDIR%%~n0.bat"

emcc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,30 @@
88
#
99
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
1010
#
11-
# To make modifications to this file, edit `tools/run_python_compiler.sh` and
12-
# then run `tools/create_entry_points.py`
11+
# To make modifications to this file, edit `tools/maint/run_python_compiler.sh` and
12+
# then run `tools/maint/create_entry_points.py`
1313

14-
# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
14+
# $_EM_PY -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1515
# of cpython used in cross compilation via setup.py.
1616
unset _PYTHON_SYSCONFIGDATA_NAME
1717

18-
if [ -z "$PYTHON" ]; then
19-
PYTHON=$EMSDK_PYTHON
20-
fi
18+
_EM_PY=$EMSDK_PYTHON
2119

22-
if [ -z "$PYTHON" ]; then
23-
PYTHON=$(command -v python3 2> /dev/null)
20+
if [ -z "$_EM_PY" ]; then
21+
_EM_PY=$(command -v python3 2> /dev/null)
2422
fi
2523

26-
if [ -z "$PYTHON" ]; then
27-
PYTHON=$(command -v python 2> /dev/null)
24+
if [ -z "$_EM_PY" ]; then
25+
_EM_PY=$(command -v python 2> /dev/null)
2826
fi
2927

30-
if [ -z "$PYTHON" ]; then
28+
if [ -z "$_EM_PY" ]; then
3129
echo 'unable to find python in $PATH'
3230
exit 1
3331
fi
3432

3533
if [ -z "$_EMCC_CCACHE" ]; then
36-
exec "$PYTHON" -E "$0.py" "$@"
34+
exec "$_EM_PY" -E "$0.py" "$@"
3735
else
3836
unset _EMCC_CCACHE
3937
exec ccache "$0" "$@"

emcc.bat

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
::
33
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
44
::
5-
:: To make modifications to this file, edit `tools/run_python_compiler.bat` and
6-
:: then run `tools/create_entry_points.py`
5+
:: To make modifications to this file, edit `tools\maint\run_python_compiler.bat` and
6+
:: then run `tools\maint\create_entry_points.py`
77

88
:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
99
:: or there will be a parsing error.
@@ -13,9 +13,9 @@
1313
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1414
:: of cpython used in cross compilation via setup.py.
1515
@set _PYTHON_SYSCONFIGDATA_NAME=
16-
@set EM_PY=%EMSDK_PYTHON%
17-
@if "%EM_PY%"=="" (
18-
set EM_PY=python
16+
@set _EM_PY=%EMSDK_PYTHON%
17+
@if "%_EM_PY%"=="" (
18+
set _EM_PY=python
1919
)
2020

2121
:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
@@ -42,7 +42,7 @@
4242
:: If _EMCC_CCACHE is not set, do a regular invocation of the python compiler driver.
4343
:: Otherwise remove the ccache env. var, and then reinvoke this script with ccache enabled.
4444
@if "%_EMCC_CCACHE%"=="" (
45-
set CMD="%EM_PY%" -E "%MYDIR%%~n0.py"
45+
set CMD="%_EM_PY%" -E "%MYDIR%%~n0.py"
4646
) else (
4747
set _EMCC_CCACHE=
4848
set CMD=ccache "%MYDIR%%~n0.bat"

test/runner

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,23 @@
1111
# To make modifications to this file, edit `tools/run_python.sh` and then run
1212
# `tools/maint/create_entry_points.py`
1313

14-
# $PYTHON -E does not ignore _PYTHON_SYSCONFIGDATA_NAME, an internal of cpython
14+
# $_EM_PY -E does not ignore _PYTHON_SYSCONFIGDATA_NAME, an internal of cpython
1515
# used in cross compilation via setup.py, so we unset it explicitly here.
1616
unset _PYTHON_SYSCONFIGDATA_NAME
1717

18-
if [ -z "$PYTHON" ]; then
19-
PYTHON=$EMSDK_PYTHON
20-
fi
18+
_EM_PY=$EMSDK_PYTHON
2119

22-
if [ -z "$PYTHON" ]; then
23-
PYTHON=$(command -v python3 2> /dev/null)
20+
if [ -z "$_EM_PY" ]; then
21+
_EM_PY=$(command -v python3 2> /dev/null)
2422
fi
2523

26-
if [ -z "$PYTHON" ]; then
27-
PYTHON=$(command -v python 2> /dev/null)
24+
if [ -z "$_EM_PY" ]; then
25+
_EM_PY=$(command -v python 2> /dev/null)
2826
fi
2927

30-
if [ -z "$PYTHON" ]; then
28+
if [ -z "$_EM_PY" ]; then
3129
echo 'unable to find python in $PATH'
3230
exit 1
3331
fi
3432

35-
exec "$PYTHON" -E "$0.py" "$@"
33+
exec "$_EM_PY" -E "$0.py" "$@"

test/runner.bat

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
::
33
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
44
::
5-
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6-
:: `tools/maint/create_entry_points.py`
5+
:: To make modifications to this file, edit `tools\run_python.bat` and then run
6+
:: `tools\maint\create_entry_points.py`
77

88
:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
99
:: or there will be a parsing error.
@@ -13,9 +13,9 @@
1313
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1414
:: of cpython used in cross compilation via setup.py.
1515
@set _PYTHON_SYSCONFIGDATA_NAME=
16-
@set EM_PY=%EMSDK_PYTHON%
17-
@if "%EM_PY%"=="" (
18-
set EM_PY=python
16+
@set _EM_PY=%EMSDK_PYTHON%
17+
@if "%_EM_PY%"=="" (
18+
set _EM_PY=python
1919
)
2020

2121
:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
@@ -71,16 +71,16 @@
7171
)
7272

7373
:NORMAL_EXIT
74-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
74+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*
7575
@exit %ERRORLEVEL%
7676

7777
:MUTE_STDIN
78-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
78+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
7979
@exit /b %ERRORLEVEL%
8080

8181
:MUTE_STDIN_EXIT
82-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
82+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
8383
@exit %ERRORLEVEL%
8484

8585
:NORMAL
86-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
86+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*

tools/maint/run_python.bat

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
::
33
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
44
::
5-
:: To make modifications to this file, edit `tools/run_python.bat` and then run
6-
:: `tools/maint/create_entry_points.py`
5+
:: To make modifications to this file, edit `tools\run_python.bat` and then run
6+
:: `tools\maint\create_entry_points.py`
77

88
:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
99
:: or there will be a parsing error.
@@ -13,9 +13,9 @@
1313
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
1414
:: of cpython used in cross compilation via setup.py.
1515
@set _PYTHON_SYSCONFIGDATA_NAME=
16-
@set EM_PY=%EMSDK_PYTHON%
17-
@if "%EM_PY%"=="" (
18-
set EM_PY=python
16+
@set _EM_PY=%EMSDK_PYTHON%
17+
@if "%_EM_PY%"=="" (
18+
set _EM_PY=python
1919
)
2020

2121
:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
@@ -71,16 +71,16 @@
7171
)
7272

7373
:NORMAL_EXIT
74-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
74+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*
7575
@exit %ERRORLEVEL%
7676

7777
:MUTE_STDIN
78-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
78+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
7979
@exit /b %ERRORLEVEL%
8080

8181
:MUTE_STDIN_EXIT
82-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
82+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
8383
@exit %ERRORLEVEL%
8484

8585
:NORMAL
86-
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
86+
@"%_EM_PY%" -E "%MYDIR%%~n0.py" %*

0 commit comments

Comments
 (0)