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

The variables in py-xxx.mk are not very consistently named and used. This PR does some (not all) of the due cleanup.

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.

py-defs.mk, py-mod.mk: Add PY_LOCAL_PY(C)

The meaning of the many PY_XXX variables isn't easy to tell apart, so start renaming some of them.

PY_ALL_PY and PY_PYC consistently are now named PY_LOCAL|INSTALL_PY and PY_LOCAL|INSTALL_PYC, depending on whether or not they are intended to be installed.

The old PY_INSTALL_PY was renamed to PY_DO_INSTALLL_PY, a move that would be better applied to all boolean variables. I won't try with this commit, however, because a lot of downstream packages depend on PY_UPDATE_INIT_PY and PY_INSTALL_INIT_PY, i.e. without "_DO".

The variables in py-xxx.mk are not very consistently named and used. This PR does some (not all) of the due cleanup. #### 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. #### py-defs.mk, py-mod.mk: Add PY_LOCAL_PY(C) The meaning of the many PY_XXX variables isn't easy to tell apart, so start renaming some of them. PY_ALL_PY and PY_PYC consistently are now named PY_LOCAL|INSTALL_PY and PY_LOCAL|INSTALL_PYC, depending on whether or not they are intended to be installed. The old PY_INSTALL_PY was renamed to PY_DO_INSTALLL_PY, a move that would be better applied to all boolean variables. I won't try with this commit, however, because a lot of downstream packages depend on PY_UPDATE_INIT_PY and PY_INSTALL_INIT_PY, i.e. without "_DO".
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
py-defs.mk, py-mod.mk: Add PY_LOCAL_PY(C)
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m17s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m22s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m11s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m57s
CI / Packaging test (push) Successful in 0s
e6e96d64c2
The meaning of the many PY_XXX variables isn't easy to tell apart, so
start renaming some of them.

PY_ALL_PY and PY_PYC consistently are now named PY_LOCAL|INSTALL_PY and
PY_LOCAL|INSTALL_PYC, depending on whether or not they are intended to
be installed.

The old PY_INSTALL_PY was renamed to PY_DO_INSTALLL_PY, a move that
would be better applied to all boolean variables. I won't try with this
commit, however, because a lot of downstream packages depend on
PY_UPDATE_INIT_PY and PY_INSTALL_INIT_PY, i.e. without "_DO".

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-08-24 18:14:19 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
janware/jw-pkg!81
No description provided.