Skip to content

Fix issues with Python3 scripting

Tony Jones linux-perf-users lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest6 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6perf script python: Add trace_context extension module to sys,modulestools/perf/util/scripting-engines/trace-event-python.c+4 -20 replies
2/6perf script python: Use PyBytes for attr in trace-event-pythontools/perf/util/scripting-engines/trace-event-python.c+1 -20 replies
3/6perf script python: remove explicit shebang from setup.pytools/perf/util/setup.py+0 -20 replies
4/6perf script python: remove explicit shebang from tests/attr.ctools/perf/tests/attr.py+0 -10 replies
5/6perf script python: remove explicit shebang from Python scriptstools/perf/Makefile.perf tools/perf/scripts/python/exported-sql-viewer.py tools/perf/scripts/python/sched-migration.py +1 more+2 -60 replies
6/6perf script python: add Python3 support to tests/attr.pytools/perf/tests/attr.py+19 -130 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJiri Olsa
SeriesA-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/6] Fix issues with Python3 scripting

Seeteena posted, earlier this week, some patches to add Python3 support to scripts/python/*.py. Unfortunately there were some issues with these patches (such as: https://lkml.org/lkml/2019/1/17/351)

Since I already had a tested set of patches in openSUSE:Factory and SLE15-SP1 and was about to submit them, Seeteena and I that agreed I should post my patches not involving scripts/python/*.py and Seeteena will later resubmit the patches for scripts/python/*.py incorporating my review feedback under a joint signed-off-by.

It should be noted that the use of "from __future__ import print_function" (see: https://lkml.org/lkml/2019/1/16/641) and "except as" (see change to:
tests/attr.py) implies Python2 >= 2.6 as the necessary support has not been backported to prior versions. I am not sure if it's worth detecting <2.6 at build time or whether it's sufficiently old as to be a non-issue?

The shebang changes were driven mostly by our build process as it scans all files within an rpm and the shebangs would result in a rpm requires on the python2 binary when BuildRequires was python3-devel. I think they make sense to apply upstream but understand totally if it's prefered we keep them local.

These changes have been tested with PYTHON=python2 (v2.7) and PYTHON=python3 (v3.6) on latest openSUSE Tumbleweed. I did notice that test #18 "'import perf' in python" is failing on my system without these changes. I'll look at it further but didn't want to hold up Seeteena's resubmit.

Tony Jones (6):
perf script python: Add trace_context extension module to sys,modules perf script python: Use PyBytes for attr in trace-event-python perf script python: remove explicit shebang from setup.py perf script python: remove explicit shebang from tests/attr.c perf script python: remove explicit shebang from Python scripts perf script python: add Python3 support to tests/attr.py

 tools/perf/Makefile.perf                      |  4 +--
 .../scripts/python/exported-sql-viewer.py     |  1 -
 tools/perf/scripts/python/sched-migration.py  |  2 --
 tools/perf/scripts/python/stat-cpi.py         |  1 -
 tools/perf/tests/attr.py                      | 33 +++++++++++--------
 .../scripting-engines/trace-event-python.c    |  9 ++---
 tools/perf/util/setup.py                      |  2 --
 7 files changed, 26 insertions(+), 26 deletions(-)
Signature · 1 line
2.20.1