All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m3s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m12s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m2s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m21s
CI / Packaging test (push) Successful in 0s
Add support for PY_INIT_SUBMODULES to py-mod.mk. If it is defined in a Makefile including py-mod.mk, the listed submodules will be added to __init__.py and thus included in the list of things that can be imported from a module.
This commit also adds support for --submodules to python-tools.sh for that to happen.
Signed-off-by: Jan Lindemann <jan@janware.com>
38 lines
1.6 KiB
Makefile
38 lines
1.6 KiB
Makefile
include $(JWBDIR)/make/defs.mk
|
|
include $(JWBDIR)/make/py-defs.mk
|
|
include $(JWBDIR)/make/dirs.mk
|
|
include $(JWBDIR)/make/dev-utils.mk
|
|
|
|
PY_INIT_TMPL = $(wildcard __init__.py.tmpl)
|
|
PY_SED_EXTRACT_EXPORT_DEF := /\(\(class\|def\)\s\+[a-zA-Z_].*\|^ *\S\+\s*=.*\|^\s\+\"\S\+\",\)\s*\#\s*export/!d;
|
|
PY_SED_EXTRACT_EXPORT_DEF := $(PY_SED_EXTRACT_EXPORT_DEF) /^\s*\#/ d; s/\(async\)*\s*\(class\|def\)\s*//;
|
|
PY_SED_EXTRACT_EXPORT_DEF := $(PY_SED_EXTRACT_EXPORT_DEF) s/[(:=].*//; s/^\s\+\"\(\S\+\)\",.*/\1/
|
|
PY_SED_EXTRACT_EXPORT ?= $(PY_SED_EXTRACT_EXPORT_DEF)
|
|
PY_INIT_FILTER ?= cat
|
|
PY_GENERATE_INIT_PY ?= /bin/bash $(JWB_SCRIPT_DIR)/python-tools.sh create-init -m . -e "$(PY_SED_EXTRACT_EXPORT)"
|
|
ifneq ($(PY_SYMBOL_FILTER),)
|
|
PY_GENERATE_INIT_PY += --symbol-filter "$(PY_SYMBOL_FILTER)"
|
|
endif
|
|
|
|
PY_INIT_SUBMODULES ?=
|
|
ifneq ($(PY_INIT_SUBMODULES),)
|
|
PY_GENERATE_INIT_PY += --submodules "$(PY_INIT_SUBMODULES)"
|
|
endif
|
|
|
|
#leftparen := (
|
|
#PY_EXPORT ?= $(shell sed '/\(class\|def\) ..*\# *export/ !d; s/\(class\|def\) *//; s/[$(leftparen):].*//' $(PY_SRC_PY))
|
|
|
|
all: $(PY_PYC)
|
|
install: install-dirs.done install-reg.done
|
|
clean: py.clean
|
|
distclean:
|
|
|
|
include $(JWBDIR)/make/py-rules.mk
|
|
|
|
ifeq ($(PY_UPDATE_INIT_PY),true)
|
|
__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
|
|
set -e -o pipefail; $(PY_GENERATE_INIT_PY) \
|
|
$(filter-out __init__.py,$(PY_ALL_PY)) $(SUBDIRS_TO_ITERATE) | $(PY_INIT_FILTER) | tee -a $@.tmp
|
|
mv $@.tmp $@
|
|
endif
|