OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | |
3 # | |
4 # Use of this source code is governed by a BSD-style license | |
5 # that can be found in the LICENSE file in the root of the source | |
6 # tree. An additional intellectual property rights grant can be found | |
7 # in the file PATENTS. All contributing project authors may | |
8 # be found in the AUTHORS file in the root of the source tree. | |
9 | |
10 """Downloads prebuilt AppRTC and Go from WebRTC storage and unpacks it. | |
11 | |
12 Requires that depot_tools is installed and in the PATH. | |
13 | |
14 It downloads compressed files in the directory where the script lives. | |
15 This is because the precondition is that the script lives in the same | |
16 directory of the .sha1 files. | |
17 """ | |
18 | |
19 import os | |
20 import sys | |
21 | |
22 import utils | |
23 | |
24 | |
25 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | |
26 | |
27 | |
28 def _GetGoArchivePathForPlatform(): | |
29 archive_extension = 'zip' if utils.GetPlatform() == 'win' else 'tar.gz' | |
30 return os.path.join(utils.GetPlatform(), 'go.%s' % archive_extension) | |
31 | |
32 | |
33 def main(argv): | |
34 if len(argv) > 2: | |
35 return 'Usage: %s [output_dir]' % argv[0] | |
36 | |
37 output_dir = os.path.abspath(argv[1]) if len(argv) > 1 else None | |
38 | |
39 apprtc_zip_path = os.path.join(SCRIPT_DIR, 'prebuilt_apprtc.zip') | |
40 if os.path.isfile(apprtc_zip_path + '.sha1'): | |
41 utils.DownloadFilesFromGoogleStorage(SCRIPT_DIR, auto_platform=False) | |
42 | |
43 if output_dir is not None: | |
44 utils.RemoveDirectory(os.path.join(output_dir, 'apprtc')) | |
45 utils.UnpackArchiveTo(apprtc_zip_path, output_dir) | |
46 | |
47 golang_path = os.path.join(SCRIPT_DIR, 'golang') | |
48 golang_zip_path = os.path.join(golang_path, _GetGoArchivePathForPlatform()) | |
49 if os.path.isfile(golang_zip_path + '.sha1'): | |
50 utils.DownloadFilesFromGoogleStorage(golang_path) | |
51 | |
52 if output_dir is not None: | |
53 utils.RemoveDirectory(os.path.join(output_dir, 'go')) | |
54 utils.UnpackArchiveTo(golang_zip_path, output_dir) | |
55 | |
56 | |
57 if __name__ == '__main__': | |
58 sys.exit(main(sys.argv)) | |
OLD | NEW |