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 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is | 7 # Gets or updates a DumpRenderTree (a nearly headless build of chrome). This is |
8 # used for running browser tests of client applications. | 8 # used for running browser tests of client applications. |
9 | 9 |
10 import os | 10 import os |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 # download the zip file to a temporary path, and unzip to the target location | 141 # download the zip file to a temporary path, and unzip to the target location |
142 temp_dir = tempfile.mkdtemp() | 142 temp_dir = tempfile.mkdtemp() |
143 try: | 143 try: |
144 temp_zip = temp_dir + '/drt.zip' | 144 temp_zip = temp_dir + '/drt.zip' |
145 # It's nice to show download progress | 145 # It's nice to show download progress |
146 gsutil_visible('cp', latest, temp_zip) | 146 gsutil_visible('cp', latest, temp_zip) |
147 | 147 |
148 result, out = execute_command('unzip', temp_zip, '-d', temp_dir) | 148 result, out = execute_command('unzip', temp_zip, '-d', temp_dir) |
149 if result != 0: | 149 if result != 0: |
150 raise Exception('Execution of "unzip %s -d %s" failed: %s' % | 150 raise Exception('Execution of "unzip %s -d %s" failed: %s' % |
151 (temp_zip, temp_dir, str(output))) | 151 (temp_zip, temp_dir, str(out))) |
152 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] # remove .zip | 152 unzipped_dir = temp_dir + '/' + os.path.basename(latest)[:-4] # remove .zip |
153 shutil.move(unzipped_dir, DRT_DIR) | 153 shutil.move(unzipped_dir, DRT_DIR) |
154 finally: | 154 finally: |
155 shutil.rmtree(temp_dir) | 155 shutil.rmtree(temp_dir) |
156 | 156 |
157 # create the version stamp | 157 # create the version stamp |
158 v = open(VERSION, 'w') | 158 v = open(VERSION, 'w') |
159 v.write(latest) | 159 v.write(latest) |
160 v.close() | 160 v.close() |
161 | 161 |
162 print 'Successfully downloaded to %s' % DRT_DIR | 162 print 'Successfully downloaded to %s' % DRT_DIR |
163 return 0 | 163 return 0 |
164 | 164 |
165 if __name__ == '__main__': | 165 if __name__ == '__main__': |
166 sys.exit(main()) | 166 sys.exit(main()) |
OLD | NEW |