• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 https://cs.chromium.org/chromium/src/tools/clang/scripts/update.py
20CLANG_REVISION = 'c2443155a0fb245c8f17f2c1c72b6ea391e86e81'
21CLANG_SVN_REVISION = 'n332890'
22CLANG_SUB_REVISION = 1
23
24PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8],
25                                CLANG_SUB_REVISION)
26# (End copying)
27
28GS_URL = ('https://commondatastorage.googleapis.com/chromium-browser-clang'
29          '/Win/clang-%s.tgz' % PACKAGE_VERSION)
30
31
32def create_asset(target_dir):
33  """Create the asset."""
34  with utils.chdir(target_dir):
35    tarball = 'clang.tgz'
36    subprocess.check_call(['wget', '-O', tarball, GS_URL])
37    subprocess.check_call(['tar', 'zxvf', tarball])
38    os.remove(tarball)
39
40
41def main():
42  parser = argparse.ArgumentParser()
43  parser.add_argument('--target_dir', '-t', required=True)
44  args = parser.parse_args()
45  create_asset(args.target_dir)
46
47
48if __name__ == '__main__':
49  main()
50