summaryrefslogtreecommitdiffstats
path: root/SCons/Tool
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2022-06-01 21:54:28 (GMT)
committerGitHub <noreply@github.com>2022-06-01 21:54:28 (GMT)
commit5c7c997dc4822a93d2b02e6709803600051f3517 (patch)
tree526bceff60d9d450e503bbe94dec80775e7c905a /SCons/Tool
parent8780e463e4dd1460cdcd009c697126ded249b524 (diff)
parentc9c678683a3944b0500a8ce68c80d7c5d48c9230 (diff)
downloadSCons-5c7c997dc4822a93d2b02e6709803600051f3517.zip
SCons-5c7c997dc4822a93d2b02e6709803600051f3517.tar.gz
SCons-5c7c997dc4822a93d2b02e6709803600051f3517.tar.bz2
Merge pull request #4158 from dmoody256/shell_env_gen_list
Updated SHELL_ENV_GENERATOR to be list of functions now called SHELL_ENV_GENERATORS
Diffstat (limited to 'SCons/Tool')
-rw-r--r--SCons/Tool/ninja/Methods.py4
-rw-r--r--SCons/Tool/ninja/NinjaState.py11
-rw-r--r--SCons/Tool/ninja/Utils.py4
3 files changed, 14 insertions, 5 deletions
diff --git a/SCons/Tool/ninja/Methods.py b/SCons/Tool/ninja/Methods.py
index 2be576f..c0afab8 100644
--- a/SCons/Tool/ninja/Methods.py
+++ b/SCons/Tool/ninja/Methods.py
@@ -81,7 +81,7 @@ def get_generic_shell_command(env, node, action, targets, sources, executor=None
"GENERATED_CMD",
{
"cmd": generate_command(env, node, action, targets, sources, executor=executor),
- "env": get_command_env(env),
+ "env": get_command_env(env, targets, sources),
},
# Since this function is a rule mapping provider, it must return a list of dependencies,
# and usually this would be the path to a tool, such as a compiler, used for this rule.
@@ -266,7 +266,7 @@ def gen_get_response_file_command(env, rule, tool, tool_is_dynamic=False, custom
variables = {"rspc": rsp_content, rule: cmd}
if use_command_env:
- variables["env"] = get_command_env(env)
+ variables["env"] = get_command_env(env, targets, sources)
for key, value in custom_env.items():
variables["env"] += env.subst(
diff --git a/SCons/Tool/ninja/NinjaState.py b/SCons/Tool/ninja/NinjaState.py
index 63ea3a1..ac10b5e 100644
--- a/SCons/Tool/ninja/NinjaState.py
+++ b/SCons/Tool/ninja/NinjaState.py
@@ -809,6 +809,15 @@ class SConsToNinjaTranslator:
# Remove all preceding and proceeding whitespace
cmdline = cmdline.strip()
+ env = node.env if node.env else self.env
+ executor = node.get_executor()
+ if executor is not None:
+ targets = executor.get_all_targets()
+ else:
+ if hasattr(node, "target_peers"):
+ targets = node.target_peers
+ else:
+ targets = [node]
# Make sure we didn't generate an empty cmdline
if cmdline:
@@ -817,7 +826,7 @@ class SConsToNinjaTranslator:
"rule": get_rule(node, "GENERATED_CMD"),
"variables": {
"cmd": cmdline,
- "env": get_command_env(node.env if node.env else self.env),
+ "env": get_command_env(env, targets, node.sources),
},
"implicit": dependencies,
}
diff --git a/SCons/Tool/ninja/Utils.py b/SCons/Tool/ninja/Utils.py
index 888218d..2bd2263 100644
--- a/SCons/Tool/ninja/Utils.py
+++ b/SCons/Tool/ninja/Utils.py
@@ -259,7 +259,7 @@ def ninja_noop(*_args, **_kwargs):
return None
-def get_command_env(env):
+def get_command_env(env, target, source):
"""
Return a string that sets the environment for any environment variables that
differ between the OS environment and the SCons command ENV.
@@ -275,7 +275,7 @@ def get_command_env(env):
# os.environ or differ from it. We assume if it's a new or
# differing key from the process environment then it's
# important to pass down to commands in the Ninja file.
- ENV = get_default_ENV(env)
+ ENV = SCons.Action._resolve_shell_env(env, target, source)
scons_specified_env = {
key: value
for key, value in ENV.items()