Home | History | Annotate | Download | only in cmake_linux
      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 
     12 import argparse
     13 import common
     14 import subprocess
     15 import utils
     16 
     17 VERSION = '3.11.0'
     18 URL = 'https://cmake.org/files/v%s/cmake-%s-Linux-x86_64.tar.gz' % (
     19     VERSION.rsplit('.', 1)[0], VERSION)
     20 
     21 
     22 def 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 
     31 def 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 
     38 if __name__ == '__main__':
     39   main()
     40