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