Show More
@@ -41,6 +41,9 b' def find_cmd(cmd):' | |||
|
41 | 41 | from IPython.utils.process import pycmd2argv |
|
42 | 42 | argv = pycmd2argv(get_ipython_module_path('IPython.terminal.ipapp')) |
|
43 | 43 | |
|
44 | Note, The code for pycmd2argv has been removed now as it was not used | |
|
45 | anywhere. get_ipython_module_path should give us that same result. | |
|
46 | ||
|
44 | 47 | Parameters |
|
45 | 48 | ---------- |
|
46 | 49 | cmd : str |
@@ -52,41 +55,6 b' def find_cmd(cmd):' | |||
|
52 | 55 | return path |
|
53 | 56 | |
|
54 | 57 | |
|
55 | def is_cmd_found(cmd): | |
|
56 | """Check whether executable `cmd` exists or not and return a bool.""" | |
|
57 | try: | |
|
58 | find_cmd(cmd) | |
|
59 | return True | |
|
60 | except FindCmdError: | |
|
61 | return False | |
|
62 | ||
|
63 | ||
|
64 | def pycmd2argv(cmd): | |
|
65 | r"""Take the path of a python command and return a list (argv-style). | |
|
66 | ||
|
67 | This only works on Python based command line programs and will find the | |
|
68 | location of the ``python`` executable using ``sys.executable`` to make | |
|
69 | sure the right version is used. | |
|
70 | ||
|
71 | For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe, | |
|
72 | .com or .bat, and [, cmd] otherwise. | |
|
73 | ||
|
74 | Parameters | |
|
75 | ---------- | |
|
76 | cmd : string | |
|
77 | The path of the command. | |
|
78 | ||
|
79 | Returns | |
|
80 | ------- | |
|
81 | argv-style list. | |
|
82 | """ | |
|
83 | ext = os.path.splitext(cmd)[1] | |
|
84 | if ext in ['.exe', '.com', '.bat']: | |
|
85 | return [cmd] | |
|
86 | else: | |
|
87 | return [sys.executable, cmd] | |
|
88 | ||
|
89 | ||
|
90 | 58 | def abbrev_cwd(): |
|
91 | 59 | """ Return abbreviated version of cwd, e.g. d:mydir """ |
|
92 | 60 | cwd = py3compat.getcwd().replace('\\','/') |
General Comments 0
You need to be logged in to leave comments.
Login now