From 07d9eeea4211ce2f8e1c06876fcea4244902bfc3 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Mon, 27 Jan 2025 15:00:40 +0000 Subject: [PATCH] py-mod.mk: Support PY_INIT_FILTER Signed-off-by: Jan Lindemann --- make/py-mod.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/make/py-mod.mk b/make/py-mod.mk index 45abf981..4e86506c 100644 --- a/make/py-mod.mk +++ b/make/py-mod.mk @@ -5,6 +5,7 @@ include $(JWBDIR)/make/dev-utils.mk PY_INIT_TMPL = $(wildcard __init__.py.tmpl) PY_SED_EXTRACT_EXPORT ?= /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\s*=.*\)\# *export/ !d; /^\s*\#/ d; s/\(async\)* *\(class\|def\) *//; s/[(:=].*// +PY_INIT_FILTER ?= cat #leftparen := ( #PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY)) @@ -19,5 +20,5 @@ include $(JWBDIR)/make/py-rules.mk __init__.py: $(PY_INIT_TMPL) $(filter-out __init__.py,$(PY_SRC_PY)) if [ "$(PY_INIT_TMPL)" ]; then cat "$(PY_INIT_TMPL)" > $@.tmp; else > $@.tmp; fi /bin/bash +H $(JWB_SCRIPT_DIR)/python-tools.sh create-init -m $(PY_MOD) -e "$(PY_SED_EXTRACT_EXPORT)" \ - $(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | tee -a $@.tmp + $(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp mv $@.tmp $@