Skip to content

Remove support for windows 7 from .bat file launchers #24913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ See docs/process.md for more on how version tagging works.

4.0.13 (in development)
-----------------------
- Support for Windows 7 and the `EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG`
environment variable was removed.
- `sdl-config` and `sdl2-config` scripts were simplified to avoid using python
and the `.bat` file versions were removed, matching upstream SDL. (#24907)
- The `addRunDependency`/`removeRunDependency` now assert in debug builds if
Expand Down
28 changes: 2 additions & 26 deletions bootstrap.bat
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
@exit %ERRORLEVEL%

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

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

:NORMAL
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
28 changes: 2 additions & 26 deletions em++.bat
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@%CMD% %*
@exit %ERRORLEVEL%

:MUTE_STDIN
@%CMD% %* < NUL
@exit /b %ERRORLEVEL%

:MUTE_STDIN_EXIT
@%CMD% %* < NUL
@exit %ERRORLEVEL%

:NORMAL
@%CMD% %*
28 changes: 2 additions & 26 deletions emcc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@%CMD% %*
@exit %ERRORLEVEL%

:MUTE_STDIN
@%CMD% %* < NUL
@exit /b %ERRORLEVEL%

:MUTE_STDIN_EXIT
@%CMD% %* < NUL
@exit %ERRORLEVEL%

:NORMAL
@%CMD% %*
28 changes: 2 additions & 26 deletions test/runner.bat
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
@exit %ERRORLEVEL%

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

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

:NORMAL
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
7 changes: 2 additions & 5 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -14411,11 +14411,8 @@ def test_emscripten_set_timeout(self):
def test_emscripten_set_timeout_loop(self):
self.do_runf('emscripten_set_timeout_loop.c', args=['-pthread', '-sPROXY_TO_PTHREAD'])

# Verify that we are able to successfully compile a script when the Windows 7
# and Python workaround env. vars are enabled.
# See https://bugs.python.org/issue34780
@with_env_modify({'EM_WORKAROUND_PYTHON_BUG_34780': '1',
'EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG': '1'})
# Verify that we are able to successfully compile a script when Python workaround env. var is set
@with_env_modify({'EM_WORKAROUND_PYTHON_BUG_34780': '1'})
def test_windows_batch_script_workaround(self):
self.run_process([EMCC, test_file('hello_world.c')])
self.assertExists('a.out.js')
Expand Down
28 changes: 2 additions & 26 deletions tools/maint/run_python.bat
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
@exit %ERRORLEVEL%

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

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

:NORMAL
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
28 changes: 2 additions & 26 deletions tools/maint/run_python_compiler.bat
Original file line number Diff line number Diff line change
Expand Up @@ -54,42 +54,18 @@
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
goto NORMAL
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
goto MUTE_STDIN
)

:NORMAL_EXIT
@%CMD% %*
@exit %ERRORLEVEL%

:MUTE_STDIN
@%CMD% %* < NUL
@exit /b %ERRORLEVEL%

:MUTE_STDIN_EXIT
@%CMD% %* < NUL
@exit %ERRORLEVEL%

:NORMAL
@%CMD% %*