configwizard: invoke hg.exe on Windows (
bug 1280815); r?smacleod
Even if you run hg.exe, sys.argv[0] is reported as "hg." When you
try to execute a "hg" process (a Python script with a shebang),
this fails because it isn't a Windows executable. Work around this
by invoking "hg.exe."
MozReview-Commit-ID: 3DkhmUCX8u1
--- a/hgext/configwizard/__init__.py
+++ b/hgext/configwizard/__init__.py
@@ -510,17 +510,25 @@ def _enableext(cw, name, value):
def _promptvctextension(ui, cw, ext, msg):
if ui.hasconfig('extensions', ext):
return
ext_path = _vctextpath(ext)
# Verify the extension loads before prompting to enable it. This is
# done out of paranoia.
- result = subprocess.check_output([sys.argv[0],
+
+ # Even if we launch hg.exe, sys.argv[0] is "hg" on Windows. Since "hg" isn't
+ # a Windows application, we can't simply run it. So change to the ".exe"
+ # variant if necessary.
+ hg = sys.argv[0]
+ if sys.platform in ('win32', 'msys') and hg.endswith('hg'):
+ hg += '.exe'
+
+ result = subprocess.check_output([hg,
'--config', 'extensions.testmodule=%s' % ext_path,
'--config', 'ui.traceback=true'],
stderr=subprocess.STDOUT)
if 'Traceback' in result:
return
if uipromptchoice(ui, '%s (Yn) $$ &Yes $$ &No' % msg):
return