branch: elpa/flycheck
commit d34d57d79f8569f32b58da4752a9f55172b919f9
Author: Bozhidar Batsov <[email protected]>
Commit: Bozhidar Batsov <[email protected]>
Fall back to "python" when "python3" is unavailable
On Windows with Anaconda/Miniforge, only "python" is available, not
"python3". After loading, check if "python3" can be found and, if
not, set the executable for all Python-based checkers to "python".
Users can still override individual checker executables via their
respective flycheck-<checker>-executable variables.
Closes #2062
---
flycheck.el | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/flycheck.el b/flycheck.el
index 7664bbc139..8f35d87db2 100644
--- a/flycheck.el
+++ b/flycheck.el
@@ -11191,6 +11191,14 @@ See URL
`https://docs.python.org/3.4/library/py_compile.html'."
:modes (python-mode python-ts-mode)
:next-checkers ((warning . python-mypy)))
+;; On systems where "python3" is not available (e.g., Windows with
+;; Anaconda/Miniforge), fall back to "python" for Python-based checkers.
+(unless (executable-find "python3")
+ (dolist (checker '(json-python-json python-flake8 python-pylint
+ python-pycompile))
+ (let ((var (flycheck-checker-executable-variable checker)))
+ (set-default var "python"))))
+
(defun flycheck-pyright--parse-error (output checker buffer)
"Parse pyright errors/warnings from JSON OUTPUT.
CHECKER and BUFFER denote the CHECKER that returned OUTPUT and