gclient: stop using deprecated except syntax

The newer form works with python2 and python3.

Review URL: https://codereview.chromium.org/1436763002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297517 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
vapier@chromium.org 10 years ago
parent bb79beaac4
commit a81a56e89b

@ -638,7 +638,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# Eval the content.
try:
exec(deps_content, global_scope, local_scope)
except SyntaxError, e:
except SyntaxError as e:
gclient_utils.SyntaxErrorToError(filepath, e)
if use_strict:
for key, val in local_scope.iteritems():
@ -983,7 +983,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
start_time = time.time()
gclient_utils.CheckCallAndFilterAndHeader(
hook, cwd=self.root.root_dir, always=True)
except (gclient_utils.Error, subprocess2.CalledProcessError), e:
except (gclient_utils.Error, subprocess2.CalledProcessError) as e:
# Use a discrete exit status code of 2 to indicate that a hook action
# failed. Users of this script may wish to treat hook action failures
# differently from VC failures.
@ -1008,7 +1008,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
start_time = time.time()
gclient_utils.CheckCallAndFilterAndHeader(
hook, cwd=self.root.root_dir, always=True)
except (gclient_utils.Error, subprocess2.CalledProcessError), e:
except (gclient_utils.Error, subprocess2.CalledProcessError) as e:
# Use a discrete exit status code of 2 to indicate that a hook action
# failed. Users of this script may wish to treat hook action failures
# differently from VC failures.
@ -1248,7 +1248,7 @@ want to set 'managed': False in .gclient.
self.config_content = content
try:
exec(content, config_dict)
except SyntaxError, e:
except SyntaxError as e:
gclient_utils.SyntaxErrorToError('.gclient', e)
# Append any target OS that is not already being enforced to the tuple.
@ -1443,7 +1443,7 @@ been automagically updated. The previous version is available at %s.old.
return {}
try:
exec(gclient_utils.FileRead(filename), scope)
except SyntaxError, e:
except SyntaxError as e:
gclient_utils.SyntaxErrorToError(filename, e)
return scope['entries']
@ -2312,7 +2312,7 @@ def main(argv):
except KeyboardInterrupt:
gclient_utils.GClientChildren.KillAllRemainingChildren()
raise
except (gclient_utils.Error, subprocess2.CalledProcessError), e:
except (gclient_utils.Error, subprocess2.CalledProcessError) as e:
print('Error: %s' % str(e), file=sys.stderr)
return 1
finally:

Loading…
Cancel
Save