From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Subject: Re: [RFC PATCH] .dir-locals: include QEMU code in PYTHONPATH
Date: Tue, 13 Oct 2026 11:37:34 +0100 [thread overview]
Message-ID: <87pkxdga35.fsf@draig.linaro.org> (raw)
In-Reply-To: <20260930163050.426737-1-alex.bennee@linaro.org> ("Alex Bennée"'s message of "Wed, 30 Sep 2026 17:30:50 +0100")
Alex Bennée <alex.bennee@linaro.org> writes:
> 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.
Gentle ping for any fellow Emacers who also hack on the python code.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> .dir-locals.el | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index 3ac0cfc6f0d..51871619422 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))))))))
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-10-13 10:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 16:30 [RFC PATCH] .dir-locals: include QEMU code in PYTHONPATH Alex Bennée
2026-10-13 10:37 ` Alex Bennée [this message]
2026-10-13 10:40 ` Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pkxdga35.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.