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

2026-06-11

build.cmds.CmdPythonpathOrig: Remove
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m35s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m39s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m32s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m29s
CI / Packaging test (push) Successful in 0s
Remove CmdPythonpathOrig. Its only purpose has ever been to document
and try out how  cmd_pythonpath_orig() had worked in an ancient
application version, that purpose is now served.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-11 12:36:10 +02:00
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>
2026-06-11 12:18:37 +02:00
cmds.projects.CmdPythonpath: Opts subdir, delimiter, prefix
Support additional options:

  --subdir    makes the command look for these existing
              subdirectories. Can be specified multiple times.

  --delimiter Does the obvious and defaults to ":"

  --prefix    A string to prepend verbatim before each path component

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-11 12:18:37 +02:00
App: Support --topdir-format "relative"
The global --topdir-format option governs how a project's root
directory is represented in paths output by various queries.
"absolute" means as absolute path, "unaltered" means verbatim as
specified via --topdir, make:xyz means replaced by the string $(xyz),
for later expansion in a makefile variable.

This commit adds another variant: "relative" yields the shortest
possible output format of the output path in question relative to
--topdir, with "shortest possible" in this context meaning
canonicalized and leading "./" stripped.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-11 12:18:37 +02:00