Repository: SCons/scons

Issue:
remove $TEMPFILEPREFIX or replace with a space
**Describe the Feature**

There is no way to remove the default  `TEMPFILEPREFIX` of `@` from the `TEMPFILE` invocation name. White spaces are not recognized by scons. Calling `env['TEMPFILEPREFIX'] = ' ' `is not taken into account.
I'm using C2000 compiler and put all of my object files into a temp file to get over the limit of characters in mingw.  
Using
`c2000 --run_linker _tempfile_ `
the _tempfile_ must be called with no prefix.

I managed to find a workaround modify `Platform/__init__.py`
line 239 replace
```python
        prefix = env.subst('$TEMPFILEPREFIX')
        if not prefix:
            prefix = '@'
```

with 

```python
        prefix = env.subst('$TEMPFILEPREFIX')
        if not prefix and "False" == prefix.isspace():
            prefix = '@'
```

It's not pretty but does the job.

**Required information**
* Link to SCons Users thread discussing your issue.
https://github.com/SCons/scons/issues/2284
* Version of SCons
 SCons: v4.1.0.post1.12f24df0004ced8b91e758f29cd6396e60f37f5a

* Version of Python
 Python 3.9.0
* Which python distribution if applicable (python.org, cygwin, anaconda, macports, brew,etc)
 python.org
* How you installed SCons
 Sourceforge repo
* What Platform are you on? (Linux/Windows and which version)
 Windows 10
* How to reproduce your issue?  Please include a small self contained reproducer. Likely a SConstruct should do for most issues.
env['TEMPFILEPREFIX'] = ' '
${TEMPFILE("time to test it")}

the ouput will display the call of the temp file with a @ as first character
* 
* How you invoke scons (The command line you're using "scons --flags some_arguments")
scons some_arguments


**Additional context**
Add any other context or screenshots about the feature request here.



Discussion:
I think we call this a bug, as the docstring for `TempFileMunge` includes an example of the usage that doesn't work:
```
    By default, the name of the temporary file used begins with a
    prefix of '@'.  This may be configured for other tool chains by
    setting the TEMPFILEPREFIX variable. Example::

        env["TEMPFILEPREFIX"] = '-@'        # diab compiler
        env["TEMPFILEPREFIX"] = '-via'      # arm tool chain
        env["TEMPFILEPREFIX"] = ''          # (the empty string) PC Lint

```

Resolving patch:
diff --git a/SCons/Platform/__init__.py b/SCons/Platform/__init__.py
--- a/SCons/Platform/__init__.py
+++ b/SCons/Platform/__init__.py
@@ -257,8 +257,9 @@ def __call__(self, target, source, env, for_signature):
             # Windows path names.
             rm = 'del'
 
-        prefix = env.subst('$TEMPFILEPREFIX')
-        if not prefix:
+        if 'TEMPFILEPREFIX' in env:
+            prefix = env.subst('$TEMPFILEPREFIX')
+        else:
             prefix = '@'
 
         tempfile_esc_func = env.get('TEMPFILEARGESCFUNC', SCons.Subst.quote_spaces)
@@ -294,7 +295,7 @@ def __call__(self, target, source, env, for_signature):
                     str(cmd[0]) + " " + " ".join(args))
                 self._print_cmd_str(target, source, env, cmdstr)
 
-        cmdlist = [ cmd[0], prefix + native_tmp + '\n' + rm, native_tmp ]
+        cmdlist = [cmd[0], prefix + native_tmp + '\n' + rm, native_tmp]
 
         # Store the temporary file command list into the target Node.attributes
         # to avoid creating two temporary files one for print and one for execute.
@@ -304,7 +305,7 @@ def __call__(self, target, source, env, for_signature):
                 # $TEMPFILE{} fixes issue raised in PR #3140 and #3553
                 node.attributes.tempfile_cmdlist[cmdlist_key] = cmdlist
             except AttributeError:
-                node.attributes.tempfile_cmdlist = {cmdlist_key:cmdlist}
+                node.attributes.tempfile_cmdlist = {cmdlist_key: cmdlist}
 
         return cmdlist
 


Test patch:
diff --git a/test/TEMPFILE/TEMPFILEPREFIX.py b/test/TEMPFILE/TEMPFILEPREFIX.py
--- a/test/TEMPFILE/TEMPFILEPREFIX.py
+++ b/test/TEMPFILE/TEMPFILEPREFIX.py
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
 #
+# MIT License
+#
+# Copyright The SCons Foundation
+#
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
 # "Software"), to deal in the Software without restriction, including
@@ -25,17 +29,17 @@
 used for long command lines.
 """
 
-
 import TestSCons
 
-test = TestSCons.TestSCons(match = TestSCons.match_re)
+test = TestSCons.TestSCons(match=TestSCons.match_re)
 
 test.write('SConstruct', """
 import os
+
 env = Environment(
-    BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
-    MAXLINELENGTH = 16,
-    TEMPFILEPREFIX = '-via',
+    BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+    MAXLINELENGTH=16,
+    TEMPFILEPREFIX='-via',
 )
 env.AppendENVPath('PATH', os.curdir)
 env.Command('foo.out', 'foo.in', '$BUILDCOM')
@@ -43,8 +47,9 @@
 
 test.write('foo.in', "foo.in\n")
 
