##// END OF EJS Templates
Add searching of .py files to find_cmd so Twisted's trial runner is found....
Fernando Perez -
Show More
@@ -46,15 +46,22 b' except ImportError:'
46 def find_cmd(cmd):
46 def find_cmd(cmd):
47 """Find the full path to a .bat or .exe using the win32api module."""
47 """Find the full path to a .bat or .exe using the win32api module."""
48 try:
48 try:
49 import win32api
49 from win32api import SearchPath
50 except ImportError:
50 except ImportError:
51 raise ImportError('you need to have pywin32 installed for this to work')
51 raise ImportError('you need to have pywin32 installed for this to work')
52 else:
52 else:
53 try:
53 PATH = os.environ['PATH']
54 (path, offest) = win32api.SearchPath(os.environ['PATH'],cmd + '.exe')
54 extensions = ['.exe', '.com', '.bat', '.py']
55 except:
55 path = None
56 (path, offset) = win32api.SearchPath(os.environ['PATH'],cmd + '.bat')
56 for ext in extensions:
57 return path
57 try:
58 path = SearchPath(PATH,cmd + ext)[0]
59 except:
60 pass
61 if path is None:
62 raise OSError("command %r not found" % cmd)
63 else:
64 return path
58
65
59
66
60 def get_long_path_name(path):
67 def get_long_path_name(path):
General Comments 0
You need to be logged in to leave comments. Login now