Skip to content

Commit adcde6b

Browse files
himself65ruyadorno
authored andcommitted
build: check if python is a executable program
After Windows 10 version 1903, placeholder files named "python.exe" and "python3.exe" appear, not executable programs, and open the MS Store when running without parameters. Fixes: #36694 Refs: https://devblogs.microsoft.com/python/python-in-the-windows-10-may-2019-update PR-URL: #36696 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 14cb9ea commit adcde6b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tools/msvs/find_python.cmd

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ exit /b 1
4646

4747
:found-python
4848
echo Python found in %p%\python.exe
49+
call :check-python %p%\python.exe
50+
if errorlevel 1 goto :no-python
4951
endlocal ^
5052
& set "pt=%p%" ^
5153
& set "need_path_ext=%need_path%"
@@ -54,6 +56,15 @@ set "pt="
5456
set "need_path_ext="
5557
exit /b 0
5658

59+
:check-python
60+
%~1 -V
61+
:: 9009 means error file not found
62+
if %errorlevel% equ 9009 (
63+
echo Not an executable Python program
64+
exit /b 1
65+
)
66+
exit /b 0
67+
5768
:no-python
5869
echo Could not find Python.
5970
exit /b 1

0 commit comments

Comments
 (0)