Show More
@@ -29,7 +29,7 b' class MissingTool(Exception):' | |||
|
29 | 29 | |
|
30 | 30 | def checktool(exe, name=None, abort=True): |
|
31 | 31 | name = name or exe |
|
32 |
if not util.find |
|
|
32 | if not util.findexe(exe): | |
|
33 | 33 | exc = abort and util.Abort or MissingTool |
|
34 | 34 | raise exc(_('cannot find required "%s" tool') % name) |
|
35 | 35 |
@@ -36,10 +36,10 b' class gnuarch_source(converter_source, c' | |||
|
36 | 36 | |
|
37 | 37 | # Could use checktool, but we want to check for baz or tla. |
|
38 | 38 | self.execmd = None |
|
39 |
if util.find |
|
|
39 | if util.findexe('baz'): | |
|
40 | 40 | self.execmd = 'baz' |
|
41 | 41 | else: |
|
42 |
if util.find |
|
|
42 | if util.findexe('tla'): | |
|
43 | 43 | self.execmd = 'tla' |
|
44 | 44 | else: |
|
45 | 45 | raise util.Abort(_('cannot find a GNU Arch tool')) |
@@ -1648,7 +1648,7 b' def debuginstall(ui):' | |||
|
1648 | 1648 | # editor |
|
1649 | 1649 | ui.status(_("Checking commit editor...\n")) |
|
1650 | 1650 | editor = ui.geteditor() |
|
1651 |
cmdpath = util.find |
|
|
1651 | cmdpath = util.findexe(editor) or util.findexe(editor.split()[0]) | |
|
1652 | 1652 | if not cmdpath: |
|
1653 | 1653 | if editor == 'vi': |
|
1654 | 1654 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
@@ -31,10 +31,10 b' def _findtool(ui, tool):' | |||
|
31 | 31 | continue |
|
32 | 32 | p = util.lookupreg(k, _toolstr(ui, tool, "regname")) |
|
33 | 33 | if p: |
|
34 |
p = util.find |
|
|
34 | p = util.findexe(p + _toolstr(ui, tool, "regappend")) | |
|
35 | 35 | if p: |
|
36 | 36 | return p |
|
37 |
return util.find |
|
|
37 | return util.findexe(_toolstr(ui, tool, "executable", tool)) | |
|
38 | 38 | |
|
39 | 39 | def _picktool(repo, ui, path, binary, symlink): |
|
40 | 40 | def check(tool, pat, symlink, binary): |
@@ -112,7 +112,7 b' def validateconfig(ui):' | |||
|
112 | 112 | raise util.Abort(_('smtp specified as email transport, ' |
|
113 | 113 | 'but no smtp host configured')) |
|
114 | 114 | else: |
|
115 |
if not util.find |
|
|
115 | if not util.findexe(method): | |
|
116 | 116 | raise util.Abort(_('%r specified as email transport, ' |
|
117 | 117 | 'but not in PATH') % method) |
|
118 | 118 |
@@ -221,7 +221,7 b' def isowner(st):' | |||
|
221 | 221 | """Return True if the stat object st is from the current user.""" |
|
222 | 222 | return st.st_uid == os.getuid() |
|
223 | 223 | |
|
224 |
def find |
|
|
224 | def findexe(command): | |
|
225 | 225 | '''Find executable for command searching like which does. |
|
226 | 226 | If command is a basename then PATH is searched for command. |
|
227 | 227 | PATH isn't searched if command is an absolute or relative path. |
@@ -319,7 +319,7 b' def hgexecutable():' | |||
|
319 | 319 | elif mainfrozen(): |
|
320 | 320 | _sethgexecutable(sys.executable) |
|
321 | 321 | else: |
|
322 |
exe = find |
|
|
322 | exe = findexe('hg') or os.path.basename(sys.argv[0]) | |
|
323 | 323 | _sethgexecutable(exe) |
|
324 | 324 | return _hgexecutable |
|
325 | 325 |
@@ -163,7 +163,7 b' def explainexit(code):' | |||
|
163 | 163 | def isowner(st): |
|
164 | 164 | return True |
|
165 | 165 | |
|
166 |
def find |
|
|
166 | def findexe(command): | |
|
167 | 167 | '''Find executable for command searching like cmd.exe does. |
|
168 | 168 | If command is a basename then PATH is searched for command. |
|
169 | 169 | PATH isn't searched if command is an absolute or relative path. |
General Comments 0
You need to be logged in to leave comments.
Login now