Extract python-new-pythonpath to handle PYTHONPATH in user code
* lisp/progmodes/python.el (python-new-pythonpath): Extract from `python-shell-calculate-process-environment'.
This commit is contained in:
parent
a558cd1cc4
commit
3f05baa175
2 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-08-20 Sam Steingold <sds@gnu.org>
|
||||
|
||||
* progmodes/python.el (python-new-pythonpath): Extract from
|
||||
`python-shell-calculate-process-environment'.
|
||||
|
||||
2014-08-18 Thierry Volpiatto <thierry.volpiatto@gmail.com>
|
||||
|
||||
* emacs-lisp/eldoc.el (eldoc-highlight-function-argument): Add support
|
||||
|
|
|
@ -2069,6 +2069,16 @@ uniqueness for different types of configurations."
|
|||
(executable-find python-shell-interpreter)
|
||||
python-shell-interpreter-args)))
|
||||
|
||||
(defun python-new-pythonpath ()
|
||||
"Calculate the new PYTHONPATH value from `python-shell-extra-pythonpaths'."
|
||||
(let ((pythonpath (getenv "PYTHONPATH"))
|
||||
(extra (mapconcat 'identity
|
||||
python-shell-extra-pythonpaths
|
||||
path-separator)))
|
||||
(if pythonpath
|
||||
(concat extra path-separator pythonpath)
|
||||
extra)))
|
||||
|
||||
(defun python-shell-calculate-process-environment ()
|
||||
"Calculate process environment given `python-shell-virtualenv-path'."
|
||||
(let ((process-environment (append
|
||||
|
@ -2078,13 +2088,7 @@ uniqueness for different types of configurations."
|
|||
(directory-file-name python-shell-virtualenv-path)
|
||||
nil)))
|
||||
(when python-shell-extra-pythonpaths
|
||||
(setenv "PYTHONPATH"
|
||||
(format "%s%s%s"
|
||||
(mapconcat 'identity
|
||||
python-shell-extra-pythonpaths
|
||||
path-separator)
|
||||
path-separator
|
||||
(or (getenv "PYTHONPATH") ""))))
|
||||
(setenv "PYTHONPATH" (python-new-pythonpath)))
|
||||
(if (not virtualenv)
|
||||
process-environment
|
||||
(setenv "PYTHONHOME" nil)
|
||||
|
|
Loading…
Add table
Reference in a new issue