From a907a5640f68ae757a47842edba97c227e8a7a5b Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Wed, 16 Jul 2025 16:21:35 +0000 Subject: [PATCH] py-defs.mk: Support PY_INSTALL[_XXX] Support the Makefile variables PY_INSTALL, PY_INSTALL_REG, PY_INSTALL_PYC, all defaulting to true. They can be set to false to stop installation of whatever file type is undesired in the target. A common use case for this are __init__.cpython-313.pyc, provided by a package the installing package depends on. The prerequisite package might already provide these files for common directories. Signed-off-by: Jan Lindemann --- make/py-defs.mk | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/make/py-defs.mk b/make/py-defs.mk index 5c884a62..a94a7edc 100644 --- a/make/py-defs.mk +++ b/make/py-defs.mk @@ -56,10 +56,24 @@ else PY_INSTALL_DIR_PYC ?= $(PY_INSTALL_DIR_PY) endif +PY_INSTALL ?= true +PY_INSTALL_REG ?= true +ifneq ($(PY_INSTALL),true) + PY_INSTALL_REG = false +endif +PY_INSTALL_PYC ?= true +ifneq ($(PY_INSTALL_REG),true) + PY_INSTALL_PYC = false +endif + PY_INSTALL_DIRS ?= $(sort $(PY_INSTALL_DIR_PY) $(PY_INSTALL_DIR_PYC)) PY_INSTALLED_PY = $(addprefix $(PY_INSTALL_DIR_PY)/,$(sort $(PY_ALL_PY))) -PY_INSTALLED_PYC = $(addprefix $(PY_INSTALL_DIR_PY)/,$(PY_PYC)) -PY_INSTALLED_REG = $(PY_INSTALLED_PY) $(PY_INSTALLED_PYC) +ifeq ($(PY_INSTALL_PYC),true) + PY_INSTALLED_PYC = $(addprefix $(PY_INSTALL_DIR_PY)/,$(PY_PYC)) +endif +ifeq ($(PY_INSTALL_REG),true) + PY_INSTALLED_REG = $(PY_INSTALLED_PY) $(PY_INSTALLED_PYC) +endif PYTHONPATH ?= $(call proj_query, pythonpath $(PROJECT) $(PY_PREREQ_RUN)) #PYTHONPATH = $(subst $(space),,$(ENV_PYTHONPATH)$(foreach d,$(PY_MODULE_DIRS),:$(d)))