diff options
-rw-r--r-- | src/engine/SCons/Node/FS.py | 2 | ||||
-rw-r--r-- | test/BuildDir.py | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index dfea21b..8bdfeb6 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -49,7 +49,7 @@ except AttributeError: import shutil import stat def file_link(src, dest): - shutil.copyfile(src, dest) + shutil.copy2(src, dest) st=os.stat(src) os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) diff --git a/test/BuildDir.py b/test/BuildDir.py index a283ac7..79f0eb0 100644 --- a/test/BuildDir.py +++ b/test/BuildDir.py @@ -195,6 +195,22 @@ if f77: test.run(program = bar51, stdout = " b1.for\n") test.run(program = bar52, stdout = " b2.for\n") + +import os +import stat +def equal_stats(x,y): + x = os.stat(x) + y = os.stat(y) + return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and + x[stat.ST_ATIME] == y[stat.ST_ATIME] and + x[stat.ST_MTIME] == y[stat.ST_MTIME]) + +# Make sure we did duplicate the source files in build/var2, and that their stats are the same: +test.fail_test(not os.path.exists(test.workpath('test', 'build', 'var2', 'f1.c'))) +test.fail_test(not os.path.exists(test.workpath('test', 'build', 'var2', 'f2.in'))) +test.fail_test(not equal_stats(test.workpath('test', 'build', 'var2', 'f1.c'), test.workpath('test', 'src', 'f1.c'))) +test.fail_test(not equal_stats(test.workpath('test', 'build', 'var2', 'f2.in'), test.workpath('test', 'src', 'f2.in'))) + # Make sure we didn't duplicate the source files in build/var3. test.fail_test(os.path.exists(test.workpath('test', 'build', 'var3', 'f1.c'))) test.fail_test(os.path.exists(test.workpath('test', 'build', 'var3', 'f2.in'))) |