Commit 18af404e authored by Justin Timmons's avatar Justin Timmons Committed by Noam Postavsky

Support python virtualenv on w32 (Bug#24464)

According to the virtualenv docs only POSIX systems follow the
structure "/path/to/venv/bin/", while windows systems use
"/path/to/venv/Scripts" for the location of the binary files, most
importantly including the python interpreter (see:
* lisp/progmodes/python.el (python-shell-calculate-exec-path): Use the
"/path/to/venv/Scripts" for `windows-nt' machines.

Copyright-paperwork-exempt: yes
parent efd0371c
......@@ -2113,20 +2113,25 @@ remote host, the returned value is intended for
(defun python-shell-calculate-exec-path ()
"Calculate `exec-path'.
Prepends `python-shell-exec-path' and adds the binary directory
for virtualenv if `python-shell-virtualenv-root' is set. If
`default-directory' points to a remote host, the returned value
appends `python-shell-remote-exec-path' instead of `exec-path'."
for virtualenv if `python-shell-virtualenv-root' is set - this
will use the python interpreter from inside the virtualenv when
starting the shell. If `default-directory' points to a remote host,
the returned value appends `python-shell-remote-exec-path' instead
of `exec-path'."
(let ((new-path (copy-sequence
(if (file-remote-p default-directory)
;; Windows and POSIX systems use different venv directory structures
(virtualenv-bin-dir (if (eq system-type 'windows-nt) "Scripts" "bin")))
new-path python-shell-exec-path)
(if (not python-shell-virtualenv-root)
(list (expand-file-name "bin" python-shell-virtualenv-root)))
(list (expand-file-name virtualenv-bin-dir python-shell-virtualenv-root)))
(defun python-shell-tramp-refresh-remote-path (vec paths)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment