Home | History | Annotate | Download | only in clang_win
      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 common
     14 import os
     15 import subprocess
     16 import utils
     17 
     18 
     19 CLANG_REVISION = '318667'
     20 CLANG_SUB_REVISION = '1'
     21 CLANG_PKG_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION)
     22 GS_URL = ('https://commondatastorage.googleapis.com/chromium-browser-clang'
     23           '/Win/clang-%s.tgz' % CLANG_PKG_VERSION)
     24 
     25 
     26 def create_asset(target_dir):
     27   """Create the asset."""
     28   with utils.chdir(target_dir):
     29     tarball = 'clang.tgz'
     30     subprocess.check_call(['wget', '-O', tarball, GS_URL])
     31     subprocess.check_call(['tar', 'zxvf', tarball])
     32     os.remove(tarball)
     33 
     34 
     35 def main():
     36   parser = argparse.ArgumentParser()
     37   parser.add_argument('--target_dir', '-t', required=True)
     38   args = parser.parse_args()
     39   create_asset(args.target_dir)
     40 
     41 
     42 if __name__ == '__main__':
     43   main()
     44