tests/run-tests.py
branchstable
changeset 943 1f7fd6db1e17
parent 942 92325072c4d4
child 944 37aff8ccb33e
equal deleted inserted replaced
942:92325072c4d4 943:1f7fd6db1e17
   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)