jw-pkg/make/py-ns-dir.mk
Jan Lindemann 465b9f5461
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 6m1s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m58s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 9m14s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m35s
CI / Packaging test (push) Successful in 0s
py-ns-dir.mk: Fix PY_UPDATE_INIT_PY ?= false
The commit message of 29abf14a6 clearly states

  As of this commit, this is the case by default, i.e. PY_UPDATE_INIT_PY is
  set to false in py-ns-dir.mk, maintaining the current behaviour.

The commit's diff then proceeds to set PY_UPDATE_INIT_PY to true. Which is
a clear-cut case of my brain doing something different from what my fingers
do.

Correcting the commit. Some downstream projects have already consumed this
blunder. Not quite sure where that leaves us, but we need to start
somewhere with fixing, so I decide to make the code match the documented
behaviour, and wait for the fallout to fix.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-20 17:48:31 +02:00

26 lines
559 B
Makefile

define INIT_PY
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
endef
# The __init__.py machinery duplicates (but is independent from) py-mod.mk
PY_UPDATE_INIT_PY ?= false
PY_INSTALL_INIT_PY ?= false
ifneq ($(PY_UPDATE_INIT_PY),false)
PY_GENERATED_PY += __init__.py
endif
include $(JWBDIR)/make/dirs.mk
all: $(PY_GENERATED_PY)
clean: py.clean
py.clean:
rm -rf __pycache__ $(PY_GENERATED_PY)
__init__.py:
@echo "Creating default namespace stub $@.tmp"
$(file >$@.tmp,$(INIT_PY))
mv $@.tmp $@