| 1 |
-include .env.example |
| 2 |
-include .env |
| 3 |
|
| 4 |
MAKE_NOPRINT := $(MAKE) --no-print-directory |
| 5 |
|
| 6 |
SHELL := bash |
| 7 |
.ONESHELL: |
| 8 |
.SHELLFLAGS := -euo pipefail -c |
| 9 |
.SILENT: |
| 10 |
|
| 11 |
.PHONY: docs docker-docs lint format |
| 12 |
|
| 13 |
define RUN_COLOR |
| 14 |
script -qfec '$(1); ec=$$?; exit $$ec' /dev/null |
| 15 |
endef |
| 16 |
|
| 17 |
lint l: |
| 18 |
@parallel --jobs=0 --line-buffer --tag "$(MAKE_NOPRINT) {}" ::: \ |
| 19 |
lint-pylint \ |
| 20 |
lint-ruff-check \ |
| 21 |
lint-ruff-format \ |
| 22 |
|
| 23 |
lint-pylint: |
| 24 |
$(call RUN_COLOR, PYTHONPATH=. pylint --fail-under=10.0 --output-format=pylint_source_reporter.SourceCodeReporter treetime) |
| 25 |
|
| 26 |
lint-ruff-check: |
| 27 |
$(call RUN_COLOR, ruff check -q treetime) |
| 28 |
|
| 29 |
lint-ruff-format: |
| 30 |
$(call RUN_COLOR, ruff format -q --check treetime) |
| 31 |
|
| 32 |
lint-pyright: |
| 33 |
$(call RUN_COLOR, pyright) |
| 34 |
|
| 35 |
format fmt f: |
| 36 |
@ruff format . |
| 37 |
|
| 38 |
docs: |
| 39 |
@$(MAKE) --no-print-directory -C docs/ html |
| 40 |
|
| 41 |
docs-clean: |
| 42 |
rm -rf docs/build |
| 43 |
|
| 44 |
docker-docs: |
| 45 |
export DOCS_CONTAINER_NAME=treetime-docs |
| 46 |
export UID=$(shell id -u) |
| 47 |
export GID=$(shell id -g) |
| 48 |
|
| 49 |
docker build -t $${DOCS_CONTAINER_NAME} \ |
| 50 |
--network=host \ |
| 51 |
--build-arg UID=$(shell id -u) \ |
| 52 |
--build-arg GID=$(shell id -g) \ |
| 53 |
docs/ |
| 54 |
|
| 55 |
docker run -it --rm \ |
| 56 |
--name=$${DOCS_CONTAINER_NAME}-$(shell date +%s) \ |
| 57 |
--init \ |
| 58 |
--user=$(shell id -u):$(shell id -g) \ |
| 59 |
--volume=$(shell pwd):/home/user/src \ |
| 60 |
--publish=8000:8000 \ |
| 61 |
--workdir=/home/user/src \ |
| 62 |
--env 'TERM=xterm-256colors' \ |
| 63 |
$${DOCS_CONTAINER_NAME} |