#!/usr/bin/env bash # # build.sh - builds gitdesk into a single executable: dist/gitdesk # # Run it on the system you want the executable for (Linux builds a Linux # binary, macOS builds a macOS one). For Windows use build.bat on Windows. # It makes its own throwaway environment in .build-venv, so it doesn't touch # your system Python packages. set -euo pipefail cd "$(dirname "$0")" PY=$(command -v python3 || command -v python || true) [[ -n $PY ]] || { echo "Python 3 wasn't found. Install it first."; exit 1; } echo "[1/3] Creating the build environment (.build-venv)..." if [[ ! -x .build-venv/bin/python ]]; then "$PY" -m venv .build-venv || { echo "Couldn't create a virtualenv. On Debian/Ubuntu: sudo apt install python3-venv"; exit 1; } fi VPY=.build-venv/bin/python echo "[2/3] Installing PyInstaller and Textual..." "$VPY" -m pip install --quiet --upgrade pip "$VPY" -m pip install --quiet pyinstaller -r requirements.txt echo "[3/3] Building..." # Textual and Rich load some of their modules on demand, so tell PyInstaller to # 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 echo echo "Done: $PWD/dist/gitdesk" echo "Copy it somewhere on your PATH (e.g. ~/.local/bin) and run 'gitdesk' inside a repo."