Commit 6f167f95 authored by Fabián Ezequiel Gallina's avatar Fabián Ezequiel Gallina
Browse files

* lisp/progmodes/python.el (python-shell-calculate-command): Rename

from python-shell-parse-command.  Cleanup.
(run-python, run-python-internal): Use it.
(python-shell-calculate-pythonpath): Rename from
python-new-pythonpath.
(python-shell-calculate-process-environment): Use it.
(python-shell-calculate-exec-path): Add comment.

* test/automated/python-tests.el
(python-shell-calculate-process-environment-2): Fix test.
(python-shell-calculate-process-environment-1)
(python-shell-calculate-process-environment-3): Cleanup.
parent 2444ac6d
2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
* progmodes/python.el (python-shell-calculate-command): Rename
from python-shell-parse-command. Cleanup.
(run-python, run-python-internal): Use it.
(python-shell-calculate-pythonpath): Rename from
python-new-pythonpath.
(python-shell-calculate-process-environment): Use it.
(python-shell-calculate-exec-path): Add comment.
2014-11-16 Thierry Banel <tbanelwebmin@free.fr> (tiny change)
 
* calc/calc-arith.el (math-max-list, math-min-list): Fix bug
......
......@@ -2084,19 +2084,22 @@ uniqueness for different types of configurations."
(or python-shell-virtualenv-root "")
(mapconcat #'identity python-shell-exec-path "")))))
(defun python-shell-parse-command () ;FIXME: why name it "parse"?
(defun python-shell-calculate-command ()
"Calculate the string used to execute the inferior Python process."
;; FIXME: process-environment doesn't seem to be used anywhere within
;; this let.
(let ((process-environment (python-shell-calculate-process-environment))
(exec-path (python-shell-calculate-exec-path)))
(let ((exec-path (python-shell-calculate-exec-path)))
;; `exec-path' gets tweaked so that virtualenv's specific
;; `python-shell-interpreter' absolute path can be found by
;; `executable-find'.
(format "%s %s"
;; FIXME: Why executable-find?
(executable-find python-shell-interpreter)
python-shell-interpreter-args)))
(defun python-new-pythonpath ()
"Calculate the new PYTHONPATH value from `python-shell-extra-pythonpaths'."
(define-obsolete-function-alias
'python-shell-parse-command
#'python-shell-calculate-command "25.1")
(defun python-shell-calculate-pythonpath ()
"Calculate the PYTHONPATH using `python-shell-extra-pythonpaths'."
(let ((pythonpath (getenv "PYTHONPATH"))
(extra (mapconcat 'identity
python-shell-extra-pythonpaths
......@@ -2114,7 +2117,7 @@ uniqueness for different types of configurations."
(directory-file-name python-shell-virtualenv-root)
nil)))
(when python-shell-extra-pythonpaths
(setenv "PYTHONPATH" (python-new-pythonpath)))
(setenv "PYTHONPATH" (python-shell-calculate-pythonpath)))
(if (not virtualenv)
process-environment
(setenv "PYTHONHOME" nil)
......@@ -2126,8 +2129,10 @@ uniqueness for different types of configurations."
(defun python-shell-calculate-exec-path ()
"Calculate exec path given `python-shell-virtualenv-root'."
(let ((path (append python-shell-exec-path
exec-path nil))) ;FIXME: Why nil?
(let ((path (append
;; Use nil as the tail so that the list is a full copy,
;; this is a paranoid safeguard for side-effects.
python-shell-exec-path exec-path nil)))
(if (not python-shell-virtualenv-root)
path
(cons (expand-file-name "bin" python-shell-virtualenv-root)
......@@ -2485,10 +2490,10 @@ process buffer for a list of commands.)"
(interactive
(if current-prefix-arg
(list
(read-shell-command "Run Python: " (python-shell-parse-command))
(read-shell-command "Run Python: " (python-shell-calculate-command))
(y-or-n-p "Make dedicated process? ")
(= (prefix-numeric-value current-prefix-arg) 4))
(list (python-shell-parse-command) nil t)))
(list (python-shell-calculate-command) nil t)))
(python-shell-make-comint
cmd (python-shell-get-process-name dedicated) show)
dedicated)
......@@ -2512,7 +2517,7 @@ startup."
(inferior-python-mode-hook nil))
(get-buffer-process
(python-shell-make-comint
(python-shell-parse-command)
(python-shell-calculate-command)
(python-shell-internal-get-process-name) nil t))))
(defun python-shell-get-buffer ()
......
2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el
(python-shell-calculate-process-environment-2): Fix test.
(python-shell-calculate-process-environment-1)
(python-shell-calculate-process-environment-3): Cleanup.
2014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
* automated/python-tests.el (python-indent-dedenters-8): New test
......
......@@ -1836,8 +1836,7 @@ Using `python-shell-interpreter' and
(ert-deftest python-shell-calculate-process-environment-1 ()
"Test `python-shell-process-environment' modification."
(let* ((original-process-environment process-environment)
(python-shell-process-environment
(let* ((python-shell-process-environment
'("TESTVAR1=value1" "TESTVAR2=value2"))
(process-environment
(python-shell-calculate-process-environment)))
......@@ -1846,8 +1845,8 @@ Using `python-shell-interpreter' and
(ert-deftest python-shell-calculate-process-environment-2 ()
"Test `python-shell-extra-pythonpaths' modification."
(let* ((original-process-environment process-environment)
(original-pythonpath (getenv "PYTHONPATH"))
(let* ((process-environment process-environment)
(original-pythonpath (setenv "PYTHONPATH" "path3"))
(paths '("path1" "path2"))
(python-shell-extra-pythonpaths paths)
(process-environment
......@@ -1859,8 +1858,7 @@ Using `python-shell-interpreter' and
(ert-deftest python-shell-calculate-process-environment-3 ()
"Test `python-shell-virtualenv-path' modification."
(let* ((original-process-environment process-environment)
(original-path (or (getenv "PATH") ""))
(let* ((original-path (or (getenv "PATH") ""))
(python-shell-virtualenv-path
(directory-file-name user-emacs-directory))
(process-environment
......
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