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