summaryrefslogtreecommitdiff
path: root/tools/prebuilt.py
blob: d30b232befe1b522853ab641b0c2e19ef7dbe9ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os
from util import run, root_path
from third_party import tp, google_env


def download_prebuilt(sha1_file):
    run([
        "python",
        tp('depot_tools/download_from_google_storage.py'),
        '--platform=' + sys.platform,
        '--no_auth',
        '--bucket=denoland',
        '--sha1_file',
        sha1_file,
    ],
        env=google_env())


def load_sccache():
    if sys.platform == 'win32':
        p = "prebuilt/win/sccache.exe"
    elif sys.platform.startswith('linux'):
        p = "prebuilt/linux64/sccache"
    elif sys.platform == 'darwin':
        p = "prebuilt/mac/sccache"
    download_prebuilt(p + ".sha1")
    return os.path.join(root_path, p)


def load_hyperfine():
    if sys.platform == 'win32':
        download_prebuilt("prebuilt/win/hyperfine.exe.sha1")
    elif sys.platform.startswith('linux'):
        download_prebuilt("prebuilt/linux64/hyperfine.sha1")
    elif sys.platform == 'darwin':
        download_prebuilt("prebuilt/mac/hyperfine.sha1")