OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 578 |
579 def file_list(self): | 579 def file_list(self): |
580 result = self._file_list[:] | 580 result = self._file_list[:] |
581 for d in self.dependencies: | 581 for d in self.dependencies: |
582 result.extend(d.file_list()) | 582 result.extend(d.file_list()) |
583 return result | 583 return result |
584 | 584 |
585 def __str__(self): | 585 def __str__(self): |
586 out = [] | 586 out = [] |
587 for i in ('name', 'url', 'parsed_url', 'safesync_url', 'custom_deps', | 587 for i in ('name', 'url', 'parsed_url', 'safesync_url', 'custom_deps', |
588 'custom_vars', 'deps_hooks', '_file_list', 'should_process', | 588 'custom_vars', 'deps_hooks', 'file_list', 'should_process', |
589 'processed', 'hooks_ran', 'deps_parsed', 'requirements'): | 589 'processed', 'hooks_ran', 'deps_parsed', 'requirements'): |
590 # 'deps_file' | 590 # First try the native property if it exists. |
591 if self.__dict__[i]: | 591 if hasattr(self, '_' + i): |
592 out.append('%s: %s' % (i, self.__dict__[i])) | 592 value = getattr(self, '_' + i, False) |
| 593 else: |
| 594 value = getattr(self, i, False) |
| 595 if value: |
| 596 out.append('%s: %s' % (i, value)) |
593 | 597 |
594 for d in self.dependencies: | 598 for d in self.dependencies: |
595 out.extend([' ' + x for x in str(d).splitlines()]) | 599 out.extend([' ' + x for x in str(d).splitlines()]) |
596 out.append('') | 600 out.append('') |
597 return '\n'.join(out) | 601 return '\n'.join(out) |
598 | 602 |
599 def __repr__(self): | 603 def __repr__(self): |
600 return '%s: %s' % (self.name, self.url) | 604 return '%s: %s' % (self.name, self.url) |
601 | 605 |
602 def hierarchy(self): | 606 def hierarchy(self): |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1362 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1359 print >> sys.stderr, 'Error: %s' % str(e) | 1363 print >> sys.stderr, 'Error: %s' % str(e) |
1360 return 1 | 1364 return 1 |
1361 | 1365 |
1362 | 1366 |
1363 if '__main__' == __name__: | 1367 if '__main__' == __name__: |
1364 fix_encoding.fix_encoding() | 1368 fix_encoding.fix_encoding() |
1365 sys.exit(Main(sys.argv[1:])) | 1369 sys.exit(Main(sys.argv[1:])) |
1366 | 1370 |
1367 # vim: ts=2:sw=2:tw=80:et: | 1371 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |