1#!/usr/bin/env python 2# 3# Copyright 2017 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 subprocess 14 15 16VERSION = "v1.8.2" 17URL = "https://github.com/ninja-build/ninja/releases/download/%s/ninja-win.zip" 18 19 20def create_asset(target_dir): 21 """Create the asset.""" 22 subprocess.check_call(["curl", "-L", URL % VERSION, "-o", "ninja-win.zip"]) 23 subprocess.check_call(["unzip", "ninja-win.zip", "-d", target_dir]) 24 subprocess.check_call(["rm", "ninja-win.zip"]) 25 26 27def main(): 28 parser = argparse.ArgumentParser() 29 parser.add_argument('--target_dir', '-t', required=True) 30 args = parser.parse_args() 31 create_asset(args.target_dir) 32 33 34if __name__ == '__main__': 35 main() 36