1#!/usr/bin/env python 2# 3# Copyright 2019 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.13.4' 18URL = ('https://github.com/Kitware/CMake/releases/download/v%s/' 19 'cmake-%s-Darwin-x86_64.tar.gz') % (VERSION, VERSION) 20 21 22def create_asset(target_dir): 23 """Create the asset.""" 24 with utils.tmp_dir(): 25 subprocess.check_call(['wget', URL, '--output-document=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