diff --git a/Makefile b/Makefile index e433bdb..aeab7c2 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,29 @@ help: @printf " make clean Remove build artifacts\n" deps: - $(PIP) install -e ".[build]" + @set -eu; \ + PIP_CMD="$(PIP)"; \ + if ! $$PIP_CMD --version >/dev/null 2>&1; then \ + if command -v pip3 >/dev/null 2>&1; then \ + PIP_CMD="pip3"; \ + elif $(PYTHON) -m ensurepip --version >/dev/null 2>&1; then \ + $(PYTHON) -m ensurepip --upgrade; \ + elif command -v apt-get >/dev/null 2>&1; then \ + echo "pip missing; installing python3-pip via apt-get (sudo required)"; \ + sudo apt-get update; \ + sudo apt-get install -y python3-pip; \ + elif command -v dnf >/dev/null 2>&1; then \ + echo "pip missing; installing python3-pip via dnf (sudo required)"; \ + sudo dnf install -y python3-pip; \ + elif command -v brew >/dev/null 2>&1; then \ + echo "pip missing; installing python via Homebrew"; \ + brew install python; \ + else \ + echo "Unable to bootstrap pip automatically. Install pip for $(PYTHON) and rerun make deps."; \ + exit 1; \ + fi; \ + fi; \ + $$PIP_CMD install -e ".[build]" build: deps $(PYTHON) -m PyInstaller --noconfirm --clean --onefile --name flow --paths "$(SRC_DIR)" "$(ENTRYPOINT)"