From ec45fdfb7f9c7b7671c0c39f44a5ebb95b4c39f0 Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Wed, 27 Apr 2022 21:23:08 -0400 Subject: [PATCH] fix: set shebang directly instead of via sh_toolchain --- py/private/entry.tmpl.sh | 2 +- py/private/py_binary.bzl | 4 +--- py/private/venv/venv.bzl | 2 -- py/private/venv/venv.tmpl.sh | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/py/private/entry.tmpl.sh b/py/private/entry.tmpl.sh index b22416c2..7c1fd825 100644 --- a/py/private/entry.tmpl.sh +++ b/py/private/entry.tmpl.sh @@ -1,4 +1,4 @@ -#!{{BASH_BIN}} +#!/usr/bin/env bash {{BASH_RLOCATION_FN}} diff --git a/py/private/py_binary.bzl b/py/private/py_binary.bzl index 1428a9d8..90dccc48 100644 --- a/py/private/py_binary.bzl +++ b/py/private/py_binary.bzl @@ -7,7 +7,6 @@ load("//py/private:utils.bzl", "PY_TOOLCHAIN", "SH_TOOLCHAIN", "dict_to_exports" load("//py/private/venv:venv.bzl", _py_venv = "py_venv_utils") def _py_binary_rule_imp(ctx): - bash_bin = ctx.toolchains[SH_TOOLCHAIN].path interpreter = resolve_toolchain(ctx) main = ctx.file.main @@ -24,7 +23,6 @@ def _py_binary_rule_imp(ctx): }, **ctx.attr.env) common_substitutions = { - "{{BASH_BIN}}": bash_bin, "{{BASH_RLOCATION_FN}}": BASH_RLOCATION_FUNCTION, "{{BINARY_ENTRY_POINT}}": to_manifest_path(ctx, main), "{{INTERPRETER_FLAGS}}": " ".join(interpreter.flags), @@ -96,8 +94,8 @@ py_base = struct( implementation = _py_binary_rule_imp, attrs = _attrs, toolchains = [ - SH_TOOLCHAIN, PY_TOOLCHAIN, + SH_TOOLCHAIN, ], ) diff --git a/py/private/venv/venv.bzl b/py/private/venv/venv.bzl index cd10c57b..18d218d5 100644 --- a/py/private/venv/venv.bzl +++ b/py/private/venv/venv.bzl @@ -17,7 +17,6 @@ def _get_attr(ctx, attr, override): return override def _make_venv(ctx, name = None, main = None, strip_pth_workspace_root = None): - bash_bin = ctx.toolchains[SH_TOOLCHAIN].path interpreter = resolve_toolchain(ctx) name = _get_attr(ctx.attr, "name", name) @@ -96,7 +95,6 @@ def _make_venv(ctx, name = None, main = None, strip_pth_workspace_root = None): venv_directory = ctx.actions.declare_directory("%s.source" % name, sibling = venv_sibling) common_substitutions = { - "{{BASH_BIN}}": bash_bin, "{{BASH_RLOCATION_FN}}": BASH_RLOCATION_FUNCTION, "{{BAZEL_WORKSPACE_NAME}}": ctx.workspace_name, "{{INTERPRETER_FLAGS}}": " ".join(interpreter.flags), diff --git a/py/private/venv/venv.tmpl.sh b/py/private/venv/venv.tmpl.sh index 16fd4e48..c11e8fe4 100644 --- a/py/private/venv/venv.tmpl.sh +++ b/py/private/venv/venv.tmpl.sh @@ -1,4 +1,4 @@ -#!{{BASH_BIN}} +#!/usr/bin/env bash USE_MANIFEST_PATH={{USE_MANIFEST_PATH}}