438 f = open(os.path.join(BINDIR, 'hg'), 'w') |
438 f = open(os.path.join(BINDIR, 'hg'), 'w') |
439 for line in lines: |
439 for line in lines: |
440 f.write(line + '\n') |
440 f.write(line + '\n') |
441 f.close() |
441 f.close() |
442 |
442 |
|
443 hgbat = os.path.join(BINDIR, 'hg.bat') |
|
444 if os.path.isfile(hgbat): |
|
445 # hg.bat expects to be put in bin/scripts while run-tests.py |
|
446 # installation layout put it in bin/ directly. Fix it |
|
447 f = open(hgbat, 'rb') |
|
448 data = f.read() |
|
449 f.close() |
|
450 if '"%~dp0..\python" "%~dp0hg" %*' in data: |
|
451 data = data.replace('"%~dp0..\python" "%~dp0hg" %*', |
|
452 '"%~dp0python" "%~dp0hg" %*') |
|
453 f = open(hgbat, 'wb') |
|
454 f.write(data) |
|
455 f.close() |
|
456 else: |
|
457 print 'WARNING: cannot fix hg.bat reference to python.exe' |
|
458 |
443 if options.anycoverage: |
459 if options.anycoverage: |
444 custom = os.path.join(TESTDIR, 'sitecustomize.py') |
460 custom = os.path.join(TESTDIR, 'sitecustomize.py') |
445 target = os.path.join(PYTHONDIR, 'sitecustomize.py') |
461 target = os.path.join(PYTHONDIR, 'sitecustomize.py') |
446 vlog('# Installing coverage trigger to %s' % target) |
462 vlog('# Installing coverage trigger to %s' % target) |
447 shutil.copyfile(custom, target) |
463 shutil.copyfile(custom, target) |