From f7e5d2b46b03cc4bc09c38f7e0873378bb9c3b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 21 Jun 2015 07:55:15 +0200 Subject: Imported Upstream version 2.3.5 --- src/engine/SCons/Platform/__init__.py | 36 ++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'src/engine/SCons/Platform/__init__.py') diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 679191e..7c1b9d5 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -20,7 +20,7 @@ their own platform definition. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -42,7 +42,7 @@ their own platform definition. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Platform/__init__.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Platform/__init__.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.compat @@ -139,7 +139,7 @@ class TempFileMunge(object): Example usage: env["TEMPFILE"] = TempFileMunge - env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES')}" + env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES','$LINKCOMSTR')}" By default, the name of the temporary file used begins with a prefix of '@'. This may be configred for other tool chains by @@ -148,8 +148,9 @@ class TempFileMunge(object): env["TEMPFILEPREFIX"] = '-@' # diab compiler env["TEMPFILEPREFIX"] = '-via' # arm tool chain """ - def __init__(self, cmd): + def __init__(self, cmd, cmdstr = None): self.cmd = cmd + self.cmdstr = cmdstr def __call__(self, target, source, env, for_signature): if for_signature: @@ -177,6 +178,14 @@ class TempFileMunge(object): if length <= maxline: return self.cmd + # Check if we already created the temporary file for this target + # It should have been previously done by Action.strfunction() call + node = target[0] if SCons.Util.is_List(target) else target + cmdlist = getattr(node.attributes, 'tempfile_cmdlist', None) \ + if node is not None else None + if cmdlist is not None : + return cmdlist + # We do a normpath because mktemp() has what appears to be # a bug in Windows that will use a forward slash as a path # delimiter. Windows's link mistakes that for a command line @@ -224,9 +233,22 @@ class TempFileMunge(object): # purity get in the way of just being helpful, so we'll # reach into SCons.Action directly. if SCons.Action.print_actions: - print("Using tempfile "+native_tmp+" for command line:\n"+ - str(cmd[0]) + " " + " ".join(args)) - return [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ] + cmdstr = env.subst(self.cmdstr, SCons.Subst.SUBST_RAW, target, + source) if self.cmdstr is not None else '' + # Print our message only if XXXCOMSTR returns an empty string + if len(cmdstr) == 0 : + print("Using tempfile "+native_tmp+" for command line:\n"+ + str(cmd[0]) + " " + " ".join(args)) + + # Store the temporary file command list into the target Node.attributes + # to avoid creating two temporary files one for print and one for execute. + cmdlist = [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ] + if node is not None: + try : + setattr(node.attributes, 'tempfile_cmdlist', cmdlist) + except AttributeError: + pass + return cmdlist def Platform(name = platform_default()): """Select a canned Platform specification. -- cgit v1.2.3