• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python3
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    content = content.replace('change2dot', '.')
32    if sys.platform.startswith('linux') or sys.platform == 'darwin':
33        content += 'target_os = [ \'android\' ]\n'
34
35    with open('.gclient', 'w') as gclient_file:
36        gclient_file.write(content)
37
38    print('created .gclient')
39
40
41if __name__ == '__main__':
42    main()
43