Skip to content

Commit

Permalink
Fix compile_commands.json output location when generator_output is None
Browse files Browse the repository at this point in the history
Followup to #238
  • Loading branch information
segevfiner committed Apr 1, 2024
1 parent 7b20b46 commit df61b9b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pylib/gyp/generator/compile_commands_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ def GenerateOutput(target_list, target_dicts, data, params):
cwd = os.path.dirname(build_file)
AddCommandsForTarget(cwd, target, params, per_config_commands)

output_dir = None
try:
# generator_output can be `None` on Windows machines
output_dir = params["options"].generator_output or os.getcwd()
# generator_output can be `None` on Windows machines, or even not defined in other cases

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (macos-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.8)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.9)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.10)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.11)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)

Check failure on line 113 in pylib/gyp/generator/compile_commands_json.py

View workflow job for this annotation

GitHub Actions / Python_tests (ubuntu-latest, 3.12)

Ruff (E501)

pylib/gyp/generator/compile_commands_json.py:113:89: E501 Line too long (96 > 88)
output_dir = params["options"].generator_output
except (AttributeError, KeyError):
pass
if output_dir is None:
output_dir = params["generator_flags"].get("output_dir", "out")
for configuration_name, commands in per_config_commands.items():
filename = os.path.join(output_dir, configuration_name, "compile_commands.json")
Expand Down

0 comments on commit df61b9b

Please sign in to comment.