run-tests: fix hg.bat python reference
hg.bat expects to live in pythonxx/scripts and the python interpreter
to be in pythonxx. run-tests.py file layout is a little different and
python location must be fixed.
[ original upstream message ]
--- a/tests/run-tests.py Mon May 16 21:24:14 2011 +0200
+++ b/tests/run-tests.py Mon May 16 21:26:50 2011 +0200
@@ -440,6 +440,22 @@
f.write(line + '\n')
f.close()
+ hgbat = os.path.join(BINDIR, 'hg.bat')
+ if os.path.isfile(hgbat):
+ # hg.bat expects to be put in bin/scripts while run-tests.py
+ # installation layout put it in bin/ directly. Fix it
+ f = open(hgbat, 'rb')
+ data = f.read()
+ f.close()
+ if '"%~dp0..\python" "%~dp0hg" %*' in data:
+ data = data.replace('"%~dp0..\python" "%~dp0hg" %*',
+ '"%~dp0python" "%~dp0hg" %*')
+ f = open(hgbat, 'wb')
+ f.write(data)
+ f.close()
+ else:
+ print 'WARNING: cannot fix hg.bat reference to python.exe'
+
if options.anycoverage:
custom = os.path.join(TESTDIR, 'sitecustomize.py')
target = os.path.join(PYTHONDIR, 'sitecustomize.py')