• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 common
14import subprocess
15import utils
16
17VERSION = '3.11.0'
18URL = 'https://cmake.org/files/v%s/cmake-%s-Linux-x86_64.tar.gz' % (
19    VERSION.rsplit('.', 1)[0], VERSION)
20
21
22def create_asset(target_dir):
23  """Create the asset."""
24  with utils.tmp_dir():
25    subprocess.check_call(['curl', URL, '-o', 'cmake.tar.gz'])
26    subprocess.check_call(['tar', '--extract', '--gunzip', '--file',
27                           'cmake.tar.gz', '--directory', target_dir,
28                           '--strip-components', '1'])
29
30
31def main():
32  parser = argparse.ArgumentParser()
33  parser.add_argument('--target_dir', '-t', required=True)
34  args = parser.parse_args()
35  create_asset(args.target_dir)
36
37
38if __name__ == '__main__':
39  main()
40