Skip to content

Commit

Permalink
feat: add ability to pass user flags to python interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
muravev-vasilii committed Nov 26, 2024
1 parent eb9e0f2 commit 9e882de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion py/private/py_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _py_binary_rule_impl(ctx):
output = executable_launcher,
substitutions = {
"{{BASH_RLOCATION_FN}}": BASH_RLOCATION_FUNCTION,
"{{INTERPRETER_FLAGS}}": " ".join(py_toolchain.flags),
"{{INTERPRETER_FLAGS}}": " ".join(py_toolchain.flags + ctx.attr.interpreter_args),
"{{VENV_TOOL}}": to_rlocation_path(ctx, venv_toolchain.bin),
"{{ARG_COLLISION_STRATEGY}}": ctx.attr.package_collisions,
"{{ARG_PYTHON}}": to_rlocation_path(ctx, py_toolchain.python) if py_toolchain.runfiles_interpreter else py_toolchain.python.path,
Expand Down Expand Up @@ -149,6 +149,10 @@ A collision can occour when multiple packages providing the same file are instal
default = "error",
values = ["error", "warning", "ignore"],
),
"interpreter_args": attr.string_list(
doc = "Additional arguments to pass to the Python interpreter.",
default = [],
),
"_run_tmpl": attr.label(
allow_single_file = True,
default = "//py/private:run.tmpl.sh",
Expand Down

0 comments on commit 9e882de

Please sign in to comment.