presubmit_support: Use six instead of future.utils for raise_from.

This fixes CL:2880843 to use a module already present in vpython.

Bug: 1206782
Change-Id: If4158a62011e043e89f40f368c9c644434df6614
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2901758
Commit-Queue: Allen Webb <allenwebb@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
changes/58/2901758/3
Allen Webb 4 years ago committed by LUCI CQ
parent 1fc595b55c
commit fe7d709f05

@ -29,6 +29,7 @@ import os # Somewhat exposed through the API.
import random import random
import re # Exposed through the API. import re # Exposed through the API.
import signal import signal
import six
import sys # Parts exposed through API. import sys # Parts exposed through API.
import tempfile # Exposed through the API. import tempfile # Exposed through the API.
import threading import threading
@ -1659,20 +1660,16 @@ class PresubmitExecuter(object):
try: try:
result = eval(function_name + '(*__args)', context) result = eval(function_name + '(*__args)', context)
self._check_result_type(result) self._check_result_type(result)
except Exception as e: except Exception:
if sink: if sink:
elapsed_time = time_time() - start_time elapsed_time = time_time() - start_time
sink.report(function_name, rdb_wrapper.STATUS_FAIL, elapsed_time) sink.report(function_name, rdb_wrapper.STATUS_FAIL, elapsed_time)
# TODO(crbug.com/953884): replace raise_from with native py3: # TODO(crbug.com/953884): replace reraise with native py3:
# raise .. from e # raise .. from e
try: e_type, e_value, e_tb = sys.exc_info()
from future.utils import raise_from six.reraise(e_type, 'Evaluation of %s failed: %s' % (function_name,
raise_from(type(e)('Evaluation of %s failed: %s' % (function_name, e)), e_value),
e) e_tb)
except ImportError:
if self.verbose:
traceback.print_exc()
raise type(e)('Evaluation of %s failed: %s' % (function_name, e))
if sink: if sink:
elapsed_time = time_time() - start_time elapsed_time = time_time() - start_time

Loading…
Cancel
Save