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