35 lines
854 B
Makefile
35 lines
854 B
Makefile
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
|
PYTHON := $(ROOT_DIR)venv/bin/python
|
|
PYTHONCLI := $(ROOT_DIR)venv.dist/bin/python
|
|
|
|
SRC_NAME = optimg
|
|
|
|
.PHONY: venv
|
|
venv:
|
|
@python3 -m venv venv
|
|
$(PYTHON) -m pip install -r requirements-dev.txt
|
|
|
|
lint:
|
|
$(PYTHON) -m ruff check --fix
|
|
|
|
format:
|
|
$(PYTHON) -m ruff format
|
|
|
|
check-type:
|
|
$(PYTHON) -m mypy .
|
|
|
|
check: format lint check-type
|
|
|
|
build: check
|
|
@rm -rf dist/*
|
|
$(PYTHON) build-deps.py
|
|
$(PYTHON) -m hatch -v build -t wheel
|
|
|
|
install: build
|
|
@python3 -m venv venv.dist
|
|
$(PYTHONCLI) -m pip install dist/$(SRC_NAME)-*.whl --force-reinstall
|
|
|
|
documentation:
|
|
$(PYTHON) -m pdoc --html -o docs src/ --force
|
|
@find docs/src/* -type f -exec sed -i 's/src\./$(SRC_NAME)\./g' {} \; -exec sed -i 's/src</$(SRC_NAME)</g' {} \;
|
|
@sed -i 's/<code>src<\/code>/<code>$(SRC_NAME)<\/code>/g' docs/src/index.html
|