##// END OF EJS Templates
moved get_ipython_cmd into separate function
Paul Ivanov -
Show More
@@ -156,6 +156,28 b' def default_config():'
156 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 181 def ipexec(fname, options=None):
160 182 """Utility to call 'ipython filename'.
161 183
@@ -188,12 +210,8 b' def ipexec(fname, options=None):'
188 210
189 211 _ip = get_ipython()
190 212 test_dir = os.path.dirname(__file__)
191
192 # FIXME: remove workaround for 2.6 support
193 if sys.version_info[:2] > (2,6):
194 ipython_cmd = [sys.executable, "-m", "IPython"]
195 else:
196 ipython_cmd = ["ipython"]
213
214 ipython_cmd = get_ipython_cmd()
197 215 # Absolute path for filename
198 216 full_fname = os.path.join(test_dir, fname)
199 217 full_cmd = ipython_cmd + cmdargs + [full_fname]
General Comments 0
You need to be logged in to leave comments. Login now