From 79f4f1bddfc6495fc924e66928b9d06a6128cf1b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Wed, 16 Jan 2019 16:58:27 -0700 Subject: Set defaults for TEMPFILE* differently Per review comments, subst either return the right thing or None, use this are the way to test for setting default instead of has_key. Signed-off-by: Mats Wichmann --- src/engine/SCons/Platform/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py index db5b947..ab064ce 100644 --- a/src/engine/SCons/Platform/__init__.py +++ b/src/engine/SCons/Platform/__init__.py @@ -205,12 +205,11 @@ class TempFileMunge(object): # We use the .lnk suffix for the benefit of the Phar Lap # linkloc linker, which likes to append an .lnk suffix if # none is given. - if env.has_key('TEMPFILESUFFIX'): - suffix = env.subst('$TEMPFILESUFFIX') - else: - suffix = '.lnk' # TODO: better way to pick default? - fd, tmp = tempfile.mkstemp(suffix, text=True) + suffix = env.subst('$TEMPFILESUFFIX') + if not suffix: + suffix = '.lnk' + fd, tmp = tempfile.mkstemp(suffix, text=True) native_tmp = SCons.Util.get_native_path(os.path.normpath(tmp)) if env.get('SHELL', None) == 'sh': @@ -226,9 +225,8 @@ class TempFileMunge(object): # Windows path names. rm = 'del' - if env.has_key('TEMPFILEPREFIX'): - prefix = env.subst('$TEMPFILEPREFIX') - else: + prefix = env.subst('$TEMPFILEPREFIX') + if not prefix: prefix = '@' args = list(map(SCons.Subst.quote_spaces, cmd[1:])) -- cgit v0.12