summaryrefslogtreecommitdiffstats
path: root/PCbuild/blurb.bat
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2021-04-22 19:45:47 (GMT)
committerGitHub <noreply@github.com>2021-04-22 19:45:47 (GMT)
commita911bd15a19824c92af8e90b63af4a84a9670222 (patch)
treee5cd885ae5159235fc1861f9ab8fee043fdcd546 /PCbuild/blurb.bat
parentfe63a401a9b3ca1751b81b5d6ddb2beb7f3675c1 (diff)
downloadcpython-a911bd15a19824c92af8e90b63af4a84a9670222.zip
cpython-a911bd15a19824c92af8e90b63af4a84a9670222.tar.gz
cpython-a911bd15a19824c92af8e90b63af4a84a9670222.tar.bz2
bpo-43915: Add PCbuild/blurb.bat to simplify Windows contributors (GH-25528)
Diffstat (limited to 'PCbuild/blurb.bat')
-rw-r--r--PCbuild/blurb.bat28
1 files changed, 28 insertions, 0 deletions
diff --git a/PCbuild/blurb.bat b/PCbuild/blurb.bat
new file mode 100644
index 0000000..0be228a
--- /dev/null
+++ b/PCbuild/blurb.bat
@@ -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