aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2014-11-16 10:47:14 -0300
committerFabián Ezequiel Gallina2014-11-16 10:47:14 -0300
commit6f167f95dc9dae8fc8533ee4d9a497c4f08021b2 (patch)
tree1a6369c5f85eb12ffad8a286d063eb31709d5204
parent2444ac6de86b318763f0cc8b1de5fb757cb09170 (diff)
downloademacs-6f167f95dc9dae8fc8533ee4d9a497c4f08021b2.tar.gz
emacs-6f167f95dc9dae8fc8533ee4d9a497c4f08021b2.zip
* 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.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/progmodes/python.el33
-rw-r--r--test/ChangeLog7
-rw-r--r--test/automated/python-tests.el10
4 files changed, 40 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc749c8755d..dbab5c652a4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
2
3 * progmodes/python.el (python-shell-calculate-command): Rename
4 from python-shell-parse-command. Cleanup.
5 (run-python, run-python-internal): Use it.
6 (python-shell-calculate-pythonpath): Rename from
7 python-new-pythonpath.
8 (python-shell-calculate-process-environment): Use it.
9 (python-shell-calculate-exec-path): Add comment.
10
12014-11-16 Thierry Banel <tbanelwebmin@free.fr> (tiny change) 112014-11-16 Thierry Banel <tbanelwebmin@free.fr> (tiny change)
2 12
3 * calc/calc-arith.el (math-max-list, math-min-list): Fix bug 13 * calc/calc-arith.el (math-max-list, math-min-list): Fix bug
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 7ed218c7c98..f8490254c79 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2084,19 +2084,22 @@ uniqueness for different types of configurations."
2084 (or python-shell-virtualenv-root "") 2084 (or python-shell-virtualenv-root "")
2085 (mapconcat #'identity python-shell-exec-path ""))))) 2085 (mapconcat #'identity python-shell-exec-path "")))))
2086 2086
2087(defun python-shell-parse-command () ;FIXME: why name it "parse"? 2087(defun python-shell-calculate-command ()
2088 "Calculate the string used to execute the inferior Python process." 2088 "Calculate the string used to execute the inferior Python process."
2089 ;; FIXME: process-environment doesn't seem to be used anywhere within 2089 (let ((exec-path (python-shell-calculate-exec-path)))
2090 ;; this let. 2090 ;; `exec-path' gets tweaked so that virtualenv's specific
2091 (let ((process-environment (python-shell-calculate-process-environment)) 2091 ;; `python-shell-interpreter' absolute path can be found by
2092 (exec-path (python-shell-calculate-exec-path))) 2092 ;; `executable-find'.
2093 (format "%s %s" 2093 (format "%s %s"
2094 ;; FIXME: Why executable-find?
2095 (executable-find python-shell-interpreter) 2094 (executable-find python-shell-interpreter)
2096 python-shell-interpreter-args))) 2095 python-shell-interpreter-args)))
2097 2096
2098(defun python-new-pythonpath () 2097(define-obsolete-function-alias
2099 "Calculate the new PYTHONPATH value from `python-shell-extra-pythonpaths'." 2098 'python-shell-parse-command
2099 #'python-shell-calculate-command "25.1")
2100
2101(defun python-shell-calculate-pythonpath ()
2102 "Calculate the PYTHONPATH using `python-shell-extra-pythonpaths'."
2100 (let ((pythonpath (getenv "PYTHONPATH")) 2103 (let ((pythonpath (getenv "PYTHONPATH"))
2101 (extra (mapconcat 'identity 2104 (extra (mapconcat 'identity
2102 python-shell-extra-pythonpaths 2105 python-shell-extra-pythonpaths
@@ -2114,7 +2117,7 @@ uniqueness for different types of configurations."
2114 (directory-file-name python-shell-virtualenv-root) 2117 (directory-file-name python-shell-virtualenv-root)
2115 nil))) 2118 nil)))
2116 (when python-shell-extra-pythonpaths 2119 (when python-shell-extra-pythonpaths
2117 (setenv "PYTHONPATH" (python-new-pythonpath))) 2120 (setenv "PYTHONPATH" (python-shell-calculate-pythonpath)))
2118 (if (not virtualenv) 2121 (if (not virtualenv)
2119 process-environment 2122 process-environment
2120 (setenv "PYTHONHOME" nil) 2123 (setenv "PYTHONHOME" nil)
@@ -2126,8 +2129,10 @@ uniqueness for different types of configurations."
2126 2129
2127(defun python-shell-calculate-exec-path () 2130(defun python-shell-calculate-exec-path ()
2128 "Calculate exec path given `python-shell-virtualenv-root'." 2131 "Calculate exec path given `python-shell-virtualenv-root'."
2129 (let ((path (append python-shell-exec-path 2132 (let ((path (append
2130 exec-path nil))) ;FIXME: Why nil? 2133 ;; Use nil as the tail so that the list is a full copy,
2134 ;; this is a paranoid safeguard for side-effects.
2135 python-shell-exec-path exec-path nil)))
2131 (if (not python-shell-virtualenv-root) 2136 (if (not python-shell-virtualenv-root)
2132 path 2137 path
2133 (cons (expand-file-name "bin" python-shell-virtualenv-root) 2138 (cons (expand-file-name "bin" python-shell-virtualenv-root)
@@ -2485,10 +2490,10 @@ process buffer for a list of commands.)"
2485 (interactive 2490 (interactive
2486 (if current-prefix-arg 2491 (if current-prefix-arg
2487 (list 2492 (list
2488 (read-shell-command "Run Python: " (python-shell-parse-command)) 2493 (read-shell-command "Run Python: " (python-shell-calculate-command))
2489 (y-or-n-p "Make dedicated process? ") 2494 (y-or-n-p "Make dedicated process? ")
2490 (= (prefix-numeric-value current-prefix-arg) 4)) 2495 (= (prefix-numeric-value current-prefix-arg) 4))
2491 (list (python-shell-parse-command) nil t))) 2496 (list (python-shell-calculate-command) nil t)))
2492 (python-shell-make-comint 2497 (python-shell-make-comint
2493 cmd (python-shell-get-process-name dedicated) show) 2498 cmd (python-shell-get-process-name dedicated) show)
2494 dedicated) 2499 dedicated)
@@ -2512,7 +2517,7 @@ startup."
2512 (inferior-python-mode-hook nil)) 2517 (inferior-python-mode-hook nil))
2513 (get-buffer-process 2518 (get-buffer-process
2514 (python-shell-make-comint 2519 (python-shell-make-comint
2515 (python-shell-parse-command) 2520 (python-shell-calculate-command)
2516 (python-shell-internal-get-process-name) nil t)))) 2521 (python-shell-internal-get-process-name) nil t))))
2517 2522
2518(defun python-shell-get-buffer () 2523(defun python-shell-get-buffer ()
diff --git a/test/ChangeLog b/test/ChangeLog
index a09c6f78fc7..e0e04bc262c 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,5 +1,12 @@
12014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org> 12014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
2 2
3 * automated/python-tests.el
4 (python-shell-calculate-process-environment-2): Fix test.
5 (python-shell-calculate-process-environment-1)
6 (python-shell-calculate-process-environment-3): Cleanup.
7
82014-11-16 Fabián Ezequiel Gallina <fgallina@gnu.org>
9
3 * automated/python-tests.el (python-indent-dedenters-8): New test 10 * automated/python-tests.el (python-indent-dedenters-8): New test
4 for Bug#18432. 11 for Bug#18432.
5 12
diff --git a/test/automated/python-tests.el b/test/automated/python-tests.el
index f368f995cae..e4ce5355a84 100644
--- a/test/automated/python-tests.el
+++ b/test/automated/python-tests.el
@@ -1836,8 +1836,7 @@ Using `python-shell-interpreter' and
1836 1836
1837(ert-deftest python-shell-calculate-process-environment-1 () 1837(ert-deftest python-shell-calculate-process-environment-1 ()
1838 "Test `python-shell-process-environment' modification." 1838 "Test `python-shell-process-environment' modification."
1839 (let* ((original-process-environment process-environment) 1839 (let* ((python-shell-process-environment
1840 (python-shell-process-environment
1841 '("TESTVAR1=value1" "TESTVAR2=value2")) 1840 '("TESTVAR1=value1" "TESTVAR2=value2"))
1842 (process-environment 1841 (process-environment
1843 (python-shell-calculate-process-environment))) 1842 (python-shell-calculate-process-environment)))
@@ -1846,8 +1845,8 @@ Using `python-shell-interpreter' and
1846 1845
1847(ert-deftest python-shell-calculate-process-environment-2 () 1846(ert-deftest python-shell-calculate-process-environment-2 ()
1848 "Test `python-shell-extra-pythonpaths' modification." 1847 "Test `python-shell-extra-pythonpaths' modification."
1849 (let* ((original-process-environment process-environment) 1848 (let* ((process-environment process-environment)
1850 (original-pythonpath (getenv "PYTHONPATH")) 1849 (original-pythonpath (setenv "PYTHONPATH" "path3"))
1851 (paths '("path1" "path2")) 1850 (paths '("path1" "path2"))
1852 (python-shell-extra-pythonpaths paths) 1851 (python-shell-extra-pythonpaths paths)
1853 (process-environment 1852 (process-environment
@@ -1859,8 +1858,7 @@ Using `python-shell-interpreter' and
1859 1858
1860(ert-deftest python-shell-calculate-process-environment-3 () 1859(ert-deftest python-shell-calculate-process-environment-3 ()
1861 "Test `python-shell-virtualenv-path' modification." 1860 "Test `python-shell-virtualenv-path' modification."
1862 (let* ((original-process-environment process-environment) 1861 (let* ((original-path (or (getenv "PATH") ""))
1863 (original-path (or (getenv "PATH") ""))
1864 (python-shell-virtualenv-path 1862 (python-shell-virtualenv-path
1865 (directory-file-name user-emacs-directory)) 1863 (directory-file-name user-emacs-directory))
1866 (process-environment 1864 (process-environment