• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python2
2
3# Copyright 2015 Google Inc.  All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6"""Generate .gclient file for Angle.
7
8Because gclient won't accept "--name ." use a different name then edit.
9"""
10
11import subprocess
12import sys
13
14
15def main():
16    gclient_cmd = ('gclient config --name change2dot --unmanaged '
17                   'https://chromium.googlesource.com/angle/angle.git')
18    try:
19        rc = subprocess.call(gclient_cmd, shell=True)
20    except OSError:
21        print 'could not run "%s" via shell' % gclient_cmd
22        sys.exit(1)
23
24    if rc:
25        print 'failed command: "%s"' % gclient_cmd
26        sys.exit(1)
27
28    with open('.gclient') as gclient_file:
29        content = gclient_file.read()
30
31    with open('.gclient', 'w') as gclient_file:
32        gclient_file.write(content.replace('change2dot', '.'))
33
34    print 'created .gclient'
35
36
37if __name__ == '__main__':
38    main()
39