Skip to content

bpo-43915: Add PCbuild/blurb.bat #25528

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

Merged
merged 1 commit into from
Apr 22, 2021
Merged
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
28 changes: 28 additions & 0 deletions PCbuild/blurb.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@echo off
rem
rem Runs the blurb tool. If necessary, will install Python and/or blurb.
rem
rem Pass "--update"/"-U" as the first argument to update blurb.
rem

call "%~dp0find_python.bat" %PYTHON%
if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)

if "%1" EQU "--update" (%PYTHON% -m pip install -U blurb && shift)
if "%1" EQU "-U" (%PYTHON% -m pip install -U blurb && shift)

%PYTHON% -m blurb %1 %2 %3 %4 %5 %6 %7 %8 %9
if ERRORLEVEL 1 goto :install_and_retry
exit /B 0

:install_and_retry
rem Before reporting the error, make sure that blurb is actually installed.
rem If not, install it first and try again.
set _ERR=%ERRORLEVEL%
%PYTHON% -c "import blurb"
if NOT ERRORLEVEL 1 exit /B %_ERR%
echo Installing blurb...
%PYTHON% -m pip install blurb
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
%PYTHON% -m blurb %*
exit /B