Remove extraneous Python version from presubmit warnings

When a presubmit warning is triggered this message is printed:

    There were Python 3 presubmit warnings.

The Python version information was useful when we were transitioning
our presubmits from Python 2 to Python 3, but that transition is long
finished, and now that information is just noise.

This change deletes the excess information.

Change-Id: I4e43e1c9daf36daaaa9430d76ad557c800cf962b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5907924
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
changes/24/5907924/3
Bruce Dawson 9 months ago committed by LUCI CQ
parent ec0f28d1b4
commit 9157dd872e

@ -1611,8 +1611,7 @@ def DoPostUploadExecuter(change, gerrit_obj, verbose):
gerrit_obj: The GerritAccessor object.
verbose: Prints debug info.
"""
python_version = 'Python %s' % sys.version_info.major
sys.stdout.write('Running %s post upload checks ...\n' % python_version)
sys.stdout.write('Running post upload checks ...\n')
presubmit_files = ListRelevantPresubmitFiles(
change.LocalPaths() + change.LocalSubmodules(), change.RepositoryRoot())
if not presubmit_files and verbose:
@ -1923,13 +1922,10 @@ def DoPresubmitChecks(change,
1 if presubmit checks failed or 0 otherwise.
"""
with setup_environ({'PYTHONDONTWRITEBYTECODE': '1'}):
python_version = 'Python %s' % sys.version_info.major
if committing:
sys.stdout.write('Running %s presubmit commit checks ...\n' %
python_version)
sys.stdout.write('Running presubmit commit checks ...\n')
else:
sys.stdout.write('Running %s presubmit upload checks ...\n' %
python_version)
sys.stdout.write('Running presubmit upload checks ...\n')
start_time = time_time()
presubmit_files = ListRelevantPresubmitFiles(
change.AbsoluteLocalPaths() + change.AbsoluteLocalSubmodules(),
@ -1987,18 +1983,16 @@ def DoPresubmitChecks(change,
total_time)
if not should_prompt and not presubmits_failed:
sys.stdout.write('%s presubmit checks passed.\n\n' % python_version)
sys.stdout.write('presubmit checks passed.\n\n')
elif should_prompt and not presubmits_failed:
sys.stdout.write('There were %s presubmit warnings. ' %
python_version)
sys.stdout.write('There were presubmit warnings. ')
if may_prompt:
presubmits_failed = not prompt_should_continue(
'Are you sure you wish to continue? (y/N): ')
else:
sys.stdout.write('\n')
else:
sys.stdout.write('There were %s presubmit errors.\n' %
python_version)
sys.stdout.write('There were presubmit errors.\n')
if json_output:
# Write the presubmit results to json output

@ -43,7 +43,7 @@ import subprocess2 as subprocess
# Shortcut.
presubmit_canned_checks = presubmit.presubmit_canned_checks
RUNNING_PY_CHECKS_TEXT = ('Running Python 3 presubmit upload checks ...\n')
RUNNING_PY_CHECKS_TEXT = ('Running presubmit upload checks ...\n')
# Access to a protected member XXX of a client class
# pylint: disable=protected-access
@ -621,7 +621,7 @@ class PresubmitUnittest(PresubmitTestsBase):
presubmit.DoPostUploadExecuter(change=change,
gerrit_obj=None,
verbose=False))
expected = (r'Running Python 3 post upload checks \.\.\.\n')
expected = (r'Running post upload checks \.\.\.\n')
self.assertRegexpMatches(sys.stdout.getvalue(), expected)
def testDoPostUploadExecuterWarning(self):
@ -636,7 +636,7 @@ class PresubmitUnittest(PresubmitTestsBase):
gerrit_obj=None,
verbose=False))
self.assertEqual(
'Running Python 3 post upload checks ...\n'
'Running post upload checks ...\n'
'\n'
'** Post Upload Hook Messages **\n'
'??\n'
@ -654,7 +654,7 @@ class PresubmitUnittest(PresubmitTestsBase):
gerrit_obj=None,
verbose=False))
expected = ('Running Python 3 post upload checks \.\.\.\n'
expected = ('Running post upload checks \.\.\.\n'
'\n'
'\*\* Post Upload Hook Messages \*\*\n'
'!!\n'
@ -894,7 +894,7 @@ def CheckChangeOnCommit(input_api, output_api):
RUNNING_PY_CHECKS_TEXT + 'Warning, no PRESUBMIT.py found.\n'
'Running default presubmit script.\n'
'** Presubmit ERRORS: 1 **\n!!\n\n'
'There were Python 3 presubmit errors.\n'
'There were presubmit errors.\n'
'Was the presubmit check useful? If not, run "git cl presubmit -v"\n'
'to figure out which PRESUBMIT.py was run, then run "git blame"\n'
'on the file to figure out who to ask for help.\n')

Loading…
Cancel
Save