summaryrefslogtreecommitdiff
path: root/libc/kernel/tools/kernel.py
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2021-04-19 13:50:16 -0700
committerChristopher Ferris <cferris@google.com>2021-04-19 17:02:38 -0700
commitac7ec11473f9573750d429f066adda1c2b928212 (patch)
tree68cea0125493a8d944a8cae247f20276391acfe3 /libc/kernel/tools/kernel.py
parentb82fcdaf36d6a48e56c9849f06bb5f2bc019a0b2 (diff)
Update for python3.
This fixes all of the problems with our kernel scripts, but not the clang python script problems. I also removed the updateGitFiles function since that code was just silently failing any way. I replaced all calls with updateFiles. Test: Ran script using python2 to verify it still works. Test: Run script in python3 verifying that it starts to run. Change-Id: I223a31a8324c59e6bc4067f48a6110361b3e26e8
Diffstat (limited to 'libc/kernel/tools/kernel.py')
-rw-r--r--libc/kernel/tools/kernel.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/libc/kernel/tools/kernel.py b/libc/kernel/tools/kernel.py
index b6418a8c6..6046911e9 100644
--- a/libc/kernel/tools/kernel.py
+++ b/libc/kernel/tools/kernel.py
@@ -4,7 +4,7 @@
# list here the macros that you know are always defined/undefined when including
# the kernel headers
#
-import sys, cpp, re, os.path, string, time
+import sys, cpp, re, os.path, time
from defaults import *
verboseSearch = 0
@@ -56,7 +56,7 @@ class HeaderScanner:
# <mtd/*>
#
re_combined_str=\
- r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % string.join(kernel_dirs,"|")
+ r"^.*<((%s)/[\d\w_\+\.\-/]*)>.*$" % "|".join(kernel_dirs)
re_combined = re.compile(re_combined_str)
@@ -100,7 +100,7 @@ class HeaderScanner:
if from_file:
if verboseFind:
- print "=== %s uses %s" % (from_file, header)
+ print("=== %s uses %s" % (from_file, header))
self.headers[header].add(from_file)
def parseFile(self, path, arch=None, kernel_root=None):
@@ -114,7 +114,7 @@ class HeaderScanner:
try:
f = open(path, "rt")
except:
- print "!!! can't read '%s'" % path
+ print("!!! can't read '%s'" % path)
return
hasIncludes = False
@@ -125,10 +125,10 @@ class HeaderScanner:
break
if not hasIncludes:
- if verboseSearch: print "::: " + path
+ if verboseSearch: print("::: " + path)
return
- if verboseSearch: print "*** " + path
+ if verboseSearch: print("*** " + path)
list = cpp.BlockParser().parseFile(path)
if list:
@@ -205,7 +205,6 @@ class KernelHeaderFinder:
if len(kernel_root) > 0 and kernel_root[-1] != "/":
kernel_root += "/"
- #print "using kernel_root %s" % kernel_root
self.archs = archs
self.searched = set(headers)
self.kernel_root = kernel_root
@@ -301,7 +300,7 @@ class ConfigParser:
self.duplicates = False
def parseLine(self,line):
- line = string.strip(line)
+ line = line.strip(line)
# skip empty and comment lines
if len(line) == 0 or line[0] == "#":