| 1 |
-include variables.mk |
| 2 |
|
| 3 |
FORMAT_DIRS := src stubs tests |
| 4 |
LINT_DIRS := src tests |
| 5 |
|
| 6 |
PYTHON ?= poetry run python |
| 7 |
MYPY ?= poetry run mypy |
| 8 |
RUFF ?= poetry run ruff |
| 9 |
TY ?= poetry run ty |
| 10 |
|
| 11 |
.PHONY: install |
| 12 |
install: |
| 13 |
poetry sync --with dev |
| 14 |
|
| 15 |
.PHONY: lock |
| 16 |
lock: |
| 17 |
poetry lock |
| 18 |
|
| 19 |
.PHONY: update |
| 20 |
update: |
| 21 |
poetry update --with dev |
| 22 |
|
| 23 |
.PHONY: check |
| 24 |
check: check-format check-poetry check-style check-typing check-docs |
| 25 |
|
| 26 |
.PHONY: check-format |
| 27 |
check-format: |
| 28 |
$(RUFF) format --check $(FORMAT_DIRS) |
| 29 |
|
| 30 |
.PHONY: check-poetry |
| 31 |
check-poetry: |
| 32 |
poetry check |
| 33 |
|
| 34 |
.PHONY: check-style |
| 35 |
check-style: |
| 36 |
$(RUFF) check $(LINT_DIRS) |
| 37 |
|
| 38 |
.PHONY: check-typing |
| 39 |
check-typing: |
| 40 |
$(TY) check |
| 41 |
$(MYPY) $(LINT_DIRS) |
| 42 |
|
| 43 |
.PHONY: check-docs |
| 44 |
check-docs: |
| 45 |
poetry run rstcheck --recursive docs |
| 46 |
|
| 47 |
.PHONY: fix |
| 48 |
fix: |
| 49 |
$(RUFF) format $(FORMAT_DIRS) |
| 50 |
$(RUFF) check --fix $(LINT_DIRS) |
| 51 |
|
| 52 |
.PHONY: test |
| 53 |
test: |
| 54 |
$(PYTHON) -m unittest -v |
| 55 |
$(PYTHON) -m doctest src/nitrokey/trussed/_utils.py |
| 56 |
|
| 57 |
.PHONY: generate-protobuf |
| 58 |
generate-protobuf: |
| 59 |
protoc src/nitrokey/trussed/_bootloader/nrf52_upload/dfu/dfu-cc.proto --python_out=. --pyi_out=. |
| 60 |
|
| 61 |
.PHONY: generate-api-docs |
| 62 |
generate-api-docs: |
| 63 |
poetry run sphinx-apidoc --separate --maxdepth 1 --tocfile index --output-dir docs/api src/nitrokey |
| 64 |
|
| 65 |
.PHONY: build-docs |
| 66 |
build-docs: |
| 67 |
poetry run sphinx-build --fail-on-warning docs _build |