From ccf9961755d3114078aeea206600166437976cd1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 13 Jul 2024 03:32:09 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- refresh.template.py | 2 +- refresh_compile_commands.bzl | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/refresh.template.py b/refresh.template.py index 2e57374..e28c260 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -1433,7 +1433,7 @@ def main(): There should be actionable warnings, above, that led to this.""") sys.exit(1) - + if not (root_dir := pathlib.Path({out_dir})).exists(): root_dir.mkdir(parents=True) diff --git a/refresh_compile_commands.bzl b/refresh_compile_commands.bzl index 1bb5fb9..47cb821 100644 --- a/refresh_compile_commands.bzl +++ b/refresh_compile_commands.bzl @@ -91,7 +91,7 @@ def refresh_compile_commands( exclude_headers = None, exclude_external_sources = False, **kwargs): # For the other common attributes. Tags, compatible_with, etc. https://docs.bazel.build/versions/main/be/common-definitions.html#common-attributes. - + # Given `targets` that may be absent, or be a single string target: # targets = "//:some_target" # @@ -106,7 +106,7 @@ def refresh_compile_commands( # "//:some_target": "--flag ...", # "//:another_target": "--arg ..." # } - # + # # And given `target_collections` that may be absent, or have a collection name associated with a list of string targets: # target_collections = { # "host": [ @@ -144,7 +144,7 @@ def refresh_compile_commands( target_collection_targets_list = [] serialized_target_collections = {} - + if target_collections: # Convert the targets specified in `target_collections` into the format we'll use with `targets`, so we can combine them into one list of targets to generate compile commands for. for targets_for_collection in target_collections.values(): @@ -161,7 +161,7 @@ def refresh_compile_commands( flags = "" target_data = (_make_label_absolute(target_name), flags) - + # Targets may appear in multiple collections. We don't want duplicates in the final list, but Starlark doesn't have Python's set class. So we de-duplicate manually. if target_data not in target_collection_targets_list: target_collection_targets_list.append(target_data) @@ -176,9 +176,9 @@ def refresh_compile_commands( serialized_targets.append("".join(target)) else: serialized_targets.append(target) - + serialized_target_collections[collection] = serialized_targets - + target_collection_targets = {"{}{}".format(target, flags): [target, flags] for target, flags in target_collection_targets_list} # Convert the various, acceptable target shorthands into the dictionary format