aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:03:27 -0300
committerFabián Ezequiel Gallina2012-05-17 00:03:27 -0300
commit929036b470d1a5924b70cb21b943c3050cbc8b70 (patch)
treedde8b4aa0f3afd30f59bcd30c2eea870d433069a /lisp/progmodes/python.el
parent40417cb37ad7b4d088d68773d21e8cc8d6f1a5d3 (diff)
downloademacs-929036b470d1a5924b70cb21b943c3050cbc8b70.tar.gz
emacs-929036b470d1a5924b70cb21b943c3050cbc8b70.zip
Enhancements to `python-shell-calculate-process-environment'
The `python-shell-extra-pythonpaths' variable have been introduced as simple way of adding paths to the PYTHONPATH without affecting existing values.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el23
1 files changed, 22 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 28b5eeaa33f..1c05048512a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -122,6 +122,10 @@
122 122
123;; (setq python-shell-virtualenv-path "/path/to/env/") 123;; (setq python-shell-virtualenv-path "/path/to/env/")
124 124
125;; Also the `python-shell-extra-pythonpaths' variable have been
126;; introduced as simple way of adding paths to the PYTHONPATH without
127;; affecting existing values.
128
125;; Pdb tracking: when you execute a block of code that contains some 129;; Pdb tracking: when you execute a block of code that contains some
126;; call to pdb (or ipdb) it will prompt the block of code and will 130;; call to pdb (or ipdb) it will prompt the block of code and will
127;; follow the execution of pdb marking the current line with an arrow. 131;; follow the execution of pdb marking the current line with an arrow.
@@ -1146,6 +1150,14 @@ the default `process-environment'."
1146 :group 'python 1150 :group 'python
1147 :safe 'listp) 1151 :safe 'listp)
1148 1152
1153(defcustom python-shell-extra-pythonpaths nil
1154 "List of extra pythonpaths for Python shell.
1155The values of this variable are added to the existing value of
1156PYTHONPATH in the `process-environment' variable."
1157 :type '(repeat string)
1158 :group 'python
1159 :safe 'listp)
1160
1149(defcustom python-shell-exec-path nil 1161(defcustom python-shell-exec-path nil
1150 "List of path to search for binaries. 1162 "List of path to search for binaries.
1151This variable follows the same rules as `exec-path' since it 1163This variable follows the same rules as `exec-path' since it
@@ -1237,11 +1249,20 @@ uniqueness for different types of configurations."
1237 (virtualenv (if python-shell-virtualenv-path 1249 (virtualenv (if python-shell-virtualenv-path
1238 (directory-file-name python-shell-virtualenv-path) 1250 (directory-file-name python-shell-virtualenv-path)
1239 nil))) 1251 nil)))
1252 (when python-shell-extra-pythonpaths
1253 (setenv "PYTHONPATH"
1254 (format "%s%s%s"
1255 (mapconcat 'identity
1256 python-shell-extra-pythonpaths
1257 path-separator)
1258 path-separator
1259 (or (getenv "PYTHONPATH") ""))))
1240 (if (not virtualenv) 1260 (if (not virtualenv)
1241 process-environment 1261 process-environment
1242 (setenv "PYTHONHOME" nil) 1262 (setenv "PYTHONHOME" nil)
1243 (setenv "PATH" (format "%s/bin%s%s" 1263 (setenv "PATH" (format "%s/bin%s%s"
1244 virtualenv path-separator (getenv "PATH"))) 1264 virtualenv path-separator
1265 (or (getenv "PATH") "")))
1245 (setenv "VIRTUAL_ENV" virtualenv)) 1266 (setenv "VIRTUAL_ENV" virtualenv))
1246 process-environment)) 1267 process-environment))
1247 1268