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