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>
This commit is contained in:
Bruce Dawson
2024-10-04 16:14:57 +00:00
committed by LUCI CQ
parent ec0f28d1b4
commit 9157dd872e
2 changed files with 11 additions and 17 deletions

View File

@@ -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