Skip to content

Commit 76ffaf5

Browse files
committed
use pyenv only if it's installed and a local shim exists for the cwd
1 parent 56e92dd commit 76ffaf5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dap-python.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ you are debugging."
4949
(defun dap-python--pyenv-executable-find (command)
5050
"Find executable COMMAND, taking pyenv shims into account.
5151
If the executable is a system executable and not in the same path
52-
as the pyenv version then also return nil. This works around
53-
https://github.com/pyenv/pyenv-which-ext."
54-
(if (executable-find "pyenv")
52+
as the pyenv version then also return nil. This works around
53+
https://github.com/pyenv/pyenv-which-ext.
54+
55+
If pyenv is not installed or if pyenv has no \"local\" version defined
56+
for the cwd, then fallback to `(executable-find)`, which see."
57+
(if (and
58+
(executable-find "pyenv")
59+
(not (string-match "no local" (shell-command-to-string "pyenv local")))
60+
)
5561
(progn
5662
(let ((pyenv-string (shell-command-to-string (concat "pyenv which " command)))
5763
(pyenv-version-names (split-string (string-trim (shell-command-to-string "pyenv version-name")) ":"))

0 commit comments

Comments
 (0)