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:21:23 -07:00
parent 1682e5d740
commit 5fddf866d8
3 changed files with 37 additions and 2 deletions

View file

@ -118,8 +118,10 @@ def copystat(src, dst):
try:
os.chflags(dst, st.st_flags)
except OSError as 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):