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
37 lines
1 KiB
Makefile
37 lines
1 KiB
Makefile
all:
|
|
|
|
py.clean:
|
|
$(RM) -f *.done *.pyc *.rep
|
|
$(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)
|
|
touch $@
|
|
|
|
install-reg.done: install-dirs.done $(PY_INSTALLED_REG)
|
|
touch $@
|
|
|
|
$(PY_INSTALL_DIR_PY)/%.py: %.py
|
|
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
|
|
|
ifneq ($(PYTHON_MAJOR),3)
|
|
%.pyc: %.py
|
|
else
|
|
__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: %.py
|
|
endif
|
|
$(PYTHON) -c "import py_compile; py_compile.compile(\"$<\", doraise=True)"
|
|
|
|
ifeq ($(PYTHON_MAJOR),3)
|
|
$(PY_INSTALL_DIR_PY)/__pycache__/%.$(PY_CPYTHON_PREFIX).pyc: __pycache__/%.$(PY_CPYTHON_PREFIX).pyc
|
|
else
|
|
$(PY_INSTALL_DIR_PY)/%.pyc: %.pyc
|
|
endif
|
|
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|
|
|
|
include $(JWBDIR)/make/py-check.mk
|
|
|
|
$(PY_INSTALL_DIR_PY)/py.typed: py.typed
|
|
$(INSTALL) -p -m $(PYMODMODE) -o $(PYMODOWNER) -g $(PYMODGROUP) $< $@
|