From b2457f4410ea941b9bc3119121beb58d3879c2f9 Mon Sep 17 00:00:00 2001 From: Alex Tercete Date: Fri, 28 Feb 2025 09:58:07 +0000 Subject: [PATCH] fix: strip trailing Bazel module separator from workspace name When integrated with `@pre-commit-hooks`, the YAML config was being generated with `@pre-commit-hooks~` as the workspace name, which caused errors when trying to run the hooks. In Bazel 8 the separator is `+`. --- pre-commit/hook/label.bzl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pre-commit/hook/label.bzl b/pre-commit/hook/label.bzl index de5004f..daa88d8 100644 --- a/pre-commit/hook/label.bzl +++ b/pre-commit/hook/label.bzl @@ -1,7 +1,9 @@ visibility("//...") +SEPARATOR = Label("@rules_python").repo_name.removesuffix("@rules_python")[-1] + def label(value): - ws = value.workspace_name + ws = value.workspace_name.removesuffix(SEPARATOR) pkg = value.package last = pkg.rsplit("/", 1)[-1] name = value.name -- GitLab