From eb94603ae83c4eb7d28e10bc7b5ef84187b839fc Mon Sep 17 00:00:00 2001 From: Rob Mohr Date: Mon, 29 Jul 2024 22:19:04 +0000 Subject: [PATCH] pw_presubmit: Expose name of Bazel executable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make the transition easier downstream. Bug: 355438774 Change-Id: I76f6da37e523fe8cdf180a1fb619c56bbf85bd60 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/226378 Pigweed-Auto-Submit: Rob Mohr Lint: Lint 🤖 Reviewed-by: Ted Pudlik Commit-Queue: Rob Mohr --- pw_presubmit/py/pw_presubmit/build.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pw_presubmit/py/pw_presubmit/build.py b/pw_presubmit/py/pw_presubmit/build.py index 4a04c1e25e..cd32d0b6c5 100644 --- a/pw_presubmit/py/pw_presubmit/build.py +++ b/pw_presubmit/py/pw_presubmit/build.py @@ -69,6 +69,9 @@ _LOG = logging.getLogger(__name__) +BAZEL_EXECUTABLE = 'bazel' + + def bazel( ctx: PresubmitContext, cmd: str, @@ -109,10 +112,16 @@ def bazel( with (ctx.output_dir / 'bazel.output.base').open('w') as outs, ( ctx.output_dir / 'bazel.output.base.err' ).open('w') as errs: - call('bazel', 'info', 'output_base', tee=outs, stderr=errs) + call( + BAZEL_EXECUTABLE, + 'info', + 'output_base', + tee=outs, + stderr=errs, + ) call( - 'bazel', + BAZEL_EXECUTABLE, cmd, '--verbose_failures', '--worker_verbose', @@ -482,7 +491,10 @@ def check_bazel_build_for_files( for directory in bazel_dirs: bazel_builds.update( _get_paths_from_command( - directory, 'bazel', 'query', 'kind("source file", //...:*)' + directory, + BAZEL_EXECUTABLE, + 'query', + 'kind("source file", //...:*)', ) )