• 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 os
14import subprocess
15
16
17def create_asset(target_dir):
18  """Create the asset."""
19  env = {}
20  env.update(os.environ)
21  env['GOPATH'] = target_dir
22  subprocess.check_call(
23      ['go', 'get', '-u', '-t', 'go.skia.org/infra/...'],
24      env=env)
25  # There's a broken symlink which causes a lot of problems. Delete it.
26  bad_symlink = os.path.join(
27      target_dir, 'src', 'go.chromium.org', 'luci', 'machine-db', 'appengine',
28      'frontend', 'bower_components')
29  os.remove(bad_symlink)
30
31  # Install additional dependencies via the install_go_deps.sh script.
32  script = os.path.join(
33      target_dir, 'src', 'go.skia.org', 'infra', 'scripts',
34      'install_go_deps.sh')
35  subprocess.check_call(script, env=env)
36
37
38def main():
39  parser = argparse.ArgumentParser()
40  parser.add_argument('--target_dir', '-t', required=True)
41  args = parser.parse_args()
42  create_asset(args.target_dir)
43
44
45if __name__ == '__main__':
46  main()
47