##// END OF EJS Templates
moved get_ipython_cmd into separate function
Paul Ivanov -
Show More
@@ -156,6 +156,28 b' def default_config():'
156 return config
156 return config
157
157
158
158
159 def get_ipython_cmd(as_string=False):
160 """
161 Return appropriate IPython command line name. By default, this will return
162 a list that can be used with subprocess.Popen, for example, but passing
163 `as_string=True` allows for returning the IPython command as a string.
164
165 Parameters
166 ----------
167 as_string: bool
168 Flag to allow to return the command as a string.
169 """
170 # FIXME: remove workaround for 2.6 support
171 if sys.version_info[:2] > (2,6):
172 ipython_cmd = [sys.executable, "-m", "IPython"]
173 else:
174 ipython_cmd = ["ipython"]
175
176 if as_string:
177 ipython_cmd = " ".join(ipython_cmd)
178
179 return ipython_cmd
180
159 def ipexec(fname, options=None):
181 def ipexec(fname, options=None):
160 """Utility to call 'ipython filename'.
182 """Utility to call 'ipython filename'.
161
183
@@ -189,11 +211,7 b' def ipexec(fname, options=None):'
189 _ip = get_ipython()
211 _ip = get_ipython()
190 test_dir = os.path.dirname(__file__)
212 test_dir = os.path.dirname(__file__)
191
213
192 # FIXME: remove workaround for 2.6 support
214 ipython_cmd = get_ipython_cmd()
193 if sys.version_info[:2] > (2,6):
194 ipython_cmd = [sys.executable, "-m", "IPython"]
195 else:
196 ipython_cmd = ["ipython"]
197 # Absolute path for filename
215 # Absolute path for filename
198 full_fname = os.path.join(test_dir, fname)
216 full_fname = os.path.join(test_dir, fname)
199 full_cmd = ipython_cmd + cmdargs + [full_fname]
217 full_cmd = ipython_cmd + cmdargs + [full_fname]
General Comments 0
You need to be logged in to leave comments. Login now