Commit aa6541b79a for qemu.org
commit aa6541b79a28e82d872ddcd0e515c90d7b4bb333
Author: Alex Bennée <alex.bennee@linaro.org>
Date: Fri Nov 13 00:44:52 2026 +0000
Revert ".dir-locals: include QEMU code in PYTHONPATH"
Unfortunately this relied on trusting the source tree via the
safe-local-variable-directories otherwise users keep being prompted
that ".dir-locals.el contains values that may not be safe".
An alternative is for the user to add something like this to their
local emacs config:
(defun my-return-source-if-in-qemu-tree()
"Return the root of source when in QEMU code."
(when-let ((src (expand-file-name (locate-dominating-file default-directory ".git"))))
(if (file-exists-p (concat src "/qemu-options.hx"))
src)))
(defun my-set-qemu-python-path()
"Set local python environment for QEMU."
(when-let ((root (my-return-source-if-in-qemu-tree)))
(setq-local process-environment (copy-sequence process-environment))
(setenv "PYTHONPATH" (concat (expand-file-name "python" root) ":"
(expand-file-name "tests/functional" root)))))
(use-package python
:hook ((python-mode python-ts-mode) . my-set-qemu-python-path))
This reverts commit 3112269be3ac92343a5f0e5d9eae919edd176a35.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20261113004452.3027978-1-alex.bennee@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/.dir-locals.el b/.dir-locals.el
index 5187161942..3ac0cfc6f0 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,8 +1,2 @@
((c-mode . ((c-file-style . "stroustrup")
- (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))))))))
+ (indent-tabs-mode . nil))))