-test.run(arguments = '-n -Q .',
-         stdout = """\
+test.run(
+    arguments='-n -Q .',
+    stdout="""\
 Using tempfile \\S+ for command line:
 xxx.py foo.out foo.in
 xxx.py -via\\S+
@@ -66,39 +71,67 @@ def print_cmd_line(s, targets, sources, env):
 env.Command('foo.out', 'foo.in', '$BUILDCOM')
 """)
 
-test.run(arguments = '-n -Q .',
-         stdout = """""")
+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 __init__(self, cmd, cmdstr=None):
+        super().__init__(cmd, cmdstr)
 
     def _print_cmd_str(self, target, source, env, cmdstr):
-        super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr)
+        super()._print_cmd_str(target, source, None, cmdstr)
 
 env = Environment(
-    TEMPFILE = TestTempFileMunge,
-    BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
-    MAXLINELENGTH = 16,
-    TEMPFILEPREFIX = '-via',
-
+    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 = """\
+test.run(
+    arguments='-n -Q .',
+    stdout="""\
 Using tempfile \\S+ for command line:
 xxx.py foo.out foo.in
 xxx.py -via\\S+
 """)
 
+# make sure an empty prefix works too
+test.write('SConstruct', """
+import os
+from SCons.Platform import TempFileMunge
+
+class TestTempFileMunge(TempFileMunge):
+    def __init__(self, cmd, cmdstr=None):
+        super().__init__(cmd, cmdstr)
+
+    def _print_cmd_str(self, target, source, env, cmdstr):
+        super()._print_cmd_str(target, source, None, cmdstr)
+
+env = Environment(
+    TEMPFILE=TestTempFileMunge,
+    BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+    MAXLINELENGTH=16,
+    TEMPFILEPREFIX='',
+)
+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 [^@]\\S+
+""")
+
 test.pass_test()
 
 # Local Variables:
diff --git a/test/TEMPFILE/TEMPFILESUFFIX.py b/test/TEMPFILE/TEMPFILESUFFIX.py
--- a/test/TEMPFILE/TEMPFILESUFFIX.py
+++ b/test/TEMPFILE/TEMPFILESUFFIX.py
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
 #
+# MIT License
+#
+# Copyright The SCons Foundation
+#
 # Permission is hereby granted, free of charge, to any person obtaining
 # a copy of this software and associated documentation files (the
 # "Software"), to deal in the Software without restriction, including
@@ -32,19 +36,20 @@
 
 test.write('SConstruct', """
 import os
+
 env = Environment(
-    BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
-    MAXLINELENGTH = 16,
-    TEMPFILESUFFIX = '.foo',
+    BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+    MAXLINELENGTH=16,
+    TEMPFILESUFFIX='.foo',
 )
 env.AppendENVPath('PATH', os.curdir)
 env.Command('foo.out', 'foo.in', '$BUILDCOM')
 """)
 
 test.write('foo.in', "foo.in\n")
-
-test.run(arguments = '-n -Q .',
-         stdout = """\
+test.run(
+    arguments='-n -Q .',
+    stdout="""\
 Using tempfile \\S+ for command line:
 xxx.py foo.out foo.in
 xxx.py \\S+
@@ -57,10 +62,10 @@ def print_cmd_line(s, targets, sources, env):
     pass
 
 env = Environment(
-    BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
-    MAXLINELENGTH = 16,
-    TEMPFILESUFFIX = '.foo',
-    PRINT_CMD_LINE_FUNC=print_cmd_line
+    BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+    MAXLINELENGTH=16,
+    TEMPFILESUFFIX='.foo',
+    PRINT_CMD_LINE_FUNC=print_cmd_line,
 )
 env.AppendENVPath('PATH', os.curdir)
 env.Command('foo.out', 'foo.in', '$BUILDCOM')
@@ -74,26 +79,25 @@ def print_cmd_line(s, targets, sources, env):
 from SCons.Platform import TempFileMunge
 
 class TestTempFileMunge(TempFileMunge):
-
-    def __init__(self, cmd, cmdstr = None):
-        super(TestTempFileMunge, self).__init__(cmd, cmdstr)
+    def __init__(self, cmd, cmdstr=None):
+        super().__init__(cmd, cmdstr)
 
     def _print_cmd_str(self, target, source, env, cmdstr):
-        super(TestTempFileMunge, self)._print_cmd_str(target, source, None, cmdstr)
+        super()._print_cmd_str(target, source, None, cmdstr)
 
 env = Environment(
-    TEMPFILE = TestTempFileMunge,
-    BUILDCOM = '${TEMPFILE("xxx.py $TARGET $SOURCES")}',
-    MAXLINELENGTH = 16,
-    TEMPFILESUFFIX = '.foo',
-
+    TEMPFILE=TestTempFileMunge,
+    BUILDCOM='${TEMPFILE("xxx.py $TARGET $SOURCES")}',
+    MAXLINELENGTH=16,
+    TEMPFILESUFFIX='.foo',
 )
 env.AppendENVPath('PATH', os.curdir)
 env.Command('foo.out', 'foo.in', '$BUILDCOM')
 """)
 
-test.run(arguments = '-n -Q .',
-         stdout = """\
+test.run(
+    arguments='-n -Q .',
+    stdout="""\
 Using tempfile \\S+ for command line:
 xxx.py foo.out foo.in
 xxx.py \\S+