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

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

Loading…
Cancel
Save