Commit 09e64b49 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

Make presubmit scripts not inherit the executor script's context

This caused compatibility issues, because the executor script (presubmit_support.py) asks the parser for Python 3-style print functions and inherits this to the presubmit scripts it runs, of which some still use the old style statements.

Bug: 961783
Change-Id: I545d778991a53f484bce6c7e29089e0484dc19ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1605917
Auto-Submit: Raul Tambre <raul@tambre.ee>
Reviewed-by: 's avatarRobbie Iannucci <iannucci@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
parent 6a9b00e4
......@@ -1218,7 +1218,8 @@ class GetTryMastersExecuter(object):
"""
context = {}
try:
exec script_text in context
exec(compile(script_text, 'PRESUBMIT.py', 'exec', dont_inherit=True),
context)
except Exception, e:
raise PresubmitFailure('"%s" had an exception.\n%s'
% (presubmit_path, e))
......@@ -1249,7 +1250,8 @@ class GetPostUploadExecuter(object):
"""
context = {}
try:
exec script_text in context
exec(compile(script_text, 'PRESUBMIT.py', 'exec', dont_inherit=True),
context)
except Exception, e:
raise PresubmitFailure('"%s" had an exception.\n%s'
% (presubmit_path, e))
......@@ -1414,7 +1416,8 @@ class PresubmitExecuter(object):
output_api = OutputApi(self.committing)
context = {}
try:
exec script_text in context
exec(compile(script_text, 'PRESUBMIT.py', 'exec', dont_inherit=True),
context)
except Exception, e:
raise PresubmitFailure('"%s" had an exception.\n%s' % (presubmit_path, e))
......
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