run-tests: fix python executable detection and copy on Windows
authorPatrick Mezard <pmezard@gmail.com>
Mon, 16 May 2011 21:24:14 +0200
changeset 14335 220f31030e7f
parent 14334 85c82ebc96a3
child 14336 0cbf0d1f7939
run-tests: fix python executable detection and copy on Windows
tests/run-tests.py
--- a/tests/run-tests.py	Mon May 16 13:06:48 2011 +0200
+++ b/tests/run-tests.py	Mon May 16 21:24:14 2011 +0200
@@ -316,7 +316,7 @@
     """Search PATH for a executable program"""
     for p in os.environ.get('PATH', os.defpath).split(os.pathsep):
         name = os.path.join(p, program)
-        if os.access(name, os.X_OK):
+        if os.name == 'nt' or os.access(name, os.X_OK):
             return name
     return None
 
@@ -366,12 +366,14 @@
     # some tests run python interpreter. they must use same
     # interpreter we use or bad things will happen.
     exedir, exename = os.path.split(sys.executable)
-    if exename == 'python':
-        path = findprogram('python')
+    if exename in ('python', 'python.exe'):
+        path = findprogram(exename)
         if os.path.dirname(path) == exedir:
             return
+    else:
+        exename = 'python'
     vlog('# Making python executable in test path use correct Python')
-    mypython = os.path.join(BINDIR, 'python')
+    mypython = os.path.join(BINDIR, exename)
     try:
         os.symlink(sys.executable, mypython)
     except AttributeError: