scons: fix write_git_sha1_h_file() issue on Windows

Unlike on Unix, os.rename(src, dst) will fail on Windows if the dst file
already exists.  Remove it first.
This commit is contained in:
Brian Paul 2011-09-28 09:04:03 -06:00
parent ddb5cd0a7b
commit e112287474
1 changed files with 2 additions and 0 deletions

View File

@ -488,6 +488,8 @@ def write_git_sha1_h_file(filename):
if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename):
# The filename does not exist or it's different from the new file,
# so replace old file with new.
if os.path.exists(filename):
os.remove(filename)
os.rename(tempfile, filename)
return