Show More
@@ -30,7 +30,7 b' from IPython.core.magic import (' | |||||
30 | from IPython.lib.backgroundjobs import BackgroundJobManager |
|
30 | from IPython.lib.backgroundjobs import BackgroundJobManager | |
31 | from IPython.testing.skipdoctest import skip_doctest |
|
31 | from IPython.testing.skipdoctest import skip_doctest | |
32 | from IPython.utils import py3compat |
|
32 | from IPython.utils import py3compat | |
33 |
from IPython.utils.process import |
|
33 | from IPython.utils.process import arg_split | |
34 | from IPython.utils.traitlets import List, Dict |
|
34 | from IPython.utils.traitlets import List, Dict | |
35 |
|
35 | |||
36 | #----------------------------------------------------------------------------- |
|
36 | #----------------------------------------------------------------------------- | |
@@ -90,36 +90,23 b' class ScriptMagics(Magics, Configurable):' | |||||
90 | """, |
|
90 | """, | |
91 | ) |
|
91 | ) | |
92 | def _script_magics_default(self): |
|
92 | def _script_magics_default(self): | |
93 |
"""default to a common list of programs |
|
93 | """default to a common list of programs""" | |
94 |
|
94 | |||
95 |
defaults = [ |
|
95 | defaults = [ | |
96 | to_try = [] |
|
|||
97 | if os.name == 'nt': |
|
|||
98 | defaults.append('cmd') |
|
|||
99 | to_try.append('powershell') |
|
|||
100 | to_try.extend([ |
|
|||
101 | 'sh', |
|
96 | 'sh', | |
102 | 'bash', |
|
97 | 'bash', | |
103 | 'perl', |
|
98 | 'perl', | |
104 | 'ruby', |
|
99 | 'ruby', | |
|
100 | 'python', | |||
105 | 'python3', |
|
101 | 'python3', | |
106 | 'pypy', |
|
102 | 'pypy', | |
|
103 | ] | |||
|
104 | if os.name == 'nt': | |||
|
105 | defaults.extend([ | |||
|
106 | 'cmd', | |||
|
107 | 'powershell', | |||
107 | ]) |
|
108 | ]) | |
108 |
|
109 | |||
109 | for cmd in to_try: |
|
|||
110 | if cmd in self.script_paths: |
|
|||
111 | defaults.append(cmd) |
|
|||
112 | else: |
|
|||
113 | try: |
|
|||
114 | find_cmd(cmd) |
|
|||
115 | except FindCmdError: |
|
|||
116 | # command not found, ignore it |
|
|||
117 | pass |
|
|||
118 | except ImportError: |
|
|||
119 | # Windows without pywin32, find_cmd doesn't work |
|
|||
120 | pass |
|
|||
121 | else: |
|
|||
122 | defaults.append(cmd) |
|
|||
123 | return defaults |
|
110 | return defaults | |
124 |
|
111 | |||
125 | script_paths = Dict(config=True, |
|
112 | script_paths = Dict(config=True, |
General Comments 0
You need to be logged in to leave comments.
Login now