| OLD | NEW |
| 1 # Copyright 2012 Google Inc. All Rights Reserved. | 1 # Copyright 2012 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 BUILDER_NAME = os.environ.get('BUILDBOT_BUILDERNAME') | 11 BUILDER_NAME = os.environ.get('BUILDBOT_BUILDERNAME') |
| 12 | 12 |
| 13 END_SCRIPT = ''' | 13 END_SCRIPT = ''' |
| 14 VM = '%s' | 14 VM = '%s' |
| 15 D8 = '%s' | 15 D8 = '%s' |
| 16 HOME = '%s' |
| 16 if __name__ == '__main__': | 17 if __name__ == '__main__': |
| 17 sys.exit(main(sys.argv)) | 18 sys.exit(main(sys.argv)) |
| 18 ''' | 19 ''' |
| 19 | 20 |
| 20 def main(args): | 21 def main(args): |
| 21 product_dir = args[1] | 22 product_dir = args[1] |
| 22 vm = os.path.join(product_dir, 'dart') | 23 vm = os.path.join(product_dir, 'dart') |
| 23 d8 = os.path.join(product_dir, 'd8') | 24 d8 = os.path.join(product_dir, 'd8') |
| 24 id = platform.system() | 25 id = platform.system() |
| 25 if id == 'Windows' or id == 'Microsoft': | 26 if id == 'Windows' or id == 'Microsoft': |
| 26 vm = vm + '.exe' | 27 vm = vm + '.exe' |
| 27 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') | 28 frog = os.path.join(product_dir, 'frog', 'bin', 'frog') |
| 28 | 29 |
| 29 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), | 30 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog_wrapper.py'), |
| 30 frog) | 31 frog) |
| 31 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog.bat'), | 32 shutil.copy(os.path.join(HOME, 'scripts', 'bootstrap', 'frog.bat'), |
| 32 frog + '.bat') | 33 frog + '.bat') |
| 33 | 34 |
| 34 with open(frog, 'a+') as f: | 35 with open(frog, 'a+') as f: |
| 35 f.write(END_SCRIPT % (vm, d8)) | 36 f.write(END_SCRIPT % (vm, d8, HOME)) |
| 36 | 37 |
| 37 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | | 38 os.chmod(frog, stat.S_IXUSR | stat.S_IXGRP | stat.S_IRUSR | |
| 38 stat.S_IRGRP | stat.S_IWUSR) | 39 stat.S_IRGRP | stat.S_IWUSR) |
| 39 return 0 | 40 return 0 |
| 40 | 41 |
| 41 | 42 |
| 42 if __name__ == '__main__': | 43 if __name__ == '__main__': |
| 43 sys.exit(main(sys.argv)) | 44 sys.exit(main(sys.argv)) |
| OLD | NEW |