OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Dart project authors. All rights reserved. | 2 # Copyright 2016 The Dart project 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 # This script downloads the latest dev SDK from | 6 # This script downloads the latest dev SDK from |
7 # http://gsdview.appspot.com/dart-archive/channels/dev/raw/latest/sdk/ | 7 # http://gsdview.appspot.com/dart-archive/channels/dev/raw/latest/sdk/ |
8 # into tools/sdks/$HOST_OS/. It is intended to be invoked from Jiri hooks in | 8 # into tools/sdks/$HOST_OS/. It is intended to be invoked from Jiri hooks in |
9 # a Fuchsia checkout. | 9 # a Fuchsia checkout. |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 with open(local_sha_path, 'r') as fp: | 65 with open(local_sha_path, 'r') as fp: |
66 local_sha = fp.read() | 66 local_sha = fp.read() |
67 | 67 |
68 remote_sha = '' | 68 remote_sha = '' |
69 urllib.urlretrieve(sha_url, remote_sha_path) | 69 urllib.urlretrieve(sha_url, remote_sha_path) |
70 with open(remote_sha_path, 'r') as fp: | 70 with open(remote_sha_path, 'r') as fp: |
71 remote_sha = fp.read() | 71 remote_sha = fp.read() |
72 os.remove(remote_sha_path) | 72 os.remove(remote_sha_path) |
73 | 73 |
74 if local_sha == '' or local_sha != remote_sha: | 74 if local_sha == '' or local_sha != remote_sha: |
75 with open(local_sha_path, 'w') as fp: | |
76 fp.write(remote_sha) | |
77 print 'Downloading prebuilt Dart SDK from: ' + zip_url | 75 print 'Downloading prebuilt Dart SDK from: ' + zip_url |
78 urllib.urlretrieve(zip_url, zip_path) | 76 urllib.urlretrieve(zip_url, zip_path) |
79 with zipfile.ZipFile(zip_path, 'r') as zf: | 77 with zipfile.ZipFile(zip_path, 'r') as zf: |
80 for info in zf.infolist(): | 78 for info in zf.infolist(): |
81 extract_file(zf, info, sdk_path) | 79 extract_file(zf, info, sdk_path) |
| 80 with open(local_sha_path, 'w') as fp: |
| 81 fp.write(remote_sha) |
82 | 82 |
83 if __name__ == '__main__': | 83 if __name__ == '__main__': |
84 sys.exit(main(sys.argv)) | 84 sys.exit(main(sys.argv)) |
OLD | NEW |