jw-pkg/make/py-topdir.mk
Jan Lindemann c58ddda3b1
Some checks failed
CI / Packaging - Kali Linux (pull_request) Failing after 2m31s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Failing after 2m25s
CI / Packaging test (pull_request) Failing after 0s
py-topdir.mk: Add test tree to default check roots
PY_CHECK_ROOTS defaults to the src and tools directories, so the ruff,
mypy, pyright, and yapf checks and the bad-pattern scan silently skip test
trees. Python tests below test/ therefore escape linting, type checking,
and formatting enforcement, even though py-check.mk itself defaults to the
whole directory when no roots are given at all.

Add $(TOPDIR)/test to the default PY_CHECK_ROOTS so that the test tree
receives the same checks and formatting as src and tools. The previous
commit prepared this repo's unit tests for the strict type check and the
formatter, so the extended roots pass cleanly here.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
2026-09-13 15:15:26 +02:00

28 lines
1.1 KiB
Makefile

include $(JWBDIR)/make/projects.mk
TD_GENERATE_FILES += pyproject.toml
PY_CHECK_EXCLUDE ?=
MYPY_CONFIG_PATH = $(shell $(JW_PKG_PY) --topdir-format relative projects pythonpath --prefix '$$MYPY_CONFIG_FILE_DIR/' $(PROJECT))
MYPY_PATH_DIRECTIVE = mypy_path = "$(MYPY_CONFIG_PATH)"
ifndef PY_CHECK_ROOTS
PY_CHECK_ROOTS = $(wildcard $(TOPDIR)/src $(TOPDIR)/tools $(TOPDIR)/test)
endif
all:
clean: clean.topdir
clean.topdir: clean.py-check
pyproject.toml:
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format tmpl \
--template-name $@ --search-path $(JW_PKG_CONF_BASE_DIR)/templates --field mypypath='$(MYPY_PATH_DIRECTIVE)' $(PROJECT) > $@.tmp
mv $@.tmp $@
pyrightconfig.json:
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format pyright \
--field base=$(JW_PKG_CONF_BASE_DIR)/project/pyrightconfig-base.json $(addprefix --field include=,$(wildcard src/python tools/python)) $(PROJECT) > $@.tmp
mv $@.tmp $@
include $(JWBDIR)/make/py-check.mk