OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Meta checkout manager supporting both Subversion and GIT. | 6 """Meta checkout manager supporting both Subversion and GIT. |
7 | 7 |
8 Files | 8 Files |
9 .gclient : Current client configuration, written by 'config' command. | 9 .gclient : Current client configuration, written by 'config' command. |
10 Format is a Python script defining 'solutions', a list whose | 10 Format is a Python script defining 'solutions', a list whose |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 'There is a syntax error in your configuration file.', | 443 'There is a syntax error in your configuration file.', |
444 'Line #%s, character %s:' % (e.lineno, e.offset), | 444 'Line #%s, character %s:' % (e.lineno, e.offset), |
445 '"%s"' % re.sub(r'[\r\n]*$', '', e.text) ] | 445 '"%s"' % re.sub(r'[\r\n]*$', '', e.text) ] |
446 except: | 446 except: |
447 # Something went wrong, re-raise the original exception | 447 # Something went wrong, re-raise the original exception |
448 raise e | 448 raise e |
449 else: | 449 else: |
450 # Raise a new exception with the human readable message: | 450 # Raise a new exception with the human readable message: |
451 raise gclient_utils.Error('\n'.join(error_message)) | 451 raise gclient_utils.Error('\n'.join(error_message)) |
452 for s in config_dict.get('solutions', []): | 452 for s in config_dict.get('solutions', []): |
453 self.dependencies.append(Dependency( | 453 try: |
454 self, s['name'], s['url'], | 454 self.dependencies.append(Dependency( |
455 s.get('safesync_url', None), | 455 self, s['name'], s['url'], |
456 s.get('custom_deps', {}), | 456 s.get('safesync_url', None), |
457 s.get('custom_vars', {}))) | 457 s.get('custom_deps', {}), |
| 458 s.get('custom_vars', {}))) |
| 459 except KeyError: |
| 460 raise gclient_utils.Error('Invalid .gclient file. Solution is ' |
| 461 'incomplete: %s' % s) |
458 # .gclient can have hooks. | 462 # .gclient can have hooks. |
459 self.deps_hooks = config_dict.get('hooks', []) | 463 self.deps_hooks = config_dict.get('hooks', []) |
460 | 464 |
461 def SaveConfig(self): | 465 def SaveConfig(self): |
462 gclient_utils.FileWrite(os.path.join(self.root_dir(), | 466 gclient_utils.FileWrite(os.path.join(self.root_dir(), |
463 self._options.config_filename), | 467 self._options.config_filename), |
464 self.config_content) | 468 self.config_content) |
465 | 469 |
466 @staticmethod | 470 @staticmethod |
467 def LoadCurrentConfig(options): | 471 def LoadCurrentConfig(options): |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 return CMDhelp(parser, argv) | 1122 return CMDhelp(parser, argv) |
1119 except gclient_utils.Error, e: | 1123 except gclient_utils.Error, e: |
1120 print >> sys.stderr, 'Error: %s' % str(e) | 1124 print >> sys.stderr, 'Error: %s' % str(e) |
1121 return 1 | 1125 return 1 |
1122 | 1126 |
1123 | 1127 |
1124 if '__main__' == __name__: | 1128 if '__main__' == __name__: |
1125 sys.exit(Main(sys.argv[1:])) | 1129 sys.exit(Main(sys.argv[1:])) |
1126 | 1130 |
1127 # vim: ts=2:sw=2:tw=80:et: | 1131 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |