From 996085197f2c9828d0a0cfa0d2f9df605f6dba26 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 11 Jan 2003 03:10:58 +0000 Subject: [PATCH] More Win32 test portability. git-svn-id: http://scons.tigris.org/svn/scons/trunk@542 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Node/FSTests.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index e23178cf..6c8893d5 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -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 -- 2.26.2