-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
69 lines (52 loc) · 1.68 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
SOURCE= src
DOCS= htmlcov
DISTDIRS= *.egg-info build dist
SOFTHSM2_CONF= ${CURDIR}/testing/softhsm/softhsm.conf
SOFTHSM2_MODULE?= $(shell sh testing/softhsm/find_libsofthsm2.sh)
BUILDINFO= $(SOURCE)/kskm/buildinfo.py
TEST_ENV= SOFTHSM2_CONF=$(SOFTHSM2_CONF) \
SOFTHSM2_MODULE=$(SOFTHSM2_MODULE)
PYTEST_OPTS= --verbose
PYTEST_CACHE= .pytest_cache
all: $(BUILDINFO)
depend: softhsm
poetry install --all-extras
wheel: $(BUILDINFO)
poetry build -f wheel
softhsm:
test -f $(SOFTHSM2_MODULE) || echo "Failed to find SoftHSM module"
(cd testing/softhsm; make SOFTHSM_CONF=$(SOFTHSM2_CONF) all)
test: softhsm $(BUILDINFO)
env $(TEST_ENV) poetry run python -m pytest $(PYTEST_OPTS) $(SOURCE)
container:
docker compose build
coverage: softhsm $(BUILDINFO)
env $(TEST_ENV) poetry run coverage run -m pytest $(PYTEST_OPTS) $(SOURCE)
poetry run coverage html
reformat:
poetry run ruff check --select I --fix $(SOURCE)
poetry run ruff format $(SOURCE)
lint:
poetry run ruff check $(SOURCE)
typecheck:
poetry run mypy --install-types --non-interactive --pretty --ignore-missing-imports $(SOURCE)
vscode_packages:
sudo apt-get update
sudo apt-get install -y swig softhsm2
# This target is used by the devcontainer.json to configure the devcontainer
vscode: vscode_packages softhsm
pip3 install poetry
poetry install --all-extras
$(BUILDINFO): $(SOURCE)
if [ -d .git ]; then \
printf "__commit__ = \"`git rev-parse HEAD`\"\n__timestamp__ = \"`date +'%Y-%m-%d %H:%M:%S %Z'`\"\n" > $@ ;\
else \
echo "" > $@ ;\
fi
clean:
(cd testing/softhsm; make SOFTHSM_CONF=$(SOFTHSM2_CONF) clean)
rm -fr $(DOCS) $(DISTDIRS)
rm -f $(BUILDINFO)
realclean: clean
rm -fr $(VENV)
rm -fr $(PYTEST_CACHE)