Issue #14662: Prevent shutil failures on OS X when destination does not
support chflag operations. (Patch by Hynek Schlawack)
diff --git a/Lib/shutil.py b/Lib/shutil.py
index be83251..dca4d2e 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -102,8 +102,10 @@
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):