From 36af4a590fa868640fb928612693f9c05dfdb57a Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 9 Jul 2026 07:47:25 +0200 Subject: [PATCH] py-xxx.mk: Clean more python tool caches .mypy_cache, .ruff_cache and .pytest_cache are not consistently cleaned in all subdirectories. Fix that. Signed-off-by: Jan Lindemann --- make/py-defs.mk | 3 --- make/py-path.mk | 6 ++++++ make/py-run.mk | 6 +++--- make/py-test.mk | 6 +++--- make/py-topdir.mk | 3 ++- 5 files changed, 14 insertions(+), 10 deletions(-) diff --git a/make/py-defs.mk b/make/py-defs.mk index b96d5cf4..3f02d78c 100644 --- a/make/py-defs.mk +++ b/make/py-defs.mk @@ -73,7 +73,6 @@ endif ifneq ($(PY_DEFS_MK_INCLUDED),true) all: -clean: pyc.clean echo-py: @echo 'PYTHON = $(PYTHON)' @@ -86,8 +85,6 @@ echo-py: @echo 'PY_INSTALL_MOD = $(PY_INSTALL_MOD)' @echo 'PY_INSTALL_SUB_MOD = $(PY_INSTALL_SUB_MOD)' -pyc.clean: - $(RM) -rf $(wildcard *.pyc) __pycache__ libpath: py-libpath py-libpath: @echo 'export PYTHONPATH = $(PYTHONPATH)' diff --git a/make/py-path.mk b/make/py-path.mk index d6fee0cb..11a115cd 100644 --- a/make/py-path.mk +++ b/make/py-path.mk @@ -5,3 +5,9 @@ ifeq ($(origin JW_PKG_PYTHON_PATH),undefined) endif export PYTHONPATH := $(subst $(space),:,$(JW_PKG_PYTHON_PATH)) export MYPYPATH := $(PYTHONPATH) + +all: + +clean: py-tools.clean +py-tools.clean: + $(RM) -rf $(wildcard *.pyc) __pycache__ .mypy_cache .ruff_cache .pytest_cache diff --git a/make/py-run.mk b/make/py-run.mk index 43c210ed..f029ef8e 100644 --- a/make/py-run.mk +++ b/make/py-run.mk @@ -20,6 +20,6 @@ run.sh: echo -e "#!/bin/bash\n\nexport PYTHONPATH=$(PYTHONPATH)\nset -x\nexec $(PYTHON) $(EXE)" '"$$@"' > $@.tmp chmod 755 $@.tmp mv $@.tmp $@ -clean-run-sh: - rm -f run.sh -clean: clean-run-sh +clean.py-run: + rm -rf run.sh +clean: clean.py-run diff --git a/make/py-test.mk b/make/py-test.mk index 69634d8f..9ec652de 100644 --- a/make/py-test.mk +++ b/make/py-test.mk @@ -18,6 +18,6 @@ $(PY_CONFTEST): $(PY_CONFTEST_CMD) > $@.tmp mv $@.tmp $@ -clean: clean.generated -clean.generated: - rm -f $(PY_GENERATED) +clean: clean.py-test +clean.py-test: + rm -rf $(PY_GENERATED) .pytest-cache diff --git a/make/py-topdir.mk b/make/py-topdir.mk index 9b2ab591..65f170f3 100644 --- a/make/py-topdir.mk +++ b/make/py-topdir.mk @@ -72,9 +72,10 @@ ifneq ($(PY_CHECK_RUFF),) $(PY_CHECK_RUFF) check --select TC,FA --fix --unsafe-fixes $(PY_CHECK_ROOTS) endif +clean: clean.topdir clean.topdir: clean.py-check clean.py-check: - rm -rf .mypy_cache + rm -rf .mypy_cache .ruff_cache .pytest_cache pyproject.toml: $(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format tmpl \