Improve CmdPythonpath / mypy_path generation #10

Merged
Jan Lindemann merged 4 commits from jan/feature/20260611-feature/20260611-better-mypy-path into master 2026-06-11 12:48:14 +02:00 AGit
Showing only changes of commit c8fc6326cb - Show all commits

py-topdir.mk: Use pythonpath --prefix for mypy_path

Make use of the newly introduced --prefix option to the pythonpath command, and generate what's subseqently used to fill in mypy_path in pyproject.toml.

By decoupling it from PYTHONPATH, this commit makes the creation of mypy_path less involved and easier to understand. It also obviates the need replace the relatively heavy ldlibpath.mk by the relatively lightweight projects.mk, thereby enhancing performance.

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-06-11 11:57:01 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -1,10 +1,10 @@
include $(JWBDIR)/make/ldlibpath.mk include $(JWBDIR)/make/projects.mk
TD_GENERATE_FILES += pyproject.toml TD_GENERATE_FILES += pyproject.toml
PY_CHECK_EXCLUDE ?= PY_CHECK_EXCLUDE ?=
MYPY_CONFIG_PATH = $(subst :,:$$MYPY_CONFIG_FILE_DIR/,:$(PYTHONPATH)) MYPY_CONFIG_PATH = $(shell $(JW_PKG_PY) --topdir-format relative projects pythonpath --prefix '$$MYPY_CONFIG_FILE_DIR/' $(PROJECT))
MYPY_PATH_DIRECTIVE = mypy_path = "$(MYPY_CONFIG_PATH)" MYPY_PATH_DIRECTIVE = mypy_path = "$(MYPY_CONFIG_PATH)"
ifndef PY_CHECK_ROOTS ifndef PY_CHECK_ROOTS