run-tests: fix python executable detection and copy on Windows stable
authorPatrick Mezard <pmezard@gmail.com>
Mon, 16 May 2011 21:24:14 +0200
branchstable
changeset 942 92325072c4d4
parent 940 4bd06014631e
child 943 1f7fd6db1e17
run-tests: fix python executable detection and copy on Windows [ original upstream message ]
tests/run-tests.py
--- a/tests/run-tests.py	Fri May 13 14:58:24 2011 -0500
+++ 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: