| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """This module contains functions for fetching and extracting archived builds. | 5 """This module contains functions for fetching and extracting archived builds. |
| 6 | 6 |
| 7 The builds may be stored in different places by different types of builders; | 7 The builds may be stored in different places by different types of builders; |
| 8 for example, builders on tryserver.chromium.perf stores builds in one place, | 8 for example, builders on tryserver.chromium.perf stores builds in one place, |
| 9 while builders on chromium.linux store builds in another. | 9 while builders on chromium.linux store builds in another. |
| 10 | 10 |
| 11 This module can be either imported or run as a stand-alone script to download | 11 This module can be either imported or run as a stand-alone script to download |
| 12 and extract a build. | 12 and extract a build. |
| 13 | 13 |
| 14 Usage: fetch_build.py <type> <revision> <output_dir> [options] | 14 Usage: fetch_build.py <type> <revision> <output_dir> [options] |
| 15 """ | 15 """ |
| 16 | 16 |
| 17 import argparse | 17 import argparse |
| 18 import errno | 18 import errno |
| 19 import logging | 19 import logging |
| 20 import os | 20 import os |
| 21 import shutil | 21 import shutil |
| 22 import sys | 22 import sys |
| 23 import zipfile | 23 import zipfile |
| 24 | 24 |
| 25 _CATAPULT_BASE_PATH = os.path.abspath(os.path.join( | 25 _CATAPULT_BASE_PATH = os.path.abspath(os.path.join( |
| 26 __file__, '..', '..', 'third_party', 'catapult', 'catapult_base')) | 26 os.path.dirname(__file__), '..', '..', 'third_party', 'catapult', |
| 27 'catapult_base')) |
| 27 if _CATAPULT_BASE_PATH not in sys.path: | 28 if _CATAPULT_BASE_PATH not in sys.path: |
| 28 sys.path.insert(1, _CATAPULT_BASE_PATH) | 29 sys.path.insert(1, _CATAPULT_BASE_PATH) |
| 29 from catapult_base import cloud_storage | 30 from catapult_base import cloud_storage |
| 30 | 31 |
| 31 import bisect_utils | 32 import bisect_utils |
| 32 | 33 |
| 33 # Possible builder types. | 34 # Possible builder types. |
| 34 PERF_BUILDER = 'perf' | 35 PERF_BUILDER = 'perf' |
| 35 FULL_BUILDER = 'full' | 36 FULL_BUILDER = 'full' |
| 36 ANDROID_CHROME_PERF_BUILDER = 'android-chrome-perf' | 37 ANDROID_CHROME_PERF_BUILDER = 'android-chrome-perf' |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 print 'Build is not available.' | 505 print 'Build is not available.' |
| 505 return 1 | 506 return 1 |
| 506 | 507 |
| 507 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) | 508 FetchFromCloudStorage(bucket_name, remote_path, args.output_dir) |
| 508 print 'Build has been downloaded to and extracted in %s.' % args.output_dir | 509 print 'Build has been downloaded to and extracted in %s.' % args.output_dir |
| 509 return 0 | 510 return 0 |
| 510 | 511 |
| 511 | 512 |
| 512 if __name__ == '__main__': | 513 if __name__ == '__main__': |
| 513 sys.exit(Main(sys.argv)) | 514 sys.exit(Main(sys.argv)) |
| OLD | NEW |