Debian Codegraph @

Makefile

raw
1 # system python interpreter. used only to create virtual environment
2 PY = python3
3 VENV = venv
4 BIN=$(VENV)/bin
5
6 DOCS_SRC = docs
7 DOCS_OUT = site
8
9
10 ifeq ($(OS), Windows_NT)
11 BIN=$(VENV)/Scripts
12 PY=python
13 endif
14
15
16 .PHONY: all
17 all: lint mypy test test-release
18
19 $(VENV): requirements.txt requirements-dev.txt pyproject.toml
20 $(PY) -m venv $(VENV)
21 $(BIN)/pip install --upgrade -r requirements.txt
22 $(BIN)/pip install --upgrade -r requirements-dev.txt
23 $(BIN)/pip install -e .['dev']
24 touch $(VENV)
25
26 .PHONY: test
27 test: $(VENV)
28 $(BIN)/pytest
29
30 .PHONY: mypy
31 mypy: $(VENV)
32 $(BIN)/mypy
33
34 .PHONY: lint
35 lint: $(VENV)
36 $(BIN)/ruff check .
37
38 .PHONY: build
39 build: $(VENV)
40 rm -rf dist
41 $(BIN)/python3 -m build
42
43 .PHONY: test-release
44 test-release: $(VENV) build
45 $(BIN)/twine check dist/*
46
47 .PHONY: release
48 release: $(VENV) build
49 $(BIN)/twine upload dist/*
50
51 .PHONY: update-pygmentize
52 update-pygmentize: $(VENV)
53 $(BIN)/pygmentize -f html -S default > blag/static/code-light.css
54 $(BIN)/pygmentize -f html -S monokai > blag/static/code-dark.css
55
56 .PHONY: update-requirements
57 update-requirements: $(VENV)
58 $(BIN)/pip-compile --upgrade --no-annotate --strip-extras --output-file requirements.txt
59 $(BIN)/pip-compile --upgrade --no-annotate --strip-extras --extra dev --output-file requirements-dev.txt
60
61 .PHONY: docs
62 docs: $(VENV)
63 $(BIN)/mkdocs build
64
65 .PHONY: serve-docs
66 serve-docs: $(VENV)
67 $(BIN)/mkdocs serve
68
69 .PHONY: manpage
70 manpage: $(VENV)
71 help2man $(BIN)/blag --no-info -n "blog-aware, static site generator" -o debian/blag.1
72
73 .PHONY: clean
74 clean:
75 rm -rf build dist *.egg-info
76 rm -rf $(VENV)
77 rm -rf $(DOCS_OUT)
78 find . -type f -name *.pyc -delete
79 find . -type d -name __pycache__ -delete
80 # coverage
81 rm -rf htmlcov .coverage
82 rm -rf .mypy_cache