| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 | 2 |
| 3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 """Download archived multivm or dartium builds. | 7 """Download archived multivm or dartium builds. |
| 8 | 8 |
| 9 Usage: download_multivm.py revision target_directory | 9 Usage: download_multivm.py revision target_directory |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 import imp | 12 import imp |
| 13 import os | 13 import os |
| 14 import platform | 14 import platform |
| 15 import shutil | 15 import shutil |
| 16 import subprocess | 16 import subprocess |
| 17 import sys | 17 import sys |
| 18 import tempfile | 18 import tempfile |
| 19 | 19 |
| 20 # We are in [checkout dir]/src/dart/tools/dartium in a dartium/multivm checkout | 20 # We are in [checkout dir]/src/dart/tools/dartium in a dartium/multivm checkout |
| 21 TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 21 TOOLS_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 22 SRC_DIR = os.path.dirname(os.path.dirname(TOOLS_DIR)) | 22 SRC_DIR = os.path.dirname(os.path.dirname(TOOLS_DIR)) |
| 23 GS_BUCKET = 'gs://dartium-archive' | 23 GS_BUCKET = 'gs://dartium-archive' |
| 24 if platform.system() == 'Windows': | 24 if platform.system() == 'Windows': |
| 25 GSUTIL = 'e:\\b\\build\\scripts\\slave\\gsutil.bat' | 25 GSUTIL = 'e:\\b\\build\\scripts\\slave\\gsutil.bat' |
| 26 if not os.path.exists(GSUTIL): |
| 27 GSUTIL = 'c:\\b\\build\\scripts\\slave\\gsutil.bat' |
| 26 else: | 28 else: |
| 27 GSUTIL = '/b/build/scripts/slave/gsutil' | 29 GSUTIL = '/b/build/scripts/slave/gsutil' |
| 28 if not os.path.exists(GSUTIL): | 30 if not os.path.exists(GSUTIL): |
| 29 GSUTIL = 'gsutil' | 31 GSUTIL = 'gsutil' |
| 30 | 32 |
| 31 class TempDir(object): | 33 class TempDir(object): |
| 32 def __init__(self, prefix=''): | 34 def __init__(self, prefix=''): |
| 33 self._temp_dir = None | 35 self._temp_dir = None |
| 34 self._prefix = prefix | 36 self._prefix = prefix |
| 35 | 37 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 64 ExecuteCommand([executable, 'x', '-aoa', '-o' + temp_dir, zip_file]) | 66 ExecuteCommand([executable, 'x', '-aoa', '-o' + temp_dir, zip_file]) |
| 65 else: | 67 else: |
| 66 ExecuteCommand(['unzip', zip_file, '-d', temp_dir]) | 68 ExecuteCommand(['unzip', zip_file, '-d', temp_dir]) |
| 67 | 69 |
| 68 if os.path.exists(target_dir): | 70 if os.path.exists(target_dir): |
| 69 shutil.rmtree(target_dir) | 71 shutil.rmtree(target_dir) |
| 70 shutil.move(unzip_dir, target_dir) | 72 shutil.move(unzip_dir, target_dir) |
| 71 | 73 |
| 72 if __name__ == '__main__': | 74 if __name__ == '__main__': |
| 73 sys.exit(main()) | 75 sys.exit(main()) |
| OLD | NEW |