Methods.py (scons-4.2.0) | : | Methods.py (SCons-4.3.0) | ||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
import os | import os | |||
import shlex | import shlex | |||
import textwrap | import textwrap | |||
import SCons | import SCons | |||
from SCons.Subst import SUBST_CMD | ||||
from SCons.Tool.ninja import NINJA_CUSTOM_HANDLERS, NINJA_RULES, NINJA_POOLS | from SCons.Tool.ninja import NINJA_CUSTOM_HANDLERS, NINJA_RULES, NINJA_POOLS | |||
from SCons.Tool.ninja.Globals import __NINJA_RULE_MAPPING | from SCons.Tool.ninja.Globals import __NINJA_RULE_MAPPING | |||
from SCons.Tool.ninja.Utils import get_targets_sources, get_dependencies, get_or der_only, get_outputs, get_inputs, \ | from SCons.Tool.ninja.Utils import get_targets_sources, get_dependencies, get_or der_only, get_outputs, get_inputs, \ | |||
get_rule, get_path, generate_command, get_command_env, get_comstr | get_rule, get_path, generate_command, get_command_env, get_comstr | |||
def register_custom_handler(env, name, handler): | def register_custom_handler(env, name, handler): | |||
"""Register a custom handler for SCons function actions.""" | """Register a custom handler for SCons function actions.""" | |||
env[NINJA_CUSTOM_HANDLERS][name] = handler | env[NINJA_CUSTOM_HANDLERS][name] = handler | |||
def register_custom_rule_mapping(env, pre_subst_string, rule): | def register_custom_rule_mapping(env, pre_subst_string, rule): | |||
skipping to change at line 124 | skipping to change at line 125 | |||
if node.env: | if node.env: | |||
sub_env = node.env | sub_env = node.env | |||
else: | else: | |||
sub_env = env | sub_env = env | |||
executor = node.get_executor() | executor = node.get_executor() | |||
tlist, slist = get_targets_sources(node) | tlist, slist = get_targets_sources(node) | |||
# Generate a real CommandAction | # Generate a real CommandAction | |||
if isinstance(action, SCons.Action.CommandGeneratorAction): | if isinstance(action, SCons.Action.CommandGeneratorAction): | |||
# pylint: disable=protected-access | # pylint: disable=protected-access | |||
action = action._generate(tlist, slist, sub_env, 1, executor=executor) | action = action._generate(tlist, slist, sub_env, SUBST_CMD, executor=exe cutor) | |||
variables = {} | variables = {} | |||
comstr = get_comstr(sub_env, action, tlist, slist) | comstr = get_comstr(sub_env, action, tlist, slist) | |||
if not comstr: | if not comstr: | |||
return None | return None | |||
provider = __NINJA_RULE_MAPPING.get(comstr, get_generic_shell_command) | provider = __NINJA_RULE_MAPPING.get(comstr, get_generic_shell_command) | |||
rule, variables, provider_deps = provider(sub_env, node, action, tlist, slis t, executor=executor) | rule, variables, provider_deps = provider(sub_env, node, action, tlist, slis t, executor=executor) | |||
if node.get_env().get('NINJA_FORCE_SCONS_BUILD'): | ||||
rule = 'TEMPLATE' | ||||
# Get the dependencies for all targets | # Get the dependencies for all targets | |||
implicit = list({dep for tgt in tlist for dep in get_dependencies(tgt)}) | implicit = list({dep for tgt in tlist for dep in get_dependencies(tgt)}) | |||
# Now add in the other dependencies related to the command, | # Now add in the other dependencies related to the command, | |||
# e.g. the compiler binary. The ninja rule can be user provided so | # e.g. the compiler binary. The ninja rule can be user provided so | |||
# we must do some validation to resolve the dependency path for ninja. | # we must do some validation to resolve the dependency path for ninja. | |||
for provider_dep in provider_deps: | for provider_dep in provider_deps: | |||
provider_dep = sub_env.subst(provider_dep) | provider_dep = sub_env.subst(provider_dep) | |||
skipping to change at line 257 | skipping to change at line 260 | |||
rsp_content = " ".join(rsp_content) | rsp_content = " ".join(rsp_content) | |||
variables = {"rspc": rsp_content, rule: cmd} | variables = {"rspc": rsp_content, rule: cmd} | |||
if use_command_env: | if use_command_env: | |||
variables["env"] = get_command_env(env) | variables["env"] = get_command_env(env) | |||
for key, value in custom_env.items(): | for key, value in custom_env.items(): | |||
variables["env"] += env.subst( | variables["env"] += env.subst( | |||
"export %s=%s;" % (key, value), target=targets, source=sourc es, executor=executor | "export %s=%s;" % (key, value), target=targets, source=sourc es, executor=executor | |||
) + " " | ) + " " | |||
return rule, variables, [tool_command] | ||||
if node.get_env().get('NINJA_FORCE_SCONS_BUILD'): | ||||
ret_rule = 'TEMPLATE' | ||||
else: | ||||
ret_rule = rule | ||||
return ret_rule, variables, [tool_command] | ||||
return get_response_file_command | return get_response_file_command | |||
End of changes. 4 change blocks. | ||||
2 lines changed or deleted | 11 lines changed or added |