Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
create.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
3# Copyright 2022 Google LLC
4#
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
7
8
9"""Create the asset."""
10
11
12import argparse
13import os
14import subprocess
15
16
17URL = 'https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64'
18SHA256 = '61699e22abb2a26304edfa1376f65ad24191f94a4ffed68a58d42b6fee01e124'
19
20BINARY = URL.split('/')[-1]
21
22
23def create_asset(target_dir):
24 """Create the asset."""
25 target_file = os.path.join(target_dir, 'bazelisk')
26 subprocess.call(['wget', '--quiet', '--output-document', target_file, URL])
27 output = subprocess.check_output(['sha256sum', target_file], encoding='utf-8')
28 actual_hash = output.split(' ')[0]
29 if actual_hash != SHA256:
30 raise Exception('SHA256 does not match (%s != %s)' % (actual_hash, SHA256))
31 subprocess.call(['chmod', 'ugo+x', target_file])
32
33
34def main():
35 parser = argparse.ArgumentParser()
36 parser.add_argument('--target_dir', '-t', required=True)
37 args = parser.parse_args()
38 create_asset(args.target_dir)
39
40
41if __name__ == '__main__':
42 main()
43
create_asset(target_dir)
Definition create.py:32
main()
Definition create.py:69
Definition main.py:1