##// END OF EJS Templates
run-tests.py: fix handling of symlink to the right python...
Mads Kiilerich -
r18244:5a3c71b0 default
parent child Browse files
Show More
@@ -356,19 +356,19 b' def cleanup(options):'
356 356 def usecorrectpython():
357 357 # some tests run python interpreter. they must use same
358 358 # interpreter we use or bad things will happen.
359 exedir, exename = os.path.split(sys.executable)
360 if exename in ('python', 'python.exe'):
361 path = findprogram(exename)
362 if os.path.dirname(path) == exedir:
363 return
364 else:
365 exename = 'python'
366 if sys.platform == 'win32':
367 exename = 'python.exe'
359 pyexename = sys.platform == 'win32' and 'python.exe' or 'python'
368 360 if getattr(os, 'symlink', None):
369 361 vlog("# Making python executable in test path a symlink to '%s'" %
370 362 sys.executable)
371 mypython = os.path.join(BINDIR, exename)
363 mypython = os.path.join(BINDIR, pyexename)
364 try:
365 if os.readlink(mypython) == sys.executable:
366 return
367 os.unlink(mypython)
368 except OSError, err:
369 if err.errno != errno.ENOENT:
370 raise
371 if findprogram(pyexename) != sys.executable:
372 372 try:
373 373 os.symlink(sys.executable, mypython)
374 374 except OSError, err:
@@ -376,13 +376,15 b' def usecorrectpython():'
376 376 if err.errno != errno.EEXIST:
377 377 raise
378 378 else:
379 vlog("# Modifying search path to find %s in '%s'" % (exename, exedir))
379 exedir, exename = os.path.split(sys.executable)
380 vlog("# Modifying search path to find %s as %s in '%s'" %
381 (exename, pyexename, exedir))
380 382 path = os.environ['PATH'].split(os.pathsep)
381 383 while exedir in path:
382 384 path.remove(exedir)
383 385 os.environ['PATH'] = os.pathsep.join([exedir] + path)
384 if not findprogram(exename):
385 print "WARNING: Cannot find %s in search path" % exename
386 if not findprogram(pyexename):
387 print "WARNING: Cannot find %s in search path" % pyexename
386 388
387 389 def installhg(options):
388 390 vlog("# Performing temporary installation of HG")
General Comments 0
You need to be logged in to leave comments. Login now