From 3112269be3ac92343a5f0e5d9eae919edd176a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Mon, 19 Oct 2026 20:26:48 +0100 Subject: [PATCH] .dir-locals: include QEMU code in PYTHONPATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é Message-ID: <20261019192704.3220373-4-alex.bennee@linaro.org> Signed-off-by: Alex Bennée --- .dir-locals.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.dir-locals.el b/.dir-locals.el index 3ac0cfc6f0..5187161942 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -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))))))))