Commit 3b388ec8 authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

[Bug #220993; may also fix bug #479469] Fix flakiness when old

  installations are present, by always unlinking the destination file
  before copying to it.  Without the unlink(), the copied file remains
  owned by its previous UID, causing the subsequent chmod() to fail.

Bugfix candidate, though it may cause changes on platforms where
  file ownership behaves differently.
parent 8cb65406
......@@ -36,6 +36,13 @@ def _copy_file_contents (src, dst, buffer_size=16*1024):
raise DistutilsFileError, \
"could not open '%s': %s" % (src, errstr)
if os.path.exists(dst):
try:
os.unlink(dst)
except os.error, (errno, errstr):
raise DistutilsFileError, \
"could not delete '%s': %s" % (dst, errstr)
try:
fdst = open(dst, 'wb')
except os.error, (errno, errstr):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment