summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel <dmoody256@gmail.com>2019-01-13 22:00:59 -0600
committerDaniel <dmoody256@gmail.com>2019-01-13 22:00:59 -0600
commitac42db67862451248e506820cc9a44cbce2dd574 (patch)
tree13c9f0bd0125073a5e9920fab0baf2a20122efbe
parent03a1cb0d3117ce297030010a813e14551185d99d (diff)
parent0f782d06f43b1d0167cb7d099dd3579b18a8a7ff (diff)
downloadscons-git-ac42db67862451248e506820cc9a44cbce2dd574.tar.gz
merged master
-rw-r--r--src/CHANGES.txt7
-rw-r--r--src/engine/SCons/Platform/__init__.py22
-rw-r--r--test/TEMPFILEPREFIX.py49
3 files changed, 73 insertions, 5 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index a12fedb5b..2c0cef684 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -10,14 +10,15 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
From John Doe:
- Whatever John Doe did.
- From Daniel Moody:
- - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets.
-
From Mats Wichmann:
- Improve finding of Microsoft compiler: add a 'products' wildcard
in case 2017 Build Tools only is installed as it is considered a separate
product from the default Visual Studio
+ From Daniel Moody:
+ - Improved support for VC14.1 and Visual Studio 2017, as well as arm and arm64 targets.
+ - Update TempFileMunge class to use PRINT_CMD_LINE_FUNC
+
RELEASE 3.0.3 - Mon, 07 Jan 2019 20:05:22 -0400
NOTE: 3.0.2 release was dropped because there was a packaging bug. Please consider all 3.0.2
content.
diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py
index 8784d5eb6..8117e60b6 100644
--- a/src/engine/SCons/Platform/__init__.py
+++ b/src/engine/SCons/Platform/__init__.py
@@ -243,8 +243,9 @@ class TempFileMunge(object):
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))
+ cmdstr = ("Using tempfile "+native_tmp+" for command line:\n"+
+ str(cmd[0]) + " " + " ".join(args))
+ self._print_cmd_str(target, source, env, cmdstr)
# Store the temporary file command list into the target Node.attributes
# to avoid creating two temporary files one for print and one for execute.
@@ -256,6 +257,23 @@ class TempFileMunge(object):
pass
return cmdlist
+ def _print_cmd_str(self, target, source, env, cmdstr):
+ # check if the user has specified a cmd line print function
+ print_func = None
+ try:
+ get = env.get
+ except AttributeError:
+ pass
+ else:
+ print_func = get('PRINT_CMD_LINE_FUNC')
+
+ # use the default action cmd line print if user did not supply one
+ if not print_func:
+ action = SCons.Action._ActionAction()
+ action.print_cmd_line(cmdstr, target, source, env)
+ else:
+ print_func(cmdstr, target, source, env)
+
def Platform(name = platform_default()):
"""Select a canned Platform specification.
diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py
index c47ebc421..7f4322b2d 100644
--- a/test/TEMPFILEPREFIX.py
+++ b/test/TEMPFILEPREFIX.py
@@ -67,6 +67,55 @@ xxx.py foo.out foo.in
xxx.py -via\\S+
""")
+test.write('SConstruct', """
+import os
+
+def print_cmd_line(s, targets, sources, env):
+ pass
+
+env = Environment(
+ BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+ MAXLINELENGTH = 16,
+ TEMPFILEPREFIX = '-via',
+ PRINT_CMD_LINE_FUNC=print_cmd_line
+)
+env.AppendENVPath('PATH', os.curdir)
+env.Command('foo.out', 'foo.in', '$BUILDCOM')
+""")
+
+test.run(arguments = '-n -Q .',
+ stdout = """""")
+
+test.write('SConstruct', """
+import os
+from SCons.Platform import TempFileMunge
+
+class TestTempFileMunge(TempFileMunge):
+
+ def __init__(self, cmd, cmdstr = None):
+ super(TestTempFileMunge, self).__init__(cmd, cmdstr)
+
+ def _print_cmd_str(self, target, source, env, cmdstr):
+ super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr)
+
+env = Environment(
+ TEMPFILE = TestTempFileMunge,
+ BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+ MAXLINELENGTH = 16,
+ TEMPFILEPREFIX = '-via',
+
+)
+env.AppendENVPath('PATH', os.curdir)
+env.Command('foo.out', 'foo.in', '$BUILDCOM')
+""")
+
+test.run(arguments = '-n -Q .',
+ stdout = """\
+Using tempfile \\S+ for command line:
+xxx.py foo.out foo.in
+xxx.py -via\\S+
+""")
+
test.pass_test()
# Local Variables: