Skip to content

Commit

Permalink
fix: wrapped env-injection callable
Browse files Browse the repository at this point in the history
- fix: move `lambda` to nested function declaration

Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Sep 4, 2023
1 parent 8ff0f3b commit 298d1d9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/native_image/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,15 @@ def _graal_binary_implementation(ctx):
path_set[tool_dir] = None

paths = sorted(path_set.keys())
unix_like = True
if ctx.configuration.host_path_separator == ":":
# HACK: ":" is a proxy for a UNIX-like host.
# The tools returned above may be bash scripts that reference commands
# in directories we might not otherwise include. For example,
# on macOS, wrapped_ar calls dirname.
unix_like = True
if "/bin" not in path_set:
paths.append("/bin")
if "/usr/bin" not in path_set:
paths.append("/usr/bin")
else:
# non-unix hosts implies windows, where we should splice the full path
unix_like = False

# seal paths with hack above
env["PATH"] = ctx.configuration.host_path_separator.join(paths)
Expand Down Expand Up @@ -347,7 +342,9 @@ def _graal_binary_implementation(ctx):
def _wrap_actions_for_graal(actions):
"""Wraps the given ctx.actions struct so that env variables are correctly passed to Graal."""
patched_actions = {k: getattr(actions, k) for k in dir(actions)}
patched_actions["run"] = lambda **kwargs: _wrapped_run_for_graal(actions, **kwargs)
def _run_target(**kwargs):
_wrapped_run_for_graal(actions, **kwargs)
patched_actions["run"] = _run_target
return struct(**patched_actions)

def _env_arg_map_each(key_value):
Expand Down

0 comments on commit 298d1d9

Please sign in to comment.