-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
78 lines (63 loc) · 2.35 KB
/
Copy pathMakefile
File metadata and controls
78 lines (63 loc) · 2.35 KB
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
PYTHON ?= python3
UV ?= uv
UV_CACHE ?= .uv-cache
DNSPYTHON ?=
PREFIX ?= /usr/local
SYSCONFDIR ?= /etc
SYSTEMD_DIR ?= /etc/systemd/system
INSTALL ?= install
.PHONY: check clean dev format help install integration lint sync syntax test uninstall unit uv-test
help:
@printf '%s\n' \
'Targets:' \
' make dev Create/update the uv virtualenv for ad hoc/dev use' \
' make sync Sync the uv virtualenv' \
' make format Format with Ruff' \
' make lint Lint with Ruff' \
' make syntax Compile faildns.py' \
' make unit Run unit tests' \
' make integration Run integration tests' \
' make test Run all tests' \
' make uv-test Run all tests in the uv environment' \
' Optional: DNSPYTHON=2.3.0, 2.7.0, 2.8.0, or latest-2.x' \
' make check Run lint, syntax, and tests' \
' make install Install faildns and systemd unit' \
' make uninstall Remove faildns and systemd unit'
sync:
$(UV) --cache-dir $(UV_CACHE) sync
dev: sync
format: sync
$(UV) --cache-dir $(UV_CACHE) run ruff format .
lint: sync
$(UV) --cache-dir $(UV_CACHE) run ruff check .
syntax:
$(PYTHON) -m py_compile faildns.py
unit:
$(PYTHON) -m unittest tests.test_faildns_unit -v
integration:
$(PYTHON) -m unittest tests.test_faildns_integration -v
test:
$(PYTHON) -m unittest discover -s tests -v
uv-test: sync
@if [ -n "$(DNSPYTHON)" ]; then \
if [ "$(DNSPYTHON)" = "latest-2.x" ]; then \
$(UV) --cache-dir $(UV_CACHE) pip install --python .venv/bin/python --upgrade 'dnspython>=2.3,<3'; \
else \
$(UV) --cache-dir $(UV_CACHE) pip install --python .venv/bin/python "dnspython==$(DNSPYTHON)"; \
fi; \
fi
$(UV) --cache-dir $(UV_CACHE) run --no-sync python -m unittest discover -s tests -v
check: lint syntax test
install:
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin
$(INSTALL) -d $(DESTDIR)$(SYSCONFDIR)/default
$(INSTALL) -d $(DESTDIR)$(SYSTEMD_DIR)
$(INSTALL) -m 0755 faildns.py $(DESTDIR)$(PREFIX)/bin/faildns
$(INSTALL) -m 0644 faildns.default $(DESTDIR)$(SYSCONFDIR)/default/faildns
$(INSTALL) -m 0644 faildns.service $(DESTDIR)$(SYSTEMD_DIR)/faildns.service
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/faildns
rm -f $(DESTDIR)$(SYSCONFDIR)/default/faildns
rm -f $(DESTDIR)$(SYSTEMD_DIR)/faildns.service
clean:
rm -rf .uv-cache .ruff_cache __pycache__ tests/__pycache__ faildns.egg-info