changeset 14336:0cbf0d1f7939

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.
author Patrick Mezard <pmezard@gmail.com>
date Mon, 16 May 2011 21:26:50 +0200
parents 220f31030e7f
children 439ed4721a6d
files tests/run-tests.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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')