Commit d51b70f0 authored by Mike Frysinger's avatar Mike Frysinger Committed by Commit Bot

grit: utilize six.reraise

The syntax for raising a custom exception with all three args is
different between Python 2 & Python 3 to the point where we can't
even do it inline because an incompatible version throws syntax
errors during parsing.  Utilize six's reraise helper for it.

Bug: 983071
Test: `./grit/test_suite_all.py` passes
Change-Id: I2489dfe588c4c650661ece327c5d86e8754269ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700504Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686221}
parent da084506
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
../grit/grit/tclib.py ../grit/grit/tclib.py
../grit/grit/util.py ../grit/grit/util.py
../grit/grit/xtb_reader.py ../grit/grit/xtb_reader.py
../grit/third_party/six/__init__.py
libsupersize/apkanalyzer.py libsupersize/apkanalyzer.py
libsupersize/ar.py libsupersize/ar.py
libsupersize/archive.py libsupersize/archive.py
......
...@@ -10,6 +10,8 @@ from __future__ import print_function ...@@ -10,6 +10,8 @@ from __future__ import print_function
import json import json
import sys import sys
import six
from grit.gather import skeleton_gatherer from grit.gather import skeleton_gatherer
from grit import util from grit import util
from grit import tclib from grit import tclib
...@@ -83,7 +85,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer): ...@@ -83,7 +85,7 @@ class PolicyJson(skeleton_gatherer.SkeletonGatherer):
node = minidom.parseString(xml).childNodes[0] node = minidom.parseString(xml).childNodes[0]
except ExpatError: except ExpatError:
reason = '''Input isn't valid XML (has < & > been escaped?): ''' + string reason = '''Input isn't valid XML (has < & > been escaped?): ''' + string
raise Exception, reason, sys.exc_info()[2] six.reraise(Exception, reason, sys.exc_info()[2])
for child in node.childNodes: for child in node.childNodes:
if child.nodeType == minidom.Node.TEXT_NODE: if child.nodeType == minidom.Node.TEXT_NODE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment