Skip to content

Commit a911bd1

Browse files
authored
bpo-43915: Add PCbuild/blurb.bat to simplify Windows contributors (pythonGH-25528)
1 parent fe63a40 commit a911bd1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

PCbuild/blurb.bat

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@echo off
2+
rem
3+
rem Runs the blurb tool. If necessary, will install Python and/or blurb.
4+
rem
5+
rem Pass "--update"/"-U" as the first argument to update blurb.
6+
rem
7+
8+
call "%~dp0find_python.bat" %PYTHON%
9+
if ERRORLEVEL 1 (echo Cannot locate python.exe on PATH or as PYTHON variable & exit /b 3)
10+
11+
if "%1" EQU "--update" (%PYTHON% -m pip install -U blurb && shift)
12+
if "%1" EQU "-U" (%PYTHON% -m pip install -U blurb && shift)
13+
14+
%PYTHON% -m blurb %1 %2 %3 %4 %5 %6 %7 %8 %9
15+
if ERRORLEVEL 1 goto :install_and_retry
16+
exit /B 0
17+
18+
:install_and_retry
19+
rem Before reporting the error, make sure that blurb is actually installed.
20+
rem If not, install it first and try again.
21+
set _ERR=%ERRORLEVEL%
22+
%PYTHON% -c "import blurb"
23+
if NOT ERRORLEVEL 1 exit /B %_ERR%
24+
echo Installing blurb...
25+
%PYTHON% -m pip install blurb
26+
if ERRORLEVEL 1 exit /B %ERRORLEVEL%
27+
%PYTHON% -m blurb %*
28+
exit /B

0 commit comments

Comments
 (0)