Skip to content

Commit a2142d2

Browse files
committed
Fix last python3 issues.
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
1 parent fae6ff2 commit a2142d2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
*.pyc
22
*.*~
3-
libc/kernel/original

libc/kernel/tools/cpp.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
utils.panic('ANDROID_BUILD_TOP not set.\n')
1515

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

1919
import clang.cindex
2020
from clang.cindex import conf
@@ -28,7 +28,7 @@
2828

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

3333
from defaults import *
3434

@@ -254,7 +254,7 @@ def _getTokensWithCursors(self):
254254
token_group = TokenGroup(self._tu, tokens_memory, tokens_count)
255255

256256
tokens = []
257-
for i in xrange(0, count):
257+
for i in range(0, count):
258258
token = Token(self._tu, token_group,
259259
int_data=tokens_array[i].int_data,
260260
ptr_data=tokens_array[i].ptr_data,
@@ -722,7 +722,7 @@ def optimize_node(self, e, macros=None):
722722

723723
if op == "defined":
724724
op, name = e
725-
if macros.has_key(name):
725+
if name in macros:
726726
if macros[name] == kCppUndefinedMacro:
727727
return ("int", 0)
728728
else:
@@ -739,7 +739,7 @@ def optimize_node(self, e, macros=None):
739739

740740
elif op == "ident":
741741
op, name = e
742-
if macros.has_key(name):
742+
if name in macros:
743743
try:
744744
value = int(macros[name])
745745
expanded = ("int", value)

0 commit comments

Comments
 (0)