lkml.org 
[lkml]   [2019]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] perf scripts python: Add Python 3 support to mem-phys-addr.py
From
Date
I have added


On 01/16/2019 10:02 PM, Jonathan Corbet wrote:
> On Wed, 16 Jan 2019 21:53:36 +0530
> Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com> wrote:
>
>> Support both Python 2 and Python 3 in mem-phys-addr.py. ``print`` is now a
>> function rather than a statement. This should have no functional change.
>>
>> Fix lambda syntax error.
> So, I just picked one of these at random....
>
>> Signed-off-by: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
>> Reviewed-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
>> ---
>> tools/perf/scripts/python/mem-phys-addr.py | 12 ++++++------
>> 1 file changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/tools/perf/scripts/python/mem-phys-addr.py b/tools/perf/scripts/python/mem-phys-addr.py
>> index ebee2c5..52fe9bd 100644
>> --- a/tools/perf/scripts/python/mem-phys-addr.py
>> +++ b/tools/perf/scripts/python/mem-phys-addr.py
>> @@ -38,14 +38,14 @@ def parse_iomem():
>> pmem.append(long(m[1], 16))
>>
>> def print_memory_type():
>> - print "Event: %s" % (event_name)
>> - print "%-40s %10s %10s\n" % ("Memory type", "count", "percentage"),
>> - print "%-40s %10s %10s\n" % ("----------------------------------------", \
>> - "-----------", "-----------"),
>> + print("Event: %s" % (event_name))
>> + print("%-40s %10s %10s\n" % ("Memory type", "count", "percentage")),
>> + print("%-40s %10s %10s\n" % ("----------------------------------------", \
>> + "-----------", "-----------")),
> You have not added "from __future__ import print_function", so you're
> relying on a Python 2 parsing oddity to make this work. If anybody ever
> adds a second parameter, things will break. I think that if you really
> want to support both versions (which seems like the right goal) you should
> add the import and do it properly.
>
> Thanks,
>
> jon
>

Thanks Jonathan. I have added "from __future__ import print_function"
for all the scripts.

\
 
 \ /
  Last update: 2019-01-17 10:48    [W:0.083 / U:0.720 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site