Mercurial > p > roundup > code
comparison tools/pygettext.py @ 5248:198b6e810c67
Use Python-3-compatible 'as' syntax for except statements
Many raise statements near these are also fixed.
So are two ivorrect file encoding marks ('utf8'->'utf-8').
| author | Eric S. Raymond <esr@thyrsus.com> |
|---|---|
| date | Thu, 24 Aug 2017 22:21:37 -0400 |
| parents | b2d6657cd2a6 |
| children | 64b05e24dbd8 |
comparison
equal
deleted
inserted
replaced
| 5247:7f00a47b3559 | 5248:198b6e810c67 |
|---|---|
| 512 'keyword=', 'no-default-keywords', | 512 'keyword=', 'no-default-keywords', |
| 513 'add-location', 'no-location', 'output=', 'output-dir=', | 513 'add-location', 'no-location', 'output=', 'output-dir=', |
| 514 'style=', 'verbose', 'version', 'width=', 'exclude-file=', | 514 'style=', 'verbose', 'version', 'width=', 'exclude-file=', |
| 515 'docstrings', 'no-docstrings', | 515 'docstrings', 'no-docstrings', |
| 516 ]) | 516 ]) |
| 517 except getopt.error, msg: | 517 except getopt.error as msg: |
| 518 usage(1, msg) | 518 usage(1, msg) |
| 519 | 519 |
| 520 # for holding option values | 520 # for holding option values |
| 521 class Options: | 521 class Options: |
| 522 # constants | 522 # constants |
| 635 closep = 1 | 635 closep = 1 |
| 636 try: | 636 try: |
| 637 eater.set_filename(filename) | 637 eater.set_filename(filename) |
| 638 try: | 638 try: |
| 639 tokenize.tokenize(fp.readline, eater) | 639 tokenize.tokenize(fp.readline, eater) |
| 640 except tokenize.TokenError, e: | 640 except tokenize.TokenError as e: |
| 641 print >> sys.stderr, '%s: %s, line %d, column %d' % ( | 641 print >> sys.stderr, '%s: %s, line %d, column %d' % ( |
| 642 e[0], filename, e[1][0], e[1][1]) | 642 e[0], filename, e[1][0], e[1][1]) |
| 643 finally: | 643 finally: |
| 644 if closep: | 644 if closep: |
| 645 fp.close() | 645 fp.close() |
