Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: build/download_sdk_extras.py

Issue 949813002: download_sdk_extras: Catch the correct error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Script to download sdk/extras packages on the bots from google storage. 6 """Script to download sdk/extras packages on the bots from google storage.
7 7
8 The script expects arguments that specify zips file in the google storage 8 The script expects arguments that specify zips file in the google storage
9 bucket named: <dir in SDK extras>_<package name>_<version>.zip. The file will 9 bucket named: <dir in SDK extras>_<package name>_<version>.zip. The file will
10 be extracted in the android_tools/sdk/extras directory on the test bots. This 10 be extracted in the android_tools/sdk/extras directory on the test bots. This
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 # Update the android_sdk_extras.json file to update downloaded packages. 52 # Update the android_sdk_extras.json file to update downloaded packages.
53 with open(SDK_EXTRAS_JSON_FILE) as json_file: 53 with open(SDK_EXTRAS_JSON_FILE) as json_file:
54 packages = json.load(json_file) 54 packages = json.load(json_file)
55 for package in packages: 55 for package in packages:
56 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip']) 56 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip'])
57 if not os.path.exists(local_zip): 57 if not os.path.exists(local_zip):
58 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip']) 58 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip'])
59 try: 59 try:
60 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7', 60 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7',
61 'cp', package_zip, local_zip]) 61 'cp', package_zip, local_zip])
62 except AccessDeniedException: 62 except subprocess.CalledProcessError:
63 print ('WARNING: Bot does not have permission to download SDK packages.' 63 print ('WARNING: Failed to download SDK packages. If this bot compiles '
navabi 2015/02/23 17:40:49 We still need to catch the AccessDeniedExceptions
dnj 2015/02/23 17:43:17 We can't catch AccessDeniedException. gsutil, whic
scottmg 2015/02/23 18:19:44 Is is useful to print the content of the exception
64 ' If this bot compiles for Android, it may have errors.') 64 'for Android, it may have errors.')
65 return 0 65 return 0
66 # Always clean dir and extract zip to ensure correct contents. 66 # Always clean dir and extract zip to ensure correct contents.
67 clean_and_extract(package['dir_name'], package['package'], package['zip']) 67 clean_and_extract(package['dir_name'], package['package'], package['zip'])
68 68
69 69
70 if __name__ == '__main__': 70 if __name__ == '__main__':
71 sys.exit(main()) 71 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698