blob: 16d7e5f3f03a616abb766020079cdd285ef8d951 [file] [log] [blame]
Christoffer Jansson4e8a7732022-02-08 08:01:121#!/usr/bin/env vpython3
2
oprypin3b2fb202017-03-06 10:23:343# Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
4#
5# Use of this source code is governed by a BSD-style license
6# that can be found in the LICENSE file in the root of the source
7# tree. An additional intellectual property rights grant can be found
8# in the file PATENTS. All contributing project authors may
9# be found in the AUTHORS file in the root of the source tree.
oprypin3b2fb202017-03-06 10:23:3410"""Downloads precompiled tools.
11
12These are checked into the repository as SHA-1 hashes (see *.sha1 files in
13subdirectories). Note that chrome-webrtc-resources is a Google-internal bucket,
14so please download and compile these tools manually if this script fails.
15"""
16
17import os
oprypin3b2fb202017-03-06 10:23:3418import sys
19
oprypin3b2fb202017-03-06 10:23:3420SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
Henrik Kjellandera2543042017-10-15 17:51:5521SRC_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, os.pardir))
Henrik Kjellanderec57e052017-10-17 19:36:0122sys.path.append(os.path.join(SRC_DIR, 'build'))
Henrik Kjellandera2543042017-10-15 17:51:5523
Henrik Kjellanderec57e052017-10-17 19:36:0124import find_depot_tools
25find_depot_tools.add_depot_tools_to_path()
Henrik Kjellandera2543042017-10-15 17:51:5526import gclient_utils
27import subprocess2
oprypin3b2fb202017-03-06 10:23:3428
29
30def main(directories):
Christoffer Jansson4e8a7732022-02-08 08:01:1231 if not directories:
32 directories = [SCRIPT_DIR]
oprypin3b2fb202017-03-06 10:23:3433
Christoffer Jansson4e8a7732022-02-08 08:01:1234 for path in directories:
35 cmd = [
36 sys.executable,
37 os.path.join(find_depot_tools.DEPOT_TOOLS_PATH,
38 'download_from_google_storage.py'),
39 '--directory',
40 '--num_threads=10',
41 '--bucket',
42 'chrome-webrtc-resources',
43 '--auto_platform',
44 '--recursive',
45 path,
46 ]
47 print('Downloading precompiled tools...')
Henrik Kjellandera2543042017-10-15 17:51:5548
Christoffer Jansson4e8a7732022-02-08 08:01:1249 # Perform download similar to how gclient hooks execute.
50 try:
51 gclient_utils.CheckCallAndFilter(cmd,
52 cwd=SRC_DIR,
53 always_show_header=True)
54 except (gclient_utils.Error, subprocess2.CalledProcessError) as e:
55 print('Error: %s' % str(e))
56 return 2
57 return 0
oprypin3b2fb202017-03-06 10:23:3458
59
60if __name__ == '__main__':
Christoffer Jansson4e8a7732022-02-08 08:01:1261 sys.exit(main(sys.argv[1:]))