py-xxx.mk: Some variable housekeeping #81

Merged
Jan Lindemann merged 2 commits from jan/fix/20260824-py-defs-mk-some-variable-housekeeping into master 2026-08-24 18:23:01 +02:00 AGit
Showing only changes of commit 5a3355b936 - Show all commits

py-rules.mk: py.clean: Honour PY_UPDATE_INIT_PY

py.clean unconditionally runs scm.sh clean -f __init__.py, which
deletes untracked __init__.py files in the source directory. In a
package with PY_UPDATE_INIT_PY=false the build never generates
__init__.py, as the generation rule in py-mod.mk is gated on the
same variable.

The __init__.py files in question are hand-written sources which are
always tracked in SCM, and for those, "scm.sh clean" becomes a no-op, so
with the current code, no real problem occurs, but explicitly protecting
__init__.py from deletion if PY_UPDATE_INIT_PY is false is certainly
more obvious.

Move the __init__.py cleanup inside the PY_UPDATE_INIT_PY=true
conditional so that py.clean only runs removal commands on files the
build actually generates.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Jan Lindemann 2026-08-23 15:08:08 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -2,8 +2,10 @@ all:
py.clean:
$(RM) -f *.done *.pyc *.rep
/bin/bash $(JWB_SCRIPT_DIR)/scm.sh clean -f __init__.py
$(RM) -rf __pycache__ .mypy_cache
ifeq ($(PY_UPDATE_INIT_PY),true)
/bin/bash $(JWB_SCRIPT_DIR)/scm.sh clean -f __init__.py
endif
install-dirs.done:
$(INSTALL) -d -m $(PYJWBDIRMODE) -o $(PYJWBDIROWNER) -g $(PYJWBDIRGROUP) $(PY_INSTALL_DIRS)