| OLD | NEW |
| 1 # Copyright 2011 Google Inc. All Rights Reserved. | 1 # Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | 2 |
| 3 import os | 3 import os |
| 4 import platform | 4 import platform |
| 5 import shutil | 5 import shutil |
| 6 import stat | 6 import stat |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 HOME = os.path.dirname(os.path.realpath(__file__)) | 9 HOME = os.path.dirname(os.path.realpath(__file__)) |
| 10 HOME = os.path.join(HOME, os.pardir, os.pardir) | 10 HOME = os.path.join(HOME, os.pardir, os.pardir) |
| 11 | 11 |
| 12 END_SCRIPT = ''' | 12 END_SCRIPT = ''' |
| 13 VM = '%s' | 13 VM = '%s' |
| 14 VM_FLAGS = '%s' | 14 VM_FLAGS = '%s' |
| 15 if __name__ == '__main__': | 15 if __name__ == '__main__': |
| 16 sys.exit(main(sys.argv)) | 16 sys.exit(main(sys.argv)) |
| 17 ''' | 17 ''' |
| 18 | 18 |
| 19 def main(args): | 19 def main(args): |
| 20 product_dir = args[1] | 20 product_dir = args[1] |
| 21 vm = os.path.join(product_dir, 'dart') | 21 vm = os.path.join(product_dir, 'dart') |
| 22 id = platform.system() | 22 id = platform.system() |
| 23 if id == 'Windows' or id == 'Microsoft': | 23 if id == 'Windows' or id == 'Microsoft': |
| 24 vm = vm + '.exe' | 24 vm = vm + '.exe' |
| 25 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') | 25 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') |
| 26 | 26 |
| 27 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), | 27 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), |
| 28 frog) | 28 frog) |
| 29 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog.bat'), |
| 30 frog + '.bat') |
| 29 | 31 |
| 30 if 'Release' in product_dir: | 32 if 'Release' in product_dir: |
| 31 # We want to run our tests on the VM in production mode and in | 33 # We want to run our tests on the VM in production mode and in |
| 32 # developer mode. It turns out that developer mode is really slow | 34 # developer mode. It turns out that developer mode is really slow |
| 33 # on the debug VM, so it makes sense to make the pairings: | 35 # on the debug VM, so it makes sense to make the pairings: |
| 34 # (release VM, developer mode) and (debug VM, production mode). | 36 # (release VM, developer mode) and (debug VM, production mode). |
| 35 vm_flags = '--vm_flags=--enable_asserts --enable_type_checks' | 37 vm_flags = '--vm_flags=--enable_asserts --enable_type_checks' |
| 36 else: | 38 else: |
| 37 vm_flags = '' | 39 vm_flags = '' |
| 38 | 40 |
| 39 with open(frog, 'a+') as f: | 41 with open(frog, 'a+') as f: |
| 40 f.write(END_SCRIPT % (vm, vm_flags)) | 42 f.write(END_SCRIPT % (vm, vm_flags)) |
| 41 | 43 |
| 42 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | | 44 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | |
| 43 stat.S_IRGRP | stat.S_IWUSR) | 45 stat.S_IRGRP | stat.S_IWUSR) |
| 44 return 0 | 46 return 0 |
| 45 | 47 |
| 46 | 48 |
| 47 if __name__ == '__main__': | 49 if __name__ == '__main__': |
| 48 sys.exit(main(sys.argv)) | 50 sys.exit(main(sys.argv)) |
| OLD | NEW |