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

Unified Diff: tools/download_latest_dev_sdk.py

Issue 2996093002: [Fuchsia] Better error message from SDK update script (Closed)
Patch Set: Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/download_latest_dev_sdk.py
diff --git a/tools/download_latest_dev_sdk.py b/tools/download_latest_dev_sdk.py
index 4865e103c0b9ef8eb32c55e56b78b6c33ee5fefd..4c95991082588a6f47fe94bb5a4dfd697d634077 100755
--- a/tools/download_latest_dev_sdk.py
+++ b/tools/download_latest_dev_sdk.py
@@ -34,10 +34,18 @@ def host_os_for_sdk(host_os):
# Python's zipfile doesn't preserve file permissions during extraction, so we
# have to do it manually.
def extract_file(zf, info, extract_dir):
- zf.extract( info.filename, path=extract_dir )
- out_path = os.path.join(extract_dir, info.filename)
- perm = info.external_attr >> 16L
- os.chmod(out_path, perm)
+ try:
+ zf.extract(info.filename, path=extract_dir)
+ out_path = os.path.join(extract_dir, info.filename)
+ perm = info.external_attr >> 16L
+ os.chmod(out_path, perm)
+ except IOError as err:
+ if 'dart-sdk/bin/dart' in err.filename:
+ print('Failed to extract the new Dart SDK dart binary. ' +
+ 'Kill stale instances (like the analyzer) and try the update again')
+ return False
+ raise
+ return True
def main(argv):
host_os = host_os_for_sdk(HOST_OS)
@@ -76,9 +84,11 @@ def main(argv):
urllib.urlretrieve(zip_url, zip_path)
with zipfile.ZipFile(zip_path, 'r') as zf:
for info in zf.infolist():
- extract_file(zf, info, sdk_path)
+ if not extract_file(zf, info, sdk_path):
+ return -1
with open(local_sha_path, 'w') as fp:
fp.write(remote_sha)
+ return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))
« 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