Skip to content

Commit 8a04efa

Browse files
committed
Remove unused _find_cmd
It was replaced with shutil/py3compat.which in f42c9ed
1 parent 794a020 commit 8a04efa

File tree

3 files changed

+0
-37
lines changed

3 files changed

+0
-37
lines changed

IPython/utils/_process_cli.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@
2222
from IPython.utils import py3compat
2323
from ._process_common import arg_split
2424

25-
def _find_cmd(cmd):
26-
"""Find the full path to a command using which."""
27-
paths = System.Environment.GetEnvironmentVariable("PATH").Split(os.pathsep)
28-
for path in paths:
29-
filename = os.path.join(path, cmd)
30-
if System.IO.File.Exists(filename):
31-
return py3compat.decode(filename)
32-
raise OSError("command %r not found" % cmd)
3325

3426
def system(cmd):
3527
"""

IPython/utils/_process_posix.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,6 @@
3131
# Function definitions
3232
#-----------------------------------------------------------------------------
3333

34-
def _find_cmd(cmd):
35-
"""Find the full path to a command using which."""
36-
37-
path = sp.Popen(['/usr/bin/env', 'which', cmd],
38-
stdout=sp.PIPE, stderr=sp.PIPE).communicate()[0]
39-
return py3compat.decode(path)
40-
41-
4234
class ProcessHandler(object):
4335
"""Execute subprocesses under the control of pexpect.
4436
"""

IPython/utils/_process_win32.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,6 @@ def __exit__(self, exc_type, exc_value, traceback):
7171
os.chdir(self.path)
7272

7373

74-
def _find_cmd(cmd):
75-
"""Find the full path to a .bat or .exe using the win32api module."""
76-
try:
77-
from win32api import SearchPath
78-
except ImportError as e:
79-
raise ImportError('you need to have pywin32 installed for this to work') from e
80-
else:
81-
PATH = os.environ['PATH']
82-
extensions = ['.exe', '.com', '.bat', '.py']
83-
path = None
84-
for ext in extensions:
85-
try:
86-
path = SearchPath(PATH, cmd, ext)[0]
87-
except:
88-
pass
89-
if path is None:
90-
raise OSError("command %r not found" % cmd)
91-
else:
92-
return path
93-
94-
9574
def _system_body(p):
9675
"""Callback for _system."""
9776
enc = DEFAULT_ENCODING

0 commit comments

Comments
 (0)