From 8c46a99e0bd614c49b303ce0e3161511891c5831 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Thu, 10 May 2012 17:21:23 -0700 Subject: Issue #14662: Prevent shutil failures on OS X when destination does not support chflag operations. (Patch by Hynek Schlawack) --- Lib/shutil.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Lib/shutil.py') diff --git a/Lib/shutil.py b/Lib/shutil.py index d1b1af3246..2d7a506b2e 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -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): -- cgit v1.2.1