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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 # OptParser.description prefer nicely non-formatted strings. | 1186 # OptParser.description prefer nicely non-formatted strings. |
1187 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) | 1187 parser.description = re.sub('[\r\n ]{2,}', ' ', obj.__doc__) |
1188 usage = getattr(obj, 'usage', '') | 1188 usage = getattr(obj, 'usage', '') |
1189 parser.set_usage('%%prog %s [options] %s' % (command, usage)) | 1189 parser.set_usage('%%prog %s [options] %s' % (command, usage)) |
1190 parser.epilog = getattr(obj, 'epilog', None) | 1190 parser.epilog = getattr(obj, 'epilog', None) |
1191 | 1191 |
1192 | 1192 |
1193 def Main(argv): | 1193 def Main(argv): |
1194 """Doesn't parse the arguments here, just find the right subcommand to | 1194 """Doesn't parse the arguments here, just find the right subcommand to |
1195 execute.""" | 1195 execute.""" |
| 1196 if sys.hexversion < 0x02050000: |
| 1197 print >> sys.stderr, ( |
| 1198 '\nYour python version is unsupported, please upgrade.\n') |
1196 try: | 1199 try: |
1197 # Make stdout auto-flush so buildbot doesn't kill us during lengthy | 1200 # Make stdout auto-flush so buildbot doesn't kill us during lengthy |
1198 # operations. Python as a strong tendency to buffer sys.stdout. | 1201 # operations. Python as a strong tendency to buffer sys.stdout. |
1199 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 1202 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
1200 # Make stdout annotated with the thread ids. | 1203 # Make stdout annotated with the thread ids. |
1201 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) | 1204 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) |
1202 # Do it late so all commands are listed. | 1205 # Do it late so all commands are listed. |
1203 # Unused variable 'usage' | 1206 # Unused variable 'usage' |
1204 # pylint: disable=W0612 | 1207 # pylint: disable=W0612 |
1205 CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ | 1208 CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 return CMDhelp(parser, argv) | 1262 return CMDhelp(parser, argv) |
1260 except gclient_utils.Error, e: | 1263 except gclient_utils.Error, e: |
1261 print >> sys.stderr, 'Error: %s' % str(e) | 1264 print >> sys.stderr, 'Error: %s' % str(e) |
1262 return 1 | 1265 return 1 |
1263 | 1266 |
1264 | 1267 |
1265 if '__main__' == __name__: | 1268 if '__main__' == __name__: |
1266 sys.exit(Main(sys.argv[1:])) | 1269 sys.exit(Main(sys.argv[1:])) |
1267 | 1270 |
1268 # vim: ts=2:sw=2:tw=80:et: | 1271 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |