summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-01-11 03:10:58 (GMT)
committerSteven Knight <knight@baldmt.com>2003-01-11 03:10:58 (GMT)
commite1c2427eeba11db45c65fbefb38d7f4b603121f0 (patch)
tree3a97e45397b9e39e13327fb907c56d696e969f9c
parentd8971e6f3a7252356768ed9473461bfb45869e76 (diff)
downloadSCons-e1c2427eeba11db45c65fbefb38d7f4b603121f0.zip
SCons-e1c2427eeba11db45c65fbefb38d7f4b603121f0.tar.gz
SCons-e1c2427eeba11db45c65fbefb38d7f4b603121f0.tar.bz2
More Win32 test portability.
-rw-r--r--src/engine/SCons/Node/FSTests.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index e23178c..6c8893d 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