49 lines
1.7 KiB
Batchfile
49 lines
1.7 KiB
Batchfile
@echo off
|
|
rem ==========================================================================
|
|
rem build.bat - builds gitdesk into a single Windows executable: dist\gitdesk.exe
|
|
rem
|
|
rem Needs Python 3.9+ installed. Double-click it or run it from this folder.
|
|
rem It makes its own throwaway environment in .build-venv, so it doesn't touch
|
|
rem your normal Python packages.
|
|
rem ==========================================================================
|
|
setlocal
|
|
cd /d "%~dp0"
|
|
|
|
set "PY="
|
|
where py >nul 2>&1 && set "PY=py -3"
|
|
if not defined PY where python >nul 2>&1 && set "PY=python"
|
|
if not defined PY (
|
|
echo Python 3 was not found. Install it from https://www.python.org/downloads/
|
|
goto :fail
|
|
)
|
|
|
|
echo [1/3] Creating the build environment - .build-venv ...
|
|
if not exist ".build-venv\Scripts\python.exe" %PY% -m venv .build-venv
|
|
if not exist ".build-venv\Scripts\python.exe" goto :fail
|
|
set "VPY=.build-venv\Scripts\python.exe"
|
|
|
|
echo [2/3] Installing PyInstaller and Textual...
|
|
"%VPY%" -m pip install --quiet --upgrade pip
|
|
"%VPY%" -m pip install --quiet pyinstaller -r requirements.txt
|
|
if errorlevel 1 goto :fail
|
|
|
|
echo [3/3] Building gitdesk.exe...
|
|
rem Textual and Rich load some of their modules on demand, so bundle all of them.
|
|
"%VPY%" -m PyInstaller --noconfirm --clean --onefile --name gitdesk ^
|
|
--collect-submodules textual --collect-data textual --collect-submodules rich ^
|
|
--specpath build --workpath build --distpath dist ^
|
|
gitdesk.py
|
|
if errorlevel 1 goto :fail
|
|
|
|
echo.
|
|
echo Done: %CD%\dist\gitdesk.exe
|
|
echo Copy it anywhere - a folder on your PATH is handy - and run "gitdesk" inside a repo.
|
|
pause
|
|
exit /b 0
|
|
|
|
:fail
|
|
echo.
|
|
echo Build failed - see the messages above.
|
|
pause
|
|
exit /b 1
|