Skip to content
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

build, tools, win: check if python is a executable program #36696

Closed
wants to merge 2 commits into from
Closed
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
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 an executable Python program
exit /b 1
)
exit /b 0

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