OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """\ | 6 """\ |
7 Wrapper script around Rietveld's upload.py that simplifies working with groups | 7 Wrapper script around Rietveld's upload.py that simplifies working with groups |
8 of files. | 8 of files. |
9 """ | 9 """ |
10 | 10 |
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 print sys.modules[__name__].__doc__ | 1411 print sys.modules[__name__].__doc__ |
1412 print 'version ' + __version__ + '\n' | 1412 print 'version ' + __version__ + '\n' |
1413 | 1413 |
1414 print('Commands are:\n' + '\n'.join([ | 1414 print('Commands are:\n' + '\n'.join([ |
1415 ' %-12s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) | 1415 ' %-12s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) |
1416 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) | 1416 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) |
1417 return 0 | 1417 return 0 |
1418 | 1418 |
1419 | 1419 |
1420 def main(argv): | 1420 def main(argv): |
1421 if sys.hexversion < 0x02050000: | 1421 if sys.hexversion < 0x02060000: |
1422 print >> sys.stderr, ( | 1422 print >> sys.stderr, ( |
1423 '\nYour python version is unsupported, please upgrade.\n') | 1423 '\nYour python version %s is unsupported, please upgrade.\n' % |
| 1424 sys.version.split(' ', 1)[0]) |
| 1425 return 2 |
1424 if not argv: | 1426 if not argv: |
1425 argv = ['help'] | 1427 argv = ['help'] |
1426 command = Command(argv[0]) | 1428 command = Command(argv[0]) |
1427 # Help can be run from anywhere. | 1429 # Help can be run from anywhere. |
1428 if command == CMDhelp: | 1430 if command == CMDhelp: |
1429 return command(argv[1:]) | 1431 return command(argv[1:]) |
1430 | 1432 |
1431 try: | 1433 try: |
1432 GetRepositoryRoot() | 1434 GetRepositoryRoot() |
1433 except (gclient_utils.Error, subprocess2.CalledProcessError): | 1435 except (gclient_utils.Error, subprocess2.CalledProcessError): |
(...skipping 27 matching lines...) Expand all Loading... |
1461 raise | 1463 raise |
1462 print >> sys.stderr, ( | 1464 print >> sys.stderr, ( |
1463 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1465 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
1464 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1466 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
1465 return 1 | 1467 return 1 |
1466 | 1468 |
1467 | 1469 |
1468 if __name__ == "__main__": | 1470 if __name__ == "__main__": |
1469 fix_encoding.fix_encoding() | 1471 fix_encoding.fix_encoding() |
1470 sys.exit(main(sys.argv[1:])) | 1472 sys.exit(main(sys.argv[1:])) |
OLD | NEW |