Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused env_execute #3276

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions go/private/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,6 @@ def join_srcs(source):
"""Combines source from a split_srcs struct into a single list."""
return source.go + source.headers + source.asm + source.c + source.cxx + source.objc

def env_execute(ctx, arguments, environment = {}, **kwargs):
"""Executes a command in for a repository rule.

It prepends "env -i" to "arguments" before calling "ctx.execute".
Variables that aren't explicitly mentioned in "environment"
are removed from the environment. This should be preferred to "ctx.execute"
in most situations.
"""
if ctx.os.name.startswith("windows"):
return ctx.execute(arguments, environment = environment, **kwargs)
env_args = ["env", "-i"]
environment = dict(environment)
for var in ["TMP", "TMPDIR"]:
if var in ctx.os.environ and not var in environment:
environment[var] = ctx.os.environ[var]
for k, v in environment.items():
env_args.append("%s=%s" % (k, v))
arguments = env_args + arguments
return ctx.execute(arguments, **kwargs)

def os_path(ctx, path):
path = str(path) # maybe convert from path type
if ctx.os.name.startswith("windows"):
Expand Down