linux4.14: patch to use python3

This commit is contained in:
classabbyamp 2023-09-28 01:22:31 -04:00
parent bd14202461
commit 8b35257c2c
No known key found for this signature in database
GPG key ID: 6BE0755918A4C7F5
2 changed files with 82 additions and 1 deletions

View file

@ -0,0 +1,81 @@
--- a/scripts/show_delta
+++ b/scripts/show_delta
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# show_deltas: Read list of printk messages instrumented with
# time data, and format with time deltas.
@@ -13,7 +13,7 @@
import string
def usage():
- print ("""usage: show_delta [<options>] <filename>
+ print("""usage: show_delta [<options>] <filename>
This program parses the output from a set of printk message lines which
have time data prefixed because the CONFIG_PRINTK_TIME option is set, or
@@ -46,8 +46,8 @@
raise ValueError
# split on closing bracket
- (time_str, rest) = string.split(line[1:],']',1)
- time = string.atof(time_str)
+ (time_str, rest) = line[1:].split(']',1)
+ time = float(time_str)
#print "time=", time
return (time, rest)
@@ -94,11 +94,11 @@
try:
lines = open(filein,"r").readlines()
except:
- print ("Problem opening file: %s" % filein)
+ print("Problem opening file: %s" % filein)
sys.exit(1)
if base_str:
- print ('base= "%s"' % base_str)
+ print('base= "%s"' % base_str)
# assume a numeric base. If that fails, try searching
# for a matching line.
try:
@@ -111,18 +111,18 @@
(time, rest) = get_time(line)
except:
continue
- if string.find(rest, base_str)==1:
+ if rest.find(base_str)==1:
base_time = time
found = 1
# stop at first match
break
if not found:
- print ('Couldn\'t find line matching base pattern "%s"' % base_str)
+ print('Couldn\'t find line matching base pattern "%s"' % base_str)
sys.exit(1)
else:
base_time = 0.0
for line in lines:
- print (convert_line(line, base_time),)
+ print(convert_line(line, base_time))
main()
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
@@ -123,7 +123,7 @@
tree = tree.getParent(caller)
tree = tree.calls(callee, calltime)
- print CallTree.ROOT
+ print(CallTree.ROOT)
if __name__ == "__main__":
main()

View file

@ -11,7 +11,7 @@ distfiles="https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${version%.*}.tar.
checksum="f81d59477e90a130857ce18dc02f4fbe5725854911db1e7ba770c7cd350f96a7
941c34f4a5c438bbb1b0ab5ee84b8075acf9c4d3843697259e980def08c6a839"
skip_extraction="patch-${version}.xz"
python_version=2 #unverified
python_version=3
nodebug=yes # -dbg package is generated below manually
nostrip=yes