summaryrefslogtreecommitdiff
path: root/src/engine/SCons/Platform
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2015-06-21 07:55:15 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2015-06-21 07:55:15 +0200
commitf7e5d2b46b03cc4bc09c38f7e0873378bb9c3b78 (patch)
tree583fe67e23e2e7f8737b77d1834633086283c393 /src/engine/SCons/Platform
parenta2795b63dd02ecddd8a0109dcc1b64108f68eace (diff)
Imported Upstream version 2.3.5upstream/2.3.5
Diffstat (limited to 'src/engine/SCons/Platform')
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py35
-rw-r--r--src/engine/SCons/Platform/__init__.py36
-rw-r--r--src/engine/SCons/Platform/__init__.xml2
-rw-r--r--src/engine/SCons/Platform/aix.py4
-rw-r--r--src/engine/SCons/Platform/cygwin.py4
-rw-r--r--src/engine/SCons/Platform/darwin.py4
-rw-r--r--src/engine/SCons/Platform/hpux.py4
-rw-r--r--src/engine/SCons/Platform/irix.py4
-rw-r--r--src/engine/SCons/Platform/os2.py4
-rw-r--r--src/engine/SCons/Platform/posix.py4
-rw-r--r--src/engine/SCons/Platform/posix.xml2
-rw-r--r--src/engine/SCons/Platform/sunos.py4
-rw-r--r--src/engine/SCons/Platform/sunos.xml2
-rw-r--r--src/engine/SCons/Platform/win32.py4
-rw-r--r--src/engine/SCons/Platform/win32.xml2
15 files changed, 84 insertions, 31 deletions
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py
index 69128b2..da7adac 100644
--- a/src/engine/SCons/Platform/PlatformTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -1,5 +1,5 @@
#
-# 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
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/PlatformTests.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/PlatformTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import SCons.compat
@@ -156,6 +156,37 @@ class TempFileMungeTestCase(unittest.TestCase):
SCons.Action.print_actions = old_actions
assert cmd != defined_cmd, cmd
+ def test_tempfilecreation_once(self):
+ # Init class with cmd, such that the fully expanded
+ # string reads "a test command line".
+ # Note, how we're using a command string here that is
+ # actually longer than the substituted one. This is to ensure
+ # that the TempFileMunge class internally really takes the
+ # length of the expanded string into account.
+ defined_cmd = "a $VERY $OVERSIMPLIFIED line"
+ t = SCons.Platform.TempFileMunge(defined_cmd)
+ env = SCons.Environment.SubstitutionEnvironment(tools=[])
+ # Setting the line length high enough...
+ env['VERY'] = 'test'
+ env['OVERSIMPLIFIED'] = 'command'
+ expanded_cmd = env.subst(defined_cmd)
+ env['MAXLINELENGTH'] = len(expanded_cmd)-1
+ # Disable printing of actions...
+ old_actions = SCons.Action.print_actions
+ SCons.Action.print_actions = 0
+ # Create an instance of object derived class to allow setattrb
+ 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[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 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.
diff --git a/src/engine/SCons/Platform/__init__.xml b/src/engine/SCons/Platform/__init__.xml
index d3cce6c..e6cecaf 100644
--- a/src/engine/SCons/Platform/__init__.xml
+++ b/src/engine/SCons/Platform/__init__.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2001 - 2014 The SCons Foundation
+Copyright (c) 2001 - 2015 The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
diff --git a/src/engine/SCons/Platform/aix.py b/src/engine/SCons/Platform/aix.py
index f4f1d6e..5527b27 100644
--- a/src/engine/SCons/Platform/aix.py
+++ b/src/engine/SCons/Platform/aix.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/aix.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/aix.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import os
import subprocess
diff --git a/src/engine/SCons/Platform/cygwin.py b/src/engine/SCons/Platform/cygwin.py
index d88eba6..e867085 100644
--- a/src/engine/SCons/Platform/cygwin.py
+++ b/src/engine/SCons/Platform/cygwin.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/cygwin.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/cygwin.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import posix
from SCons.Platform import TempFileMunge
diff --git a/src/engine/SCons/Platform/darwin.py b/src/engine/SCons/Platform/darwin.py
index 7a98c3c..f89db72 100644
--- a/src/engine/SCons/Platform/darwin.py
+++ b/src/engine/SCons/Platform/darwin.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/darwin.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/darwin.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import posix
import os
diff --git a/src/engine/SCons/Platform/hpux.py b/src/engine/SCons/Platform/hpux.py
index 16def79..8dcdea3 100644
--- a/src/engine/SCons/Platform/hpux.py
+++ b/src/engine/SCons/Platform/hpux.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/hpux.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/hpux.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import posix
diff --git a/src/engine/SCons/Platform/irix.py b/src/engine/SCons/Platform/irix.py
index 28af571..0819cb1 100644
--- a/src/engine/SCons/Platform/irix.py
+++ b/src/engine/SCons/Platform/irix.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/irix.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/irix.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import posix
diff --git a/src/engine/SCons/Platform/os2.py b/src/engine/SCons/Platform/os2.py
index a65511a..d394b72 100644
--- a/src/engine/SCons/Platform/os2.py
+++ b/src/engine/SCons/Platform/os2.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/os2.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/os2.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import win32
def generate(env):
diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py
index 86c08b9..3bca213 100644
--- a/src/engine/SCons/Platform/posix.py
+++ b/src/engine/SCons/Platform/posix.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/posix.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/posix.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import errno
import os
diff --git a/src/engine/SCons/Platform/posix.xml b/src/engine/SCons/Platform/posix.xml
index 9d3771f..28e7232 100644
--- a/src/engine/SCons/Platform/posix.xml
+++ b/src/engine/SCons/Platform/posix.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2001 - 2014 The SCons Foundation
+Copyright (c) 2001 - 2015 The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
diff --git a/src/engine/SCons/Platform/sunos.py b/src/engine/SCons/Platform/sunos.py
index 466e0d1..edbec63 100644
--- a/src/engine/SCons/Platform/sunos.py
+++ b/src/engine/SCons/Platform/sunos.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/sunos.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/sunos.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import posix
diff --git a/src/engine/SCons/Platform/sunos.xml b/src/engine/SCons/Platform/sunos.xml
index d6d978c..aecf3cf 100644
--- a/src/engine/SCons/Platform/sunos.xml
+++ b/src/engine/SCons/Platform/sunos.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2001 - 2014 The SCons Foundation
+Copyright (c) 2001 - 2015 The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.
diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py
index 2416802..cbe3040 100644
--- a/src/engine/SCons/Platform/win32.py
+++ b/src/engine/SCons/Platform/win32.py
@@ -8,7 +8,7 @@ selection method.
"""
#
-# 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
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Platform/win32.py 2014/09/27 12:51:43 garyo"
+__revision__ = "src/engine/SCons/Platform/win32.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog"
import os
import os.path
diff --git a/src/engine/SCons/Platform/win32.xml b/src/engine/SCons/Platform/win32.xml
index 75ae3df..feb7ce7 100644
--- a/src/engine/SCons/Platform/win32.xml
+++ b/src/engine/SCons/Platform/win32.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Copyright (c) 2001 - 2014 The SCons Foundation
+Copyright (c) 2001 - 2015 The SCons Foundation
This file is processed by the bin/SConsDoc.py module.
See its __doc__ string for a discussion of the format.