OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 """Download the very lastet version Native Client SDK. | 5 """Download the very lastet version Native Client SDK. |
6 | 6 |
7 This script downloads toolchain bz2's and expands them. | 7 This script downloads toolchain bz2's and expands them. |
8 | 8 |
9 On Windows this script also required access to the cygtar python | 9 On Windows this script also required access to the cygtar python |
10 module which gets included by the gclient DEPS, and assumes | 10 module, and assumes that cygwin is installed in /cygwin. |
11 that cygwin is installed in /cygwin. | |
12 """ | 11 """ |
13 | 12 |
14 import argparse | 13 import argparse |
15 import os | 14 import os |
16 import subprocess | 15 import subprocess |
17 import sys | 16 import sys |
18 import tarfile | 17 import tarfile |
19 import time | 18 import time |
20 | 19 |
21 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 20 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
(...skipping 12 matching lines...) Expand all Loading... |
34 if sys.version_info >= (3, 0, 0): | 33 if sys.version_info >= (3, 0, 0): |
35 sys.stderr.write('This script does not support python 3.\n') | 34 sys.stderr.write('This script does not support python 3.\n') |
36 sys.exit(1) | 35 sys.exit(1) |
37 | 36 |
38 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) | 37 SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) |
39 SRC_DIR = os.path.dirname(SCRIPT_DIR) | 38 SRC_DIR = os.path.dirname(SCRIPT_DIR) |
40 OUT_DIR = os.path.join(SRC_DIR, 'out') | 39 OUT_DIR = os.path.join(SRC_DIR, 'out') |
41 TARGET_DIR = os.path.join(OUT_DIR, 'nacl_sdk') | 40 TARGET_DIR = os.path.join(OUT_DIR, 'nacl_sdk') |
42 | 41 |
43 if sys.platform == 'win32': | 42 if sys.platform == 'win32': |
44 NACL_BUILD_DIR = os.path.join(SRC_DIR, 'native_client', 'build') | 43 import cygtar |
45 sys.path.append(NACL_BUILD_DIR) | |
46 import cygtar # pylint: disable=import-error | |
47 | 44 |
48 BOT_GSUTIL = '/b/build/scripts/slave/gsutil' | 45 BOT_GSUTIL = '/b/build/scripts/slave/gsutil' |
49 GS_URL_BASE = 'gs://nativeclient-mirror/nacl/nacl_sdk/' | 46 GS_URL_BASE = 'gs://nativeclient-mirror/nacl/nacl_sdk/' |
50 GSTORE = 'http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/' | 47 GSTORE = 'http://storage.googleapis.com/nativeclient-mirror/nacl/nacl_sdk/' |
51 | 48 |
52 | 49 |
53 def determine_sdk_url(flavor, base_url, version): | 50 def determine_sdk_url(flavor, base_url, version): |
54 """Download one Native Client toolchain and extract it. | 51 """Download one Native Client toolchain and extract it. |
55 | 52 |
56 Arguments: | 53 Arguments: |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return 0 | 209 return 0 |
213 | 210 |
214 | 211 |
215 if __name__ == '__main__': | 212 if __name__ == '__main__': |
216 try: | 213 try: |
217 rtn = main(sys.argv[1:]) | 214 rtn = main(sys.argv[1:]) |
218 except webports.Error as e: | 215 except webports.Error as e: |
219 sys.stderr.write("error: %s\n" % str(e)) | 216 sys.stderr.write("error: %s\n" % str(e)) |
220 rtn = 1 | 217 rtn = 1 |
221 sys.exit(rtn) | 218 sys.exit(rtn) |
OLD | NEW |