diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4ed24a4a4c6..4f645ad64c8 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2069,6 +2069,16 @@ uniqueness for different types of configurations." | |||
| 2069 | (executable-find python-shell-interpreter) | 2069 | (executable-find python-shell-interpreter) |
| 2070 | python-shell-interpreter-args))) | 2070 | python-shell-interpreter-args))) |
| 2071 | 2071 | ||
| 2072 | (defun python-new-pythonpath () | ||
| 2073 | "Calculate the new PYTHONPATH value from `python-shell-extra-pythonpaths'." | ||
| 2074 | (let ((pythonpath (getenv "PYTHONPATH")) | ||
| 2075 | (extra (mapconcat 'identity | ||
| 2076 | python-shell-extra-pythonpaths | ||
| 2077 | path-separator))) | ||
| 2078 | (if pythonpath | ||
| 2079 | (concat extra path-separator pythonpath) | ||
| 2080 | extra))) | ||
| 2081 | |||
| 2072 | (defun python-shell-calculate-process-environment () | 2082 | (defun python-shell-calculate-process-environment () |
| 2073 | "Calculate process environment given `python-shell-virtualenv-path'." | 2083 | "Calculate process environment given `python-shell-virtualenv-path'." |
| 2074 | (let ((process-environment (append | 2084 | (let ((process-environment (append |
| @@ -2078,13 +2088,7 @@ uniqueness for different types of configurations." | |||
| 2078 | (directory-file-name python-shell-virtualenv-path) | 2088 | (directory-file-name python-shell-virtualenv-path) |
| 2079 | nil))) | 2089 | nil))) |
| 2080 | (when python-shell-extra-pythonpaths | 2090 | (when python-shell-extra-pythonpaths |
| 2081 | (setenv "PYTHONPATH" | 2091 | (setenv "PYTHONPATH" (python-new-pythonpath))) |
| 2082 | (format "%s%s%s" | ||
| 2083 | (mapconcat 'identity | ||
| 2084 | python-shell-extra-pythonpaths | ||
| 2085 | path-separator) | ||
| 2086 | path-separator | ||
| 2087 | (or (getenv "PYTHONPATH") "")))) | ||
| 2088 | (if (not virtualenv) | 2092 | (if (not virtualenv) |
| 2089 | process-environment | 2093 | process-environment |
| 2090 | (setenv "PYTHONHOME" nil) | 2094 | (setenv "PYTHONHOME" nil) |