Skip to content

Commit

Permalink
[Perf] Python 3 migration: Fix -v option
Browse files Browse the repository at this point in the history
Some Python scripts check the -v option with "options.verbosity >= 2".
When -v is not specified, options.verbosity equals None. With Python 2,
"None >= 2" is allowed and returns False, but in Python 3 it throws a
TypeError. This is fixed by setting options.verbosity to default to 0.

Bug: 1199156
Change-Id: Ia9c360388b787e5fac65bc59ab6669fea86d99d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2838549
Auto-Submit: John Chen <johnchen@chromium.org>
Commit-Queue: Wenbin Zhang <wenbinzhang@google.com>
Reviewed-by: Wenbin Zhang <wenbinzhang@google.com>
Cr-Commit-Position: refs/heads/master@{#874356}
  • Loading branch information
JohnChen0 authored and Chromium LUCI CQ committed Apr 20, 2021
1 parent 20e4cbc commit 29ebe9c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tools/perf/core/find_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class FindDependenciesCommand(command_line.OptparseCommand):
@classmethod
def AddCommandLineArgs(cls, parser, _):
parser.add_option(
'-v', '--verbose', action='count', dest='verbosity',
'-v', '--verbose', action='count', dest='verbosity', default=0,
help='Increase verbosity level (repeat as needed).')

parser.add_option(
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/core/results_processor/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def ArgumentParser(standalone=False):
all_output_formats.append('none')
parser, group = _CreateTopLevelParser(standalone)
parser.add_argument(
'-v', '--verbose', action='count', dest='verbosity',
'-v', '--verbose', action='count', dest='verbosity', default=0,
help='Increase verbosity level (repeat as needed)')
group.add_argument(
'--output-format', action='append', dest='output_formats',
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/fetch_benchmark_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def main(args):
parser.add_argument('--output-deps',
help=('Output dependencies to a json file'))
parser.add_argument(
'-v', '--verbose', action='count', dest='verbosity',
'-v', '--verbose', action='count', dest='verbosity', default=0,
help='Increase verbosity level (repeat as needed)')

options = parser.parse_args(args)
Expand Down

0 comments on commit 29ebe9c

Please sign in to comment.