diff options
author | Steven Knight <knight@baldmt.com> | 2003-10-07 06:08:46 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-10-07 06:08:46 (GMT) |
commit | 15f50a47c4cc226b9326d3bb1271e26a62644f22 (patch) | |
tree | cab7e290af3df76856fdd92fd923af12b61481cc /src | |
parent | 4f8244d481caa54c663a24d9efdf4c0a592230fc (diff) | |
download | SCons-15f50a47c4cc226b9326d3bb1271e26a62644f22.zip SCons-15f50a47c4cc226b9326d3bb1271e26a62644f22.tar.gz SCons-15f50a47c4cc226b9326d3bb1271e26a62644f22.tar.bz2 |
Don't remove temporary files on win32 with rm when cygwin is not in use. (Anthony Roach) Win32 portability fixes.
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 5 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Platform/win32.py | 16 |
3 files changed, 16 insertions, 7 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a5d2b3d..fd9fca6 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -128,6 +128,11 @@ RELEASE X.XX - XXX - Have the closing message say "...terminated because of errors" if there were any. + From Anthony Roach: + + - On Win32 systems, only use "rm" to delete files if Cygwin is being + used. ("rm" doesn't understand Win32-format path names.) + From Christoph Wiedemann: - Fix test/SWIG.py to find the Python include directory in all cases. diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 3c8438f..f46df73 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1568,7 +1568,7 @@ class EnvironmentTestCase(unittest.TestCase): import SCons.Sig class MyFS: - SConstruct_dir = '/dir' + SConstruct_dir = os.sep + 'dir' env = Environment(FOO = 'SConsign', BAR = os.path.join(os.sep, 'File')) diff --git a/src/engine/SCons/Platform/win32.py b/src/engine/SCons/Platform/win32.py index 161da90..08fb296 100644 --- a/src/engine/SCons/Platform/win32.py +++ b/src/engine/SCons/Platform/win32.py @@ -68,10 +68,6 @@ class TempFileMunge: if (reduce(lambda x, y: x + len(y), cmd, 0) + len(cmd)) <= maxline: return self.cmd else: - # In Cygwin, we want to use rm to delete the temporary file, - # because del does not exist in the sh shell. - rm = env.Detect('rm') or 'del' - # We do a normpath because mktemp() has what appears to be # a bug in Win32 that will use a forward slash as a path # delimiter. Win32's link mistakes that for a command line @@ -83,10 +79,18 @@ class TempFileMunge: tmp = os.path.normpath(tempfile.mktemp('.lnk')) native_tmp = SCons.Util.get_native_path(tmp) - # The sh shell will try to escape the backslashes in the - # path, so unescape them. if env['SHELL'] and env['SHELL'] == 'sh': + # The sh shell will try to escape the backslashes in the + # path, so unescape them. native_tmp = string.replace(native_tmp, '\\', r'\\\\') + # In Cygwin, we want to use rm to delete the temporary + # file, because del does not exist in the sh shell. + rm = env.Detect('rm') or 'del' + else: + # Don't use 'rm' if the shell is not sh, because rm won't + # work with the win32 shells (cmd.exe or command.com) or + # win32 path names. + rm = 'del' args = map(SCons.Util.quote_spaces, cmd[1:]) open(tmp, 'w').write(string.join(args, " ") + "\n") |