.dir-locals: include QEMU code in PYTHONPATH

When editing python code the linters tools have a hard time with our
imports as they can't be found. To ease this we can expand a
PYTHONPATH in .dir-locals so at least Emacs users can have less
warnings in their editor.

I still get complaints from python-mypy about missing library stubs
that mean it can't do proper type analysis though.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20261019192704.3220373-4-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée committed 2026-10-23 17:31:37 +01:00
1 parent 314bb28853
commit 3112269be3
1 file changed
+7 -1
+7 -1
View File
@@ -1,2 +1,8 @@
((c-mode . ((c-file-style . "stroustrup")
(indent-tabs-mode . nil))))
(indent-tabs-mode . nil)))
(python-mode .
((eval . (when-let* ((root (locate-dominating-file default-directory ".dir-locals.el")))
(setq-local process-environment (copy-sequence process-environment))
(setenv "PYTHONPATH"
(concat (expand-file-name "python" root) ":"
(expand-file-name "tests/functional" root))))))))