if _have_lchmod:
try:
os.lchmod(path, stat.S_IMODE(self.mode))
- except errno.ENOSYS: # Function not implemented
- pass
+ except OSError as e:
+ # - "Function not implemented"
+ # - "Operation not supported" might be generated by glibc
+ if e.errno in (errno.ENOSYS, errno.EOPNOTSUPP):
+ pass
+ else:
+ raise
elif not stat.S_ISLNK(self.mode):
os.chmod(path, stat.S_IMODE(self.mode))