diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Platform/PlatformTests.py | 12 | ||||
-rw-r--r-- | src/engine/SCons/Platform/__init__.py | 22 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py index 46151e1..38ea55a 100644 --- a/src/engine/SCons/Platform/PlatformTests.py +++ b/src/engine/SCons/Platform/PlatformTests.py @@ -175,13 +175,17 @@ class TempFileMungeTestCase(unittest.TestCase): old_actions = SCons.Action.print_actions SCons.Action.print_actions = 0 # Create an instance of object derived class to allow setattrb - class TSList(object): pass - target = TSList() - cmd = t(target,None,env,0) + class Node(object) : + class Attrs(object): + pass + def __init__(self): + self.attributes = self.Attrs() + target = [Node()] + cmd = t(target, None, env, 0) # ...and restoring its setting. SCons.Action.print_actions = old_actions assert cmd != defined_cmd, cmd - assert cmd == getattr(target, 'tempfile_cmdlist', None) + assert cmd == getattr(target[0].attributes, 'tempfile_cmdlist', None) if __name__ == "__main__": suite = unittest.TestSuite() diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 6dc241e..c33012b 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -177,10 +177,12 @@ class TempFileMunge(object): if length <= maxline: return self.cmd - # Check if we already created the temporary file for this Executor + # Check if we already created the temporary file for this target # It should have been previously done by Action.strfunction() call - cmdlist = getattr(target, 'tempfile_cmdlist', None) - if cmdlist is not None : + 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 @@ -233,14 +235,14 @@ class TempFileMunge(object): print("Using tempfile "+native_tmp+" for command line:\n"+ str(cmd[0]) + " " + " ".join(args)) - # Store the temporary file command list into the target TList hold by - # the Executor to avoid creating two temporary files one for print and - # one for execute + # 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 ] - try : - setattr(target, 'tempfile_cmdlist', cmdlist) - except AttributeError: - pass + if node is not None: + try : + setattr(node.attributes, 'tempfile_cmdlist', cmdlist) + except AttributeError: + pass return cmdlist def Platform(name = platform_default()): |