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
This commit is contained in:
Sarah Owens
2012-09-09 15:37:57 -07:00
parent 9ed12c5d9c
commit a5be53f9c8
10 changed files with 32 additions and 32 deletions

10
main.py
View File

@ -146,13 +146,13 @@ class _Repo(object):
else:
print >>sys.stderr, 'real\t%dh%dm%.3fs' \
% (hours, minutes, seconds)
except DownloadError, e:
except DownloadError as e:
print >>sys.stderr, 'error: %s' % str(e)
return 1
except ManifestInvalidRevisionError, e:
except ManifestInvalidRevisionError as e:
print >>sys.stderr, 'error: %s' % str(e)
return 1
except NoSuchProjectError, e:
except NoSuchProjectError as e:
if e.name:
print >>sys.stderr, 'error: project %s not found' % e.name
else:
@ -390,14 +390,14 @@ def _Main(argv):
close_ssh()
except KeyboardInterrupt:
result = 1
except RepoChangedException, rce:
except RepoChangedException as rce:
# If repo changed, re-exec ourselves.
#
argv = list(sys.argv)
argv.extend(rce.extra_args)
try:
os.execv(__file__, argv)
except OSError, e:
except OSError as e:
print >>sys.stderr, 'fatal: cannot restart repo after upgrade'
print >>sys.stderr, 'fatal: %s' % e
result = 128