diff options
author | Sarah Owens <sarato@inkylabs.com> | 2012-09-09 15:37:57 -0700 |
---|---|---|
committer | Sarah Owens <sarato@inkylabs.com> | 2012-10-23 21:35:59 -0700 |
commit | a5be53f9c809009e67f217c00b8f30246aacc237 (patch) | |
tree | 7ab0da1fd31968eee882de81df8c9b93ae52fdfb /main.py | |
parent | 9ed12c5d9cda1f010bc173b0bc622d59e96b0dd0 (diff) | |
download | git-repo-a5be53f9c809009e67f217c00b8f30246aacc237.tar.gz |
Use modern Python exception syntax
"except Exception as e" instead of "except Exception, e"
This is part of a transition to supporting Python 3. Python >= 2.6
support "as" syntax.
Note: this removes Python 2.5 support.
Change-Id: I309599f3981bba2b46111c43102bee38ff132803
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -146,13 +146,13 @@ class _Repo(object): | |||
146 | else: | 146 | else: |
147 | print >>sys.stderr, 'real\t%dh%dm%.3fs' \ | 147 | print >>sys.stderr, 'real\t%dh%dm%.3fs' \ |
148 | % (hours, minutes, seconds) | 148 | % (hours, minutes, seconds) |
149 | except DownloadError, e: | 149 | except DownloadError as e: |
150 | print >>sys.stderr, 'error: %s' % str(e) | 150 | print >>sys.stderr, 'error: %s' % str(e) |
151 | return 1 | 151 | return 1 |
152 | except ManifestInvalidRevisionError, e: | 152 | except ManifestInvalidRevisionError as e: |
153 | print >>sys.stderr, 'error: %s' % str(e) | 153 | print >>sys.stderr, 'error: %s' % str(e) |
154 | return 1 | 154 | return 1 |
155 | except NoSuchProjectError, e: | 155 | except NoSuchProjectError as e: |
156 | if e.name: | 156 | if e.name: |
157 | print >>sys.stderr, 'error: project %s not found' % e.name | 157 | print >>sys.stderr, 'error: project %s not found' % e.name |
158 | else: | 158 | else: |
@@ -390,14 +390,14 @@ def _Main(argv): | |||
390 | close_ssh() | 390 | close_ssh() |
391 | except KeyboardInterrupt: | 391 | except KeyboardInterrupt: |
392 | result = 1 | 392 | result = 1 |
393 | except RepoChangedException, rce: | 393 | except RepoChangedException as rce: |
394 | # If repo changed, re-exec ourselves. | 394 | # If repo changed, re-exec ourselves. |
395 | # | 395 | # |
396 | argv = list(sys.argv) | 396 | argv = list(sys.argv) |
397 | argv.extend(rce.extra_args) | 397 | argv.extend(rce.extra_args) |
398 | try: | 398 | try: |
399 | os.execv(__file__, argv) | 399 | os.execv(__file__, argv) |
400 | except OSError, e: | 400 | except OSError as e: |
401 | print >>sys.stderr, 'fatal: cannot restart repo after upgrade' | 401 | print >>sys.stderr, 'fatal: cannot restart repo after upgrade' |
402 | print >>sys.stderr, 'fatal: %s' % e | 402 | print >>sys.stderr, 'fatal: %s' % e |
403 | result = 128 | 403 | result = 128 |