make isntall

This commit is contained in:
2026-02-25 15:56:54 +02:00
parent d4e1f094a2
commit 5896b43221

View File

@@ -1,5 +1,7 @@
PYTHON ?= python3
PIP ?= $(PYTHON) -m pip
VENV_DIR ?= .venv
VENV_BIN := $(VENV_DIR)/bin
VENV_PYTHON := $(VENV_BIN)/python
SRC_DIR := $(CURDIR)/src
ENTRYPOINT := src/flow/__main__.py
DIST_DIR := dist
@@ -12,7 +14,7 @@ INSTALL_DIR ?= $(HOME)/.local/bin
help:
@printf "Targets:\n"
@printf " make deps Install build dependencies\n"
@printf " make deps Create .venv and install build dependencies\n"
@printf " make build Build standalone binary at dist/flow\n"
@printf " make install Build and install to ~/.local/bin/flow\n"
@printf " make install-local Install binary to ~/.local/bin/flow\n"
@@ -21,31 +23,33 @@ help:
deps:
@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; \
if [ ! -x "$(VENV_PYTHON)" ]; then \
if ! $(PYTHON) -m venv "$(VENV_DIR)" >/dev/null 2>&1; then \
if command -v apt-get >/dev/null 2>&1; then \
echo "venv support missing; installing python3-venv via apt-get (sudo required)"; \
sudo apt-get update; \
sudo apt-get install -y python3-venv; \
elif command -v dnf >/dev/null 2>&1; then \
echo "venv support missing; installing python3 via dnf (sudo required)"; \
sudo dnf install -y python3; \
elif command -v brew >/dev/null 2>&1; then \
echo "venv support missing; installing python via Homebrew"; \
brew install python; \
else \
echo "Unable to create virtualenv automatically. Install python venv support and rerun make deps."; \
exit 1; \
fi; \
$(PYTHON) -m venv "$(VENV_DIR)"; \
fi; \
fi; \
$$PIP_CMD install -e ".[build]"
. "$(VENV_BIN)/activate"; \
python -m pip install --upgrade pip; \
python -m pip install -e ".[build]"
build: deps
$(PYTHON) -m PyInstaller --noconfirm --clean --onefile --name flow --paths "$(SRC_DIR)" "$(ENTRYPOINT)"
@set -eu; \
. "$(VENV_BIN)/activate"; \
python -m PyInstaller --noconfirm --clean --onefile --name flow --paths "$(SRC_DIR)" "$(ENTRYPOINT)"
install-local: build
mkdir -p "$(INSTALL_DIR)"