Make gensyscalls.py compatible with Python 3.
Test: Fixes bp2build; bazel build //bionic/...
Change-Id: I6ab66e99935b962f1ff99e478c0f55188f31b495
diff --git a/libc/tools/gensyscalls.py b/libc/tools/gensyscalls.py
index d8d4302..b4e093c 100755
--- a/libc/tools/gensyscalls.py
+++ b/libc/tools/gensyscalls.py
@@ -434,13 +434,13 @@
for syscall in parser.syscalls:
syscall["__NR_name"] = make__NR_name(syscall["name"])
- if syscall.has_key("arm"):
+ if "arm" in syscall:
syscall["asm-arm"] = add_footer(32, arm_eabi_genstub(syscall), syscall)
- if syscall.has_key("arm64"):
+ if "arm64" in syscall:
syscall["asm-arm64"] = add_footer(64, arm64_genstub(syscall), syscall)
- if syscall.has_key("x86"):
+ if "x86" in syscall:
if syscall["socketcall_id"] >= 0:
syscall["asm-x86"] = add_footer(32, x86_genstub_socketcall(syscall), syscall)
else:
@@ -449,13 +449,13 @@
E("socketcall_id for dispatch syscalls is only supported for x86 in '%s'" % t)
return
- if syscall.has_key("x86_64"):
+ if "x86_64" in syscall:
syscall["asm-x86_64"] = add_footer(64, x86_64_genstub(syscall), syscall)
print("/* Generated by gensyscalls.py. Do not edit. */\n")
print("#include <private/bionic_asm.h>\n")
for syscall in parser.syscalls:
- if syscall.has_key("asm-%s" % arch):
+ if ("asm-%s" % arch) in syscall:
print(syscall["asm-%s" % arch])
if arch == 'arm64':