Skip to content

Use pyenv to find executable only if pyenv is installed and a local shim exists for the cwd #839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions dap-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ you are debugging."
(defun dap-python--pyenv-executable-find (command)
"Find executable COMMAND, taking pyenv shims into account.
If the executable is a system executable and not in the same path
as the pyenv version then also return nil. This works around
https://github.com/pyenv/pyenv-which-ext."
(if (executable-find "pyenv")
as the pyenv version then also return nil. This works around
https://github.com/pyenv/pyenv-which-ext.

If pyenv is not installed or if pyenv has no \"local\" version defined
for the cwd, then fallback to `(executable-find)`, which see."
(if (and
(executable-find "pyenv")
(not (string-match "no local" (shell-command-to-string "pyenv local")))
)
(progn
(let ((pyenv-string (shell-command-to-string (concat "pyenv which " command)))
(pyenv-version-names (split-string (string-trim (shell-command-to-string "pyenv version-name")) ":"))
Expand Down