Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
create.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright 2018 Google Inc.
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
15import sys
16
17FILE_DIR = os.path.dirname(os.path.abspath(__file__))
18INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
19sys.path.insert(0, INFRA_BOTS_DIR)
20import utils
21
22
23VERSION = '3.17.2'
24URL = 'https://cmake.org/files/v%s/cmake-%s-Linux-x86_64.tar.gz' % (
25 VERSION.rsplit('.', 1)[0], VERSION)
26
27
28def create_asset(target_dir):
29 """Create the asset."""
30 with utils.tmp_dir():
31 subprocess.check_call(['curl', URL, '-o', 'cmake.tar.gz'])
32 subprocess.check_call(['tar', '--extract', '--gunzip', '--file',
33 'cmake.tar.gz', '--directory', target_dir,
34 '--strip-components', '1'])
35
36
37def main():
38 parser = argparse.ArgumentParser()
39 parser.add_argument('--target_dir', '-t', required=True)
40 args = parser.parse_args()
41 create_asset(args.target_dir)
42
43
44if __name__ == '__main__':
45 main()
Definition main.py:1