From 53c892c123ac9ea3d4f1cdb3e5e0e1887e8c73a4 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 21:19:15 -0600 Subject: updated changes.txt --- src/CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4baf70a..9f53b1d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -8,16 +8,16 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER From John Doe: - - Whatever John Doe did. + From Daniel Moody: + - 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. From William Deegan: - - Fixes to packaging logic. Ensuring the SCons.Tool.clangCommon module is added to the release packages. - Modify scons.bat script to check for scons python script without .py extension if no file -- cgit v0.12 From 36c170d87f89e6ea96c7c4bae1a04963d71d317f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jan 2019 21:51:31 -0600 Subject: accidently reset changes, so recommiting --- src/engine/SCons/Platform/__init__.py | 22 ++++++++++++++-- test/TEMPFILEPREFIX.py | 49 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index 8784d5e..8117e60 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 c47ebc4..7f4322b 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: -- cgit v0.12