jw-pkg/make/py-topdir.mk
Jan Lindemann 18f1c580f1
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m45s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m30s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m8s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m23s
CI / Packaging test (push) Successful in 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 after the build is
through, 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 16:08:51 +02:00

31 lines
1.2 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)
ifneq ($(wildcard dirs-all.done),)
PY_CHECK_ROOTS += $(wildcard $(TOPDIR)/test)
endif
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