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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 it will be removed from the list and the list will be extended | 42 it will be removed from the list and the list will be extended |
43 by the list of matching files. | 43 by the list of matching files. |
44 | 44 |
45 Example: | 45 Example: |
46 hooks = [ | 46 hooks = [ |
47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", | 47 { "pattern": "\\.(gif|jpe?g|pr0n|png)$", |
48 "action": ["python", "image_indexer.py", "--all"]}, | 48 "action": ["python", "image_indexer.py", "--all"]}, |
49 ] | 49 ] |
50 """ | 50 """ |
51 | 51 |
52 __version__ = "0.6.3" | 52 __version__ = "0.6.4" |
53 | 53 |
54 import copy | 54 import copy |
55 import logging | 55 import logging |
56 import optparse | 56 import optparse |
57 import os | 57 import os |
58 import posixpath | 58 import posixpath |
59 import pprint | 59 import pprint |
60 import re | 60 import re |
61 import sys | 61 import sys |
62 import urlparse | 62 import urlparse |
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 return (options, args) | 1491 return (options, args) |
1492 parser.parse_args = Parse | 1492 parser.parse_args = Parse |
1493 # We don't want wordwrapping in epilog (usually examples) | 1493 # We don't want wordwrapping in epilog (usually examples) |
1494 parser.format_epilog = lambda _: parser.epilog or '' | 1494 parser.format_epilog = lambda _: parser.epilog or '' |
1495 return parser | 1495 return parser |
1496 | 1496 |
1497 | 1497 |
1498 def Main(argv): | 1498 def Main(argv): |
1499 """Doesn't parse the arguments here, just find the right subcommand to | 1499 """Doesn't parse the arguments here, just find the right subcommand to |
1500 execute.""" | 1500 execute.""" |
1501 if sys.hexversion < 0x02050000: | 1501 if sys.hexversion < 0x02060000: |
1502 print >> sys.stderr, ( | 1502 print >> sys.stderr, ( |
1503 '\nYour python version is unsupported, please upgrade.\n') | 1503 '\nYour python version %s is unsupported, please upgrade.\n' % |
| 1504 sys.version.split(' ', 1)[0]) |
| 1505 return 2 |
1504 colorama.init() | 1506 colorama.init() |
1505 try: | 1507 try: |
1506 # Make stdout auto-flush so buildbot doesn't kill us during lengthy | 1508 # Make stdout auto-flush so buildbot doesn't kill us during lengthy |
1507 # operations. Python as a strong tendency to buffer sys.stdout. | 1509 # operations. Python as a strong tendency to buffer sys.stdout. |
1508 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 1510 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
1509 # Make stdout annotated with the thread ids. | 1511 # Make stdout annotated with the thread ids. |
1510 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) | 1512 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) |
1511 # Do it late so all commands are listed. | 1513 # Do it late so all commands are listed. |
1512 # Unused variable 'usage' | 1514 # Unused variable 'usage' |
1513 # pylint: disable=W0612 | 1515 # pylint: disable=W0612 |
(...skipping 18 matching lines...) Expand all Loading... |
1532 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1534 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1533 print >> sys.stderr, 'Error: %s' % str(e) | 1535 print >> sys.stderr, 'Error: %s' % str(e) |
1534 return 1 | 1536 return 1 |
1535 | 1537 |
1536 | 1538 |
1537 if '__main__' == __name__: | 1539 if '__main__' == __name__: |
1538 fix_encoding.fix_encoding() | 1540 fix_encoding.fix_encoding() |
1539 sys.exit(Main(sys.argv[1:])) | 1541 sys.exit(Main(sys.argv[1:])) |
1540 | 1542 |
1541 # vim: ts=2:sw=2:tw=80:et: | 1543 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |