Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. | 10 be extracted in the android_tools/sdk/extras directory. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_PATH): | 41 if not os.path.exists(GSUTIL_PATH) or not os.path.exists(SDK_EXTRAS_PATH): |
| 42 # This is not a buildbot checkout. | 42 # This is not a buildbot checkout. |
| 43 return 0 | 43 return 0 |
| 44 # Update the android_sdk_extras.json file to update downloaded packages. | 44 # Update the android_sdk_extras.json file to update downloaded packages. |
| 45 with open(SDK_EXTRAS_JSON_FILE) as json_file: | 45 with open(SDK_EXTRAS_JSON_FILE) as json_file: |
| 46 packages = json.load(json_file) | 46 packages = json.load(json_file) |
| 47 for package in packages: | 47 for package in packages: |
| 48 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip']) | 48 local_zip = '%s/%s' % (SDK_EXTRAS_PATH, package['zip']) |
| 49 if not os.path.exists(local_zip): | 49 if not os.path.exists(local_zip): |
| 50 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip']) | 50 package_zip = '%s/%s' % (SDK_EXTRAS_BUCKET, package['zip']) |
| 51 subprocess.check_call([GSUTIL_PATH, '--force-version', '4.7', 'cp', | 51 try: |
| 52 package_zip, local_zip]) | 52 subprocess.check_call(['python', GSUTIL_PATH, '--force-version', '4.7', |
|
hinoka
2015/02/18 21:33:07
s/'python'/sys.executable/
navabi
2015/02/18 22:47:03
I don't think this works on windows. I would expec
| |
| 53 'cp', package_zip, local_zip]) | |
| 54 except AccessDeniedException: | |
| 55 print ('WARNING: Bot does not have permission to download SDK packages.' | |
| 56 ' If this bot compiles for Android, it may have errors.') | |
|
hshi1
2015/02/18 21:32:27
why is android_sdk_extras among the packages in th
navabi
2015/02/18 22:47:03
If possible, we should only call download_sdk_pack
Sam Clegg
2015/02/19 01:24:30
There are other scripts that do this by inspecting
| |
| 53 # Always clean dir and extract zip to ensure correct contents. | 57 # Always clean dir and extract zip to ensure correct contents. |
| 54 clean_and_extract(package['dir_name'], package['package'], package['zip']) | 58 clean_and_extract(package['dir_name'], package['package'], package['zip']) |
| 55 | 59 |
| 56 | 60 |
| 57 if __name__ == '__main__': | 61 if __name__ == '__main__': |
| 58 sys.exit(main()) | 62 sys.exit(main()) |
| OLD | NEW |