Win32 portability fixes for tests.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 19 Sep 2004 23:08:50 +0000 (23:08 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 19 Sep 2004 23:08:50 +0000 (23:08 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1086 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/dblite.py
test/NodeOps.py
test/build-errors.py

index c2407ea982ee2da3d0872cbe0caf450c5a283fe9..8bd28e9040036f289f7a79f1c62b3c185dc63182 100644 (file)
@@ -75,6 +75,8 @@ class dblite:
     f = _open(self._tmp_name, "wb", self._mode)
     cPickle.dump(self._dict, f, 1)
     f.close()
+    # Win32 doesn't allow renaming if the file exists, so unlink it first.
+    os.unlink(self._file_name)
     os.rename(self._tmp_name, self._file_name)
     self._needs_sync = 00000
     if (keep_all_files):
index ae9268c0f7d954e1470cbdf51762b4329326350d..ffb89944029b9db4c09a2a05277826f433f784bb 100644 (file)
@@ -41,12 +41,17 @@ import TestSCons
 import os
 import string
 
+_exe = TestSCons._exe
+lib_ = TestSCons.lib_
+_lib = TestSCons._lib
+_obj = TestSCons._obj
+dll_ = TestSCons.dll_
+_dll = TestSCons._dll
+
 if sys.platform == 'win32':
-    _obj = '.obj'
     fooflags = '/nologo -DFOO'
     barflags = '/nologo -DBAR'
 else:
-    _obj = '.o'
     fooflags = '-DFOO'
     barflags = '-DBAR'
     
@@ -211,16 +216,20 @@ builddir_srcnodes = [ os.path.join('bld', 'goof.in'),
                       os.path.join('bld', 'subsrcdir', 'boo.c'),
                     ]
 
-sub_build_nodes = [ os.path.join('bld','subsrcdir','boo.o'),
-                    os.path.join('bld','goo.o'),
-                    os.path.join('bld','goof.c'),
-                    os.path.join('bld','libgoo.a'),
+sub_build_nodes = [ os.path.join('bld', 'subsrcdir','boo' + _obj),
+                    os.path.join('bld', 'goo' + _obj),
+                    os.path.join('bld', 'goof.c'),
+                    os.path.join('bld', lib_ + 'goo' + _lib),
 ]
 
-build_nodes = ['fooprog', 'libfoo.so', 'foo.o',
-               'barprog', 'libbar.so', 'bar.o',
+build_nodes = ['fooprog' + _exe,
+               dll_ + 'foo' + _dll,
+              'foo' + _obj,
+               'barprog' + _exe,
+              dll_ + 'bar' + _dll,
+              'bar' + _obj,
 
-               'gooprog',
+               'gooprog' + _exe,
 
                ] + builddir_srcnodes + sub_build_nodes
 
index f64786fce5e0e7506538ae9982eb8e584759825f..67dac2022924aa7aea53b015ca67d587908f6e74 100644 (file)
@@ -189,7 +189,7 @@ else:
 
 test.write('SConstruct4', r"""
 env = Environment()
-env.Command('test.out', 'test.in', 'cp $SOURCE $TARGET')
+env.Command('test.out', 'test.in', Copy('$TARGET', '$SOURCE'))
 env.InstallAs('test2.out', 'test.out')
 # Mark test2.out as precious so we'll handle the exception in
 # FunctionAction() rather than when the target is cleaned before building.