@@ -48,28 +48,6 @@ For example you may set it to `xterm -e' which will pop xterm console when you a
4848 :risky t
4949 :type 'string )
5050
51- (defun dap-python--pyenv-executable-find (command )
52- " Find executable taking pyenv shims into account.
53- If the executable is a system executable and not in the same path
54- as the pyenv version then also return nil. This works around https://github.com/pyenv/pyenv-which-ext
55- "
56- (if (executable-find " pyenv" )
57- (progn
58- (let ((pyenv-string (shell-command-to-string (concat " pyenv which " command)))
59- (pyenv-version-names (split-string (string-trim (shell-command-to-string " pyenv version-name" )) " :" ))
60- (executable nil )
61- (i 0 ))
62- (if (not (string-match " not found" pyenv-string))
63- (while (and (not executable)
64- (< i (length pyenv-version-names)))
65- (if (string-match (elt pyenv-version-names i) (string-trim pyenv-string))
66- (setq executable (string-trim pyenv-string)))
67- (if (string-match (elt pyenv-version-names i) " system" )
68- (setq executable (string-trim (executable-find command))))
69- (setq i (1+ i))))
70- executable))
71- (executable-find command)))
72-
7351(cl-defstruct dap-python--point
7452 (line (:type integer) :named t )
7553 (character (:type integer) :named t ))
@@ -180,7 +158,7 @@ as the pyenv version then also return nil. This works around https://github.com/
180158 " Populate CONF with the required arguments."
181159 (let* ((host " localhost" )
182160 (debug-port (dap--find-available-port))
183- (python-executable (dap-python--pyenv-executable-find dap- python-executable ))
161+ (python-executable (plist-get conf : python-exec-path ))
184162 (python-args (or (plist-get conf :args ) " " ))
185163 (program (or (plist-get conf :target-module )
186164 (plist-get conf :program )
@@ -237,6 +215,7 @@ as the pyenv version then also return nil. This works around https://github.com/
237215 :module nil
238216 :program nil
239217 :request " launch"
218+ :python-exec-path " /usr/bin/python"
240219 :name " Python :: Run file (buffer)" ))
241220
242221(dap-register-debug-template " Python :: Run pytest (buffer)"
@@ -246,6 +225,7 @@ as the pyenv version then also return nil. This works around https://github.com/
246225 :program nil
247226 :module " pytest"
248227 :request " launch"
228+ :python-exec-path " /usr/bin/python"
249229 :name " Python :: Run pytest (buffer)" ))
250230
251231(dap-register-debug-provider " python-test-at-point" 'dap-python--populate-test-at-point )
@@ -254,6 +234,7 @@ as the pyenv version then also return nil. This works around https://github.com/
254234 :args " "
255235 :module " pytest"
256236 :request " launch"
237+ :python-exec-path " /usr/bin/python"
257238 :name " Python :: Run pytest (at point)" ))
258239
259240(provide 'dap-python )
0 commit comments