From 9f9bb3be46983f6af881f7dcdd9ced745df2dd72 Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Sat, 30 Mar 2024 22:15:40 +0300 Subject: [PATCH 1/3] fix: compile_commands.json for MSVC generator_output is None when trying to use that in Node.js via vcbuild.bat --- pylib/gyp/generator/compile_commands_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylib/gyp/generator/compile_commands_json.py b/pylib/gyp/generator/compile_commands_json.py index 0ffa3bb5..37df176b 100644 --- a/pylib/gyp/generator/compile_commands_json.py +++ b/pylib/gyp/generator/compile_commands_json.py @@ -109,7 +109,7 @@ def GenerateOutput(target_list, target_dicts, data, params): AddCommandsForTarget(cwd, target, params, per_config_commands) try: - output_dir = params["options"].generator_output + output_dir = params["options"].generator_output or os.getcwd() except (AttributeError, KeyError): output_dir = params["generator_flags"].get("output_dir", "out") for configuration_name, commands in per_config_commands.items(): From 20cb283a36d6f8644e3183f0819d57698447e57b Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Sat, 30 Mar 2024 22:43:01 +0300 Subject: [PATCH 2/3] Review fix --- pylib/gyp/generator/compile_commands_json.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pylib/gyp/generator/compile_commands_json.py b/pylib/gyp/generator/compile_commands_json.py index 37df176b..ef763901 100644 --- a/pylib/gyp/generator/compile_commands_json.py +++ b/pylib/gyp/generator/compile_commands_json.py @@ -109,6 +109,7 @@ def GenerateOutput(target_list, target_dicts, data, params): AddCommandsForTarget(cwd, target, params, per_config_commands) try: + # generator_output can be `None`, which means the current working directory output_dir = params["options"].generator_output or os.getcwd() except (AttributeError, KeyError): output_dir = params["generator_flags"].get("output_dir", "out") From bb6b7752bd6994ed09be95c9bfe9880a81219aba Mon Sep 17 00:00:00 2001 From: Segev Finer Date: Sat, 30 Mar 2024 22:52:59 +0300 Subject: [PATCH 3/3] Update pylib/gyp/generator/compile_commands_json.py Co-authored-by: Yagiz Nizipli --- pylib/gyp/generator/compile_commands_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylib/gyp/generator/compile_commands_json.py b/pylib/gyp/generator/compile_commands_json.py index ef763901..a5594d13 100644 --- a/pylib/gyp/generator/compile_commands_json.py +++ b/pylib/gyp/generator/compile_commands_json.py @@ -109,7 +109,7 @@ def GenerateOutput(target_list, target_dicts, data, params): AddCommandsForTarget(cwd, target, params, per_config_commands) try: - # generator_output can be `None`, which means the current working directory + # generator_output can be `None` on Windows machines output_dir = params["options"].generator_output or os.getcwd() except (AttributeError, KeyError): output_dir = params["generator_flags"].get("output_dir", "out")