Don't remove temporary files on win32 with rm when cygwin is not in use. (Anthony...
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 7 Oct 2003 06:08:46 +0000 (06:08 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 7 Oct 2003 06:08:46 +0000 (06:08 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@814 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/EnvironmentTests.py
src/engine/SCons/Platform/win32.py
test/SharedLibrary.py

index a5d2b3dacf0699a278302b4187761c83adbc5422..fd9fca6cb3c9af3110847149980c41f05fb0896d 100644 (file)
@@ -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.
index 3c8438f31ef8081012058ae774e6cdbd23c81d1e..f46df73790aa5638afe663c074152ed223c01360 100644 (file)
@@ -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'))
index 161da908f00212acccae19af1439f783e3852ffc..08fb296693cf846d7b78632753cea95705d1418e 100644 (file)
@@ -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")
index 680cf79be06eefc83dce7d5a61cbc0b845c45c63..7eb714cd17cac7603566b0e4c1beb23d5485234b 100644 (file)
@@ -43,7 +43,9 @@ if sys.platform == 'win32':
     env.StaticLibrary(target = 'foo1-static', source = 'f1.c')
 else:
     env.StaticLibrary(target = 'foo1', source = 'f1.c')
-SharedLibrary(target = 'foo2', source = Split('f2a.c f2b.c f2c.c'))
+SharedLibrary(target = 'foo2',
+              source = Split('f2a.c f2b.c f2c.c'),
+              WIN32_INSERT_DEF = 1)
 env.SharedLibrary(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
 env2.Program(target = 'prog', source = 'prog.c')
 """)