Re: [PATCH 3/6] tools: perf: tools: perf: exported-sql-viewer: drop support for Python 2

From: Adrian Hunter
Date: Thu Jan 30 2025 - 02:00:56 EST


On 29/01/25 19:39, Mauro Carvalho Chehab wrote:
> As stated at process/changes.rsy doc, the current minimal Python
> version is 3.x, so drop support for EOL python 2.x.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
> ---
> tools/perf/scripts/python/exported-sql-viewer.py | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/scripts/python/exported-sql-viewer.py b/tools/perf/scripts/python/exported-sql-viewer.py
> index 121cf61ba1b3..b096592fd35f 100755
> --- a/tools/perf/scripts/python/exported-sql-viewer.py
> +++ b/tools/perf/scripts/python/exported-sql-viewer.py
> @@ -3939,9 +3939,8 @@ def CopyTreeCellsToClipboard(view, as_csv=False, with_hdr=False):
> indent_str = " " * indent_sz
>
> expanded_mark_sz = 2
> - if sys.version_info[0] == 3:
> - expanded_mark = "\u25BC "
> - not_expanded_mark = "\u25B6 "
> + expanded_mark = "\u25BC "
> + not_expanded_mark = "\u25B6 "

You removed the 'if' but left the 'else'.

The white is messed up.

So presumably not tested at all:

python3 tools/perf/scripts/python/exported-sql-viewer.py
File "/home/user/git/review2/tools/perf/scripts/python/exported-sql-viewer.py", line 3942
expanded_mark = "\u25BC "
^
IndentationError: unindent does not match any outer indentation level

Posting untested patches, especially tidy-ups,
should really be discouraged.

There are many other obvious python2 things in this
file that have not been addressed. When asked, AI
listed 10 things.

> else:
> expanded_mark = unicode(chr(0xE2) + chr(0x96) + chr(0xBC) + " ", "utf-8")
> not_expanded_mark = unicode(chr(0xE2) + chr(0x96) + chr(0xB6) + " ", "utf-8")