Skip to content

Commit

Permalink
Fix last python3 issues.
Browse files Browse the repository at this point in the history
Includes pointing to the python3 version of the clang bindings.

Also, remove stale .gitignore line.

Test: Ran bionic/libc/kernel/tools/update_all.py and verified
Test: the files generated the same exact way.
Change-Id: I4eb9dd7382bca013f70d921b6ef48c7e7478615a
  • Loading branch information
cferris1000 committed Apr 21, 2021
1 parent fae6ff2 commit a2142d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.pyc
*.*~
libc/kernel/original
10 changes: 5 additions & 5 deletions libc/kernel/tools/cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
utils.panic('ANDROID_BUILD_TOP not set.\n')

# Set up the env vars for libclang.
site.addsitedir(os.path.join(top, 'external/clang/bindings/python'))
site.addsitedir(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/python3/site-packages/'))

import clang.cindex
from clang.cindex import conf
Expand All @@ -28,7 +28,7 @@

# Set up LD_LIBRARY_PATH to include libclang.so, libLLVM.so, and etc.
# Note that setting LD_LIBRARY_PATH with os.putenv() sometimes doesn't help.
clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/sdk/tools/linux/lib64/libclang_android.so'))
clang.cindex.Config.set_library_file(os.path.join(top, 'prebuilts/clang/host/linux-x86/clang-stable/lib64/libclang.so'))

from defaults import *

Expand Down Expand Up @@ -254,7 +254,7 @@ def _getTokensWithCursors(self):
token_group = TokenGroup(self._tu, tokens_memory, tokens_count)

tokens = []
for i in xrange(0, count):
for i in range(0, count):
token = Token(self._tu, token_group,
int_data=tokens_array[i].int_data,
ptr_data=tokens_array[i].ptr_data,
Expand Down Expand Up @@ -722,7 +722,7 @@ def optimize_node(self, e, macros=None):

if op == "defined":
op, name = e
if macros.has_key(name):
if name in macros:
if macros[name] == kCppUndefinedMacro:
return ("int", 0)
else:
Expand All @@ -739,7 +739,7 @@ def optimize_node(self, e, macros=None):

elif op == "ident":
op, name = e
if macros.has_key(name):
if name in macros:
try:
value = int(macros[name])
expanded = ("int", value)
Expand Down

0 comments on commit a2142d2

Please sign in to comment.