set_hgexecutable() on windows
Evan Powers
evan.powers+hgdev at gmail.com
Fri Jun 29 11:42:26 CDT 2007
The new set_hgexecutable() stuff in 0.9.4 doesn't work for me on
Windows XP; my HG environment variable always ends up set to how I
invoke Mercurial from the command line.
So, if I type "hg view" I get an error dialog from hgk saying:
couldn't execute "c:\my\cwd\hg": no such file or directory
whereas if I type "hg.exe view":
couldn't execute "c:\my\cwd\hg.exe": no such file or directory
Now, admittedly my install is unusual, so this might not apply to the
binary installer by Lee Cantey. If someone knows for certain that it
doesn't, please let me know.
I fixed my problem by adding the following monstrosity to util_win32.py:
def set_hgexecutable(path):
"""check %PATH% while considering %PATHEXT%, fall back to 'hg.exe'"""
import util
if not path:
return 'hg.exe'
for ext in os.environ['PATHEXT'].split(';'):
try:
match, i = win32api.SearchPath(None, path, ext)
except pywintypes.error:
continue
break
util._hgexecutable = match or path
Maybe requiring Mercurial.ini to specify the value of HG would be a
better approach. Anyway, take this for what it's worth.
Thanks,
- Evan
P.S. For the curious, my install is a custom bdist_wininst based one.
I still have an hg.exe, but it's just a thin wrapper that embeds
python and execfile()s %PYTHONHOME%\Scripts\hg.
More information about the Mercurial-devel
mailing list