Skip to content

Commit 0b6fd62

Browse files
committed
Arrange python detection.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1937129 13f79535-47bb-0310-9956-ffa450edef68
1 parent 4c1d84e commit 0b6fd62

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

test/pytest_suite/runtests.bat

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,21 @@ if "%HERE:~-1%"=="\" set "HERE=%HERE:~0,-1%"
2626

2727
cd /d "%HERE%"
2828

29-
rem --- python location
30-
set PYTHON=%LOCALAPPDATA%\Programs\Python\Python314\python.exe
29+
rem --- python location: find the newest native Windows Python 3.x
30+
set PYTHON=
31+
for /f "delims=" %%D in ('dir /b /o-n "%LOCALAPPDATA%\Programs\Python\Python3*" 2^>nul') do (
32+
if not defined PYTHON set "PYTHON=%LOCALAPPDATA%\Programs\Python\%%D\python.exe"
33+
)
34+
if not defined PYTHON (
35+
for /f "delims=" %%D in ('dir /b /o-n "%PROGRAMFILES%\Python3*" 2^>nul') do (
36+
if not defined PYTHON set "PYTHON=%PROGRAMFILES%\%%D\python.exe"
37+
)
38+
)
39+
if not defined PYTHON (
40+
echo runtests.bat: ERROR: Python interpreter not found. >&2
41+
echo Install Python from https://www.python.org or set PYTHON=... >&2
42+
exit /b 1
43+
)
3144

3245
rem --- ensure the venv exists and is current ----------------------------------
3346
set "PYTEST=%HERE%\.venv\Scripts\pytest.exe"

0 commit comments

Comments
 (0)