From 353acf4aae63cead7c02e214a39a768dd525bc28 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Mon, 23 Jul 2018 18:10:15 -0700 Subject: [PATCH] gen_syscalls.py: do not output data to stdout There's no particularly good reason to have one kind of output from this script to be sent to stdout instead of a filename specified by parameter, and it makes it annoying to add debug print() statements. Signed-off-by: Andrew Boie --- CMakeLists.txt | 2 +- scripts/gen_syscalls.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57ae22df985..c721de0def1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -455,7 +455,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h} --json-file ${syscalls_json} # Read this file --base-output include/generated/syscalls # Write to this dir --syscall-dispatch include/generated/syscall_dispatch.c # Write this file - > ${syscall_list_h} # Write stdout to this file + --syscall-list ${syscall_list_h} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${syscalls_json} ) diff --git a/scripts/gen_syscalls.py b/scripts/gen_syscalls.py index 8b74a1d934e..b1a9f0ec939 100755 --- a/scripts/gen_syscalls.py +++ b/scripts/gen_syscalls.py @@ -168,6 +168,8 @@ def parse_args(): help="Read syscall information from json file") parser.add_argument("-d", "--syscall-dispatch", required=True, help="output C system call dispatch table file") + parser.add_argument("-l", "--syscall-list", required=True, + help="output C system call list header") parser.add_argument("-o", "--base-output", required=True, help="Base output directory for syscall macro headers") args = parser.parse_args() @@ -206,7 +208,8 @@ def main(): ids.sort() ids.extend(["K_SYSCALL_BAD", "K_SYSCALL_LIMIT"]) handler_defines = "".join([handler_template % name for name in handlers]) - sys.stdout.write(list_template % (",\n\t".join(ids), handler_defines)) + with open(args.syscall_list, "w") as fp: + fp.write(list_template % (",\n\t".join(ids), handler_defines)) os.makedirs(args.base_output, exist_ok=True) for fn, invo_list in invocations.items():