summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurentMarchelli <devnull@localhost>2014-11-27 16:14:53 (GMT)
committerLaurentMarchelli <devnull@localhost>2014-11-27 16:14:53 (GMT)
commit03a3cc469fc3ac561ffcb81efe38fd08d4e9aa45 (patch)
tree25a203fd4ee8eff646f4064191b7c31b049a79bc
parentb52679b157050eaed717b2f2b01a9442efdc991c (diff)
downloadSCons-03a3cc469fc3ac561ffcb81efe38fd08d4e9aa45.zip
SCons-03a3cc469fc3ac561ffcb81efe38fd08d4e9aa45.tar.gz
SCons-03a3cc469fc3ac561ffcb81efe38fd08d4e9aa45.tar.bz2
Using setattr(Node.attributes, 'tempfile_cmdlist', cmdlist) instead than setattr(TList, 'tempfile_cmdlist', cmdlist)
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py12
-rw-r--r--src/engine/SCons/Platform/__init__.py22
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()):