From 6f80c095148d6d010d9dc131bd89c5caa5cc5c0c Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Tue, 9 Aug 2016 22:19:02 -0400 Subject: SERVER-25436: modify vendored scons to use win32 api CopyFile operation --- .../scons-3.0.4/scons-local-3.0.4/SCons/Node/FS.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/third_party/scons-3.0.4/scons-local-3.0.4/SCons/Node/FS.py b/src/third_party/scons-3.0.4/scons-local-3.0.4/SCons/Node/FS.py index 01305df3db1..c6614438bca 100644 --- a/src/third_party/scons-3.0.4/scons-local-3.0.4/SCons/Node/FS.py +++ b/src/third_party/scons-3.0.4/scons-local-3.0.4/SCons/Node/FS.py @@ -59,6 +59,15 @@ import SCons.Warnings from SCons.Debug import Trace from . import DeciderNeedsNode +# SERVER-25436: to work around an issue with python on windows where shutil.copy<2> methods +# didn't appropriately close files, which caused build failures with the cached build. +if sys.platform == "win32": + import win32api + _copy = _copy2 = win32api.CopyFile +else: + _copy = shutil.copy + _copy2 = shutil.copy2 + print_duplicate = 0 @@ -256,7 +265,7 @@ else: _softlink_func = None def _copy_func(fs, src, dest): - shutil.copy2(src, dest) + _copy2(src, dest) st = fs.stat(src) fs.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) @@ -1093,9 +1102,9 @@ class LocalFS(object): def chmod(self, path, mode): return os.chmod(path, mode) def copy(self, src, dst): - return shutil.copy(src, dst) + return _copy(src, dst) def copy2(self, src, dst): - return shutil.copy2(src, dst) + return _copy2(src, dst) def exists(self, path): return os.path.exists(path) def getmtime(self, path): -- cgit v1.2.1