run-tests: fix python executable detection and copy on Windows
[ original upstream message ]
--- 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: