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 |
11 import os | 11 import os |
12 import sys | 12 import sys |
13 import zipfile | 13 import zipfile |
14 import urllib | 14 import urllib |
15 import utils | 15 import utils |
16 | 16 |
17 HOST_OS = utils.GuessOS() | 17 HOST_OS = utils.GuessOS() |
18 HOST_ARCH = utils.GuessArchitecture() | 18 HOST_ARCH = utils.GuessArchitecture() |
19 SCRIPT_DIR = os.path.dirname(sys.argv[0]) | 19 SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
20 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) | 20 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
21 | 21 |
22 BASE_URL = 'http://gsdview.appspot.com/dart-archive/channels/dev/raw/latest/sdk' | 22 DART_VERSION = '1.25.0-dev.7.0' |
| 23 BASE_URL = 'http://gsdview.appspot.com/dart-archive/channels/dev/raw/' + DART_VE
RSION +'/sdk' |
23 | 24 |
24 def host_os_for_sdk(host_os): | 25 def host_os_for_sdk(host_os): |
25 if host_os.startswith('macos'): | 26 if host_os.startswith('macos'): |
26 return 'mac' | 27 return 'mac' |
27 if host_os.startswith('win'): | 28 if host_os.startswith('win'): |
28 return 'windows' | 29 return 'windows' |
29 return host_os | 30 return host_os |
30 | 31 |
31 # Python's zipfile doesn't preserve file permissions during extraction, so we | 32 # Python's zipfile doesn't preserve file permissions during extraction, so we |
32 # have to do it manually. | 33 # have to do it manually. |
(...skipping 29 matching lines...) Expand all Loading... |
62 with open(local_sha_path, 'w') as fp: | 63 with open(local_sha_path, 'w') as fp: |
63 fp.write(remote_sha) | 64 fp.write(remote_sha) |
64 print 'Downloading prebuilt Dart SDK from: ' + zip_url | 65 print 'Downloading prebuilt Dart SDK from: ' + zip_url |
65 urllib.urlretrieve(zip_url, zip_path) | 66 urllib.urlretrieve(zip_url, zip_path) |
66 with zipfile.ZipFile(zip_path, 'r') as zf: | 67 with zipfile.ZipFile(zip_path, 'r') as zf: |
67 for info in zf.infolist(): | 68 for info in zf.infolist(): |
68 extract_file(zf, info, sdk_path) | 69 extract_file(zf, info, sdk_path) |
69 | 70 |
70 if __name__ == '__main__': | 71 if __name__ == '__main__': |
71 sys.exit(main(sys.argv)) | 72 sys.exit(main(sys.argv)) |
OLD | NEW |