Show More
@@ -356,33 +356,35 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) | |
|
372 | 364 | try: |
|
373 |
os. |
|
|
365 | if os.readlink(mypython) == sys.executable: | |
|
366 | return | |
|
367 | os.unlink(mypython) | |
|
374 | 368 | except OSError, err: |
|
375 | # child processes may race, which is harmless | |
|
376 | if err.errno != errno.EEXIST: | |
|
369 | if err.errno != errno.ENOENT: | |
|
377 | 370 | raise |
|
371 | if findprogram(pyexename) != sys.executable: | |
|
372 | try: | |
|
373 | os.symlink(sys.executable, mypython) | |
|
374 | except OSError, err: | |
|
375 | # child processes may race, which is harmless | |
|
376 | if err.errno != errno.EEXIST: | |
|
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