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
diff --git a/gclient.py b/gclient.py
index f258890..00bb95d 100755
--- a/gclient.py
+++ b/gclient.py
@@ -638,7 +638,7 @@
# 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 @@
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 @@
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 @@
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 @@
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 @@
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: