From 2393de29ec6b3afbc4086b73bc567ac7a0b525da Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Thu, 29 Jul 2021 10:16:59 -0500 Subject: [PATCH] SERVER-58948 update idl_tool to support generated idl files --- site_scons/site_tools/idl_tool.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/site_scons/site_tools/idl_tool.py b/site_scons/site_tools/idl_tool.py index ba954203be6..04b0db0cd62 100755 --- a/site_scons/site_tools/idl_tool.py +++ b/site_scons/site_tools/idl_tool.py @@ -75,11 +75,15 @@ def idl_scanner(node, env, path): for i in range(len(flags)): if flags[i] == "--include": include_paths.append(flags[i + 1]) + resolver = idlc.CompilerImportResolver(include_paths) - with open(str(node), encoding="utf-8") as file_stream: - parsed_doc = idlc.parser.parse( - file_stream, str(node), idlc.CompilerImportResolver(include_paths) - ) + try: + with open(str(node), encoding="utf-8") as file_stream: + parsed_doc = idlc.parser.parse( + file_stream, str(node), resolver + ) + except OSError: + return nodes_deps_list if not parsed_doc.errors and parsed_doc.spec.imports is not None: nodes_deps_list.extend(