Skip to content

Commit

Permalink
build, tools, win: check if python is a executable program
Browse files Browse the repository at this point in the history
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
  • Loading branch information
himself65 committed Dec 30, 2020
1 parent 8cf5ae0 commit 4dfdb67
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/msvs/find_python.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ exit /b 1

:found-python
echo Python found in %p%\python.exe
call :check-python %p%\python.exe
if errorlevel 1 goto :no-python
endlocal ^
& set "pt=%p%" ^
& set "need_path_ext=%need_path%"
Expand All @@ -55,6 +57,15 @@ set "pt="
set "need_path_ext="
exit /b 0

:check-python
%~1 -V
:: 9009 means error file not found
if %errorlevel% equ 9009 (
echo Not a executable Python program
exit /b 1
)
exit /b 0

:no-python
echo Could not find Python.
exit /b 1

0 comments on commit 4dfdb67

Please sign in to comment.