Skip to content

Commit daf8fa0

Browse files
segevfinercclauss
andauthored
Fix compile_commands.json output location when generator_output is None (#239)
* Fix compile_commands.json output location when generator_output is None Followup to #238 * Fix lint * Update pylib/gyp/generator/compile_commands_json.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update pylib/gyp/generator/compile_commands_json.py Co-authored-by: Christian Clauss <cclauss@me.com> --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent de0e1c9 commit daf8fa0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pylib/gyp/generator/compile_commands_json.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ def GenerateOutput(target_list, target_dicts, data, params):
108108
cwd = os.path.dirname(build_file)
109109
AddCommandsForTarget(cwd, target, params, per_config_commands)
110110

111+
output_dir = None
111112
try:
112-
# generator_output can be `None` on Windows machines
113-
output_dir = params["options"].generator_output or os.getcwd()
114-
except (AttributeError, KeyError):
115-
output_dir = params["generator_flags"].get("output_dir", "out")
113+
# generator_output can be `None` on Windows machines, or even not
114+
# defined in other cases
115+
output_dir = params.get("options").generator_output
116+
except AttributeError:
117+
pass
118+
output_dir = output_dir or params["generator_flags"].get("output_dir", "out")
116119
for configuration_name, commands in per_config_commands.items():
117120
filename = os.path.join(output_dir, configuration_name, "compile_commands.json")
118121
gyp.common.EnsureDirExists(filename)

0 commit comments

Comments
 (0)