Home | History | Annotate | Download | only in win_ninja
      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 
     12 import argparse
     13 import subprocess
     14 
     15 VERSION = "v1.8.2"
     16 URL = "https://github.com/ninja-build/ninja/releases/download/%s/ninja-win.zip"
     17 
     18 def create_asset(target_dir):
     19   """Create the asset."""
     20   subprocess.check_call(["curl", "-L", URL % VERSION, "-o", "ninja-win.zip"])
     21   subprocess.check_call(["unzip", "ninja-win.zip", "-d", target_dir])
     22   subprocess.check_call(["rm", "ninja-win.zip"])
     23 
     24 def main():
     25   parser = argparse.ArgumentParser()
     26   parser.add_argument('--target_dir', '-t', required=True)
     27   args = parser.parse_args()
     28   create_asset(args.target_dir)
     29 
     30 
     31 if __name__ == '__main__':
     32   main()
     33