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