Issue #14662: Prevent shutil failures on OS X when destination does not

support chflag operations.  (Patch by Hynek Schlawack)
This commit is contained in:
Ned Deily 2012-05-10 17:45:49 -07:00
parent b79a01f904
commit acdc56d0d0
4 changed files with 40 additions and 2 deletions

View file

@ -102,8 +102,10 @@ def copystat(src, dst):
try:
os.chflags(dst, st.st_flags)
except OSError, why:
if (not hasattr(errno, 'EOPNOTSUPP') or
why.errno != errno.EOPNOTSUPP):
for err in 'EOPNOTSUPP', 'ENOTSUP':
if hasattr(errno, err) and why.errno == getattr(errno, err):
break
else:
raise
def copy(src, dst):