Improve Python config file template substitution #8
2 changed files with 13 additions and 2 deletions
py-topdir.mk: Add machinery to generate pyproject.toml
pyproject.toml is currently copied unchanged from conf/topdir to the toplevel directory. Set up machinery in py-topdir.mk to render it from a template in conf/templates instead, replacing {mypypath} in the process.
Signed-off-by: Jan Lindemann <jan@janware.com>
commit
850efda804
|
|
@ -1,6 +1,12 @@
|
||||||
TD_COPY_FILES += pyproject.toml
|
include $(JWBDIR)/make/ldlibpath.mk
|
||||||
|
|
||||||
|
TD_GENERATE_FILES += pyproject.toml
|
||||||
|
|
||||||
PY_CHECK_EXCLUDE ?=
|
PY_CHECK_EXCLUDE ?=
|
||||||
|
|
||||||
|
MYPY_CONFIG_PATH = $(subst :,:$$MYPY_CONFIG_FILE_DIR/,:$(PYTHONPATH))
|
||||||
|
MYPY_PATH_DIRECTIVE = mypy_path = "$(MYPY_CONFIG_PATH)"
|
||||||
|
|
||||||
ifndef PY_CHECK_ROOTS
|
ifndef PY_CHECK_ROOTS
|
||||||
PY_CHECK_ROOTS += $(wildcard $(TOPDIR)/src $(TOPDIR)/tools)
|
PY_CHECK_ROOTS += $(wildcard $(TOPDIR)/src $(TOPDIR)/tools)
|
||||||
endif
|
endif
|
||||||
|
|
@ -70,7 +76,12 @@ clean.topdir: clean.py-check
|
||||||
clean.py-check:
|
clean.py-check:
|
||||||
rm -rf .mypy_cache
|
rm -rf .mypy_cache
|
||||||
|
|
||||||
|
pyproject.toml:
|
||||||
|
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format tmpl \
|
||||||
|
--template-name $@ --search-path $(JW_PKG_CONF_BASE_DIR)/templates --field mypypath='$(MYPY_PATH_DIRECTIVE)' $(PROJECT) > $@.tmp
|
||||||
|
mv $@.tmp $@
|
||||||
|
|
||||||
pyrightconfig.json:
|
pyrightconfig.json:
|
||||||
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format pyright \
|
$(PYTHON) $(JWB_SCRIPT_DIR)/jw-pkg.py -p $(PROJECTS_DIR) -t $(TOPDIR) --topdir-format unaltered projects create-file --format pyright \
|
||||||
$(PROJECT) --field base=$(JW_PKG_CONF_BASE_DIR)/project/pyrightconfig-base.json $(addprefix --field include=,$(wildcard src/python tools/python)) > $@.tmp
|
--field base=$(JW_PKG_CONF_BASE_DIR)/project/pyrightconfig-base.json $(addprefix --field include=,$(wildcard src/python tools/python)) $(PROJECT) > $@.tmp
|
||||||
mv $@.tmp $@
|
mv $@.tmp $@
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue