From b75048f19deaa419bc8dd5e2075ac55abaec549e Mon Sep 17 00:00:00 2001 From: Richard Levasseur Date: Sat, 7 Feb 2026 20:23:35 -0800 Subject: [PATCH] fix: fallback to /usr/bin/env if env is not in PATH This fixes an issue where the bootstrap script would fail if env was not in the PATH, which is the case on NixOS. The script now checks if env exists, and if not, falls back to /usr/bin/env. Fixes https://github.com/bazel-contrib/rules_python/issues/3575 --- python/private/stage1_bootstrap_template.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/private/stage1_bootstrap_template.sh b/python/private/stage1_bootstrap_template.sh index a984344647..36b8b67c37 100644 --- a/python/private/stage1_bootstrap_template.sh +++ b/python/private/stage1_bootstrap_template.sh @@ -285,8 +285,14 @@ fi export RUNFILES_DIR +if command -v env >/dev/null 2>&1; then + ENV_CMD="env" +else + ENV_CMD="/usr/bin/env" +fi + command=( - env + "$ENV_CMD" "${interpreter_env[@]}" "$python_exe" "${interpreter_args[@]}"