diff options
author | Christopher Ferris <cferris@google.com> | 2021-04-19 13:50:16 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2021-04-19 17:02:38 -0700 |
commit | ac7ec11473f9573750d429f066adda1c2b928212 (patch) | |
tree | 68cea0125493a8d944a8cae247f20276391acfe3 /libc/kernel/tools/cpp.py | |
parent | b82fcdaf36d6a48e56c9849f06bb5f2bc019a0b2 (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/cpp.py')
-rwxr-xr-x | libc/kernel/tools/cpp.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libc/kernel/tools/cpp.py b/libc/kernel/tools/cpp.py index 9f5345350..bfa1797cb 100755 --- a/libc/kernel/tools/cpp.py +++ b/libc/kernel/tools/cpp.py @@ -394,10 +394,10 @@ class CppExpr(object): self._index = 0 if debugCppExpr: - print "CppExpr: trying to parse %s" % repr(tokens) + print("CppExpr: trying to parse %s" % repr(tokens)) self.expr = self.parseExpression(0) if debugCppExpr: - print "CppExpr: got " + repr(self.expr) + print("CppExpr: got " + repr(self.expr)) if self._index != self._num_tokens: self.throw(BadExpectedToken, "crap at end of input (%d != %d): %s" % (self._index, self._num_tokens, repr(tokens))) @@ -405,9 +405,9 @@ class CppExpr(object): def throw(self, exception, msg): if self._index < self._num_tokens: tok = self.tokens[self._index] - print "%d:%d: %s" % (tok.location.line, tok.location.column, msg) + print("%d:%d: %s" % (tok.location.line, tok.location.column, msg)) else: - print "EOF: %s" % msg + print("EOF: %s" % msg) raise exception(msg) def expectId(self, id): @@ -1179,11 +1179,11 @@ class BlockList(object): def dump(self): """Dump all the blocks in current BlockList.""" - print '##### BEGIN #####' + print('##### BEGIN #####') for i, b in enumerate(self.blocks): - print '### BLOCK %d ###' % i - print b - print '##### END #####' + print('### BLOCK %d ###' % i) + print(b) + print('##### END #####') def optimizeIf01(self): """Remove the code between #if 0 .. #endif in a BlockList.""" @@ -1510,7 +1510,7 @@ class BlockParser(object): while i < len(tokens) and tokens[i].location in extent: t = tokens[i] if debugBlockParser: - print ' ' * 2, t.id, t.kind, t.cursor.kind + print(' ' * 2, t.id, t.kind, t.cursor.kind) if (detect_change and t.cursor.extent != extent and t.cursor.kind == CursorKind.PREPROCESSING_DIRECTIVE): break |