changeset 14335:220f31030e7f

run-tests: fix python executable detection and copy on Windows
author Patrick Mezard <pmezard@gmail.com>
date Mon, 16 May 2011 21:24:14 +0200
parents 85c82ebc96a3
children 0cbf0d1f7939
files tests/run-tests.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: