More Win32 test portability.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 11 Jan 2003 03:10:58 +0000 (03:10 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 11 Jan 2003 03:10:58 +0000 (03:10 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@542 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Node/FSTests.py

index e23178cf072b279c9858b80c505d62bb379acad2..6c8893d5a42d403451f12e5592fee59f20714037 100644 (file)
@@ -346,8 +346,16 @@ class BuildDirTestCase(unittest.TestCase):
         simulator = LinkSimulator()
 
         # save the real functions for later restoration
-        real_link = os.link
-        real_symlink = os.symlink
+        real_link = None
+        real_symlink = None
+        try:
+            real_link = os.link
+        except AttributeError:
+            pass
+        try:
+            real_symlink = os.symlink
+        except AttributeError:
+            pass
         real_copy = shutil.copy2
         simulator._real_copy = real_copy # the simulator needs the real one
 
@@ -361,12 +369,19 @@ class BuildDirTestCase(unittest.TestCase):
         SCons.Node.FS.Link(fs.File(test.workpath('build/foo')),
                            fs.File(test.workpath('src/foo')),
                            None)
+        os.chmod(test.workpath('src/foo'), ~stat.S_IRUSR)
         test.unlink( "src/foo" )
         test.unlink( "build/foo" )
 
         # restore the real functions
-        os.link = real_link
-        os.symlink = real_symlink
+        if real_link:
+            os.link = real_link
+        else:
+            delattr(os, 'link')
+        if real_symlink:
+            os.symlink = real_symlink
+        else:
+            delattr(os, 'symlink')
         shutil.copy2 = real_copy