| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 # Script to create snapshot files. | 7 # Script to create snapshot files. |
| 8 | 8 |
| 9 import getopt | 9 import getopt |
| 10 import optparse | 10 import optparse |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 # Construct the path to the dart binary. | 90 # Construct the path to the dart binary. |
| 91 snapshot_argument = ''.join([ "--snapshot=", options.output_bin ]) | 91 snapshot_argument = ''.join([ "--snapshot=", options.output_bin ]) |
| 92 if not options.scripts: | 92 if not options.scripts: |
| 93 command = [ options.executable, snapshot_argument ] | 93 command = [ options.executable, snapshot_argument ] |
| 94 else: | 94 else: |
| 95 scripts = string.split(options.scripts) | 95 scripts = string.split(options.scripts) |
| 96 command = [ options.executable, snapshot_argument ] + scripts | 96 command = [ options.executable, snapshot_argument ] + scripts |
| 97 if options.verbose: | 97 if options.verbose: |
| 98 print ' '.join(command) | 98 print ' '.join(command) |
| 99 subprocess.call(command) | 99 pipe = subprocess.Popen(command, |
| 100 stdout=subprocess.PIPE, |
| 101 stderr=subprocess.PIPE) |
| 102 out, error = pipe.communicate() |
| 103 if (pipe.returncode != 0): |
| 104 print out, error |
| 105 print "Snapshot generation failed" |
| 106 return -1 |
| 100 | 107 |
| 101 if not makeFile(options.output, options.input_cc, options.output_bin): | 108 if not makeFile(options.output, options.input_cc, options.output_bin): |
| 102 return -1 | 109 return -1 |
| 103 | 110 |
| 104 return 0 | 111 return 0 |
| 105 | 112 |
| 106 if __name__ == '__main__': | 113 if __name__ == '__main__': |
| 107 sys.exit(Main()) | 114 sys.exit(Main()) |
| OLD | NEW |