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 os 14import subprocess 15import sys 16 17FILE_DIR = os.path.dirname(os.path.abspath(__file__)) 18INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) 19sys.path.insert(0, INFRA_BOTS_DIR) 20import utils 21 22 23# Copied from https://cs.chromium.org/chromium/src/tools/clang/scripts/update.py 24CLANG_REVISION = '0e41d647ceaeb2195d5d9ab5ff25c19292a36bf5' 25CLANG_SVN_REVISION = 'n354867' 26CLANG_SUB_REVISION = 2 27 28PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8], 29 CLANG_SUB_REVISION) 30# (End copying) 31 32GS_URL = ('https://commondatastorage.googleapis.com/chromium-browser-clang' 33 '/Win/clang-%s.tgz' % PACKAGE_VERSION) 34 35 36def create_asset(target_dir): 37 """Create the asset.""" 38 with utils.chdir(target_dir): 39 tarball = 'clang.tgz' 40 subprocess.check_call(['wget', '-O', tarball, GS_URL]) 41 subprocess.check_call(['tar', 'zxvf', tarball]) 42 os.remove(tarball) 43 44 45def main(): 46 parser = argparse.ArgumentParser() 47 parser.add_argument('--target_dir', '-t', required=True) 48 args = parser.parse_args() 49 create_asset(args.target_dir) 50 51 52if __name__ == '__main__': 53 main() 54