This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author joerg
Recipients barry, jackdied, joerg, kcwu, pitrou
Date 2010-03-17.23:05:12
SpamBayes Score 8.575988e-05
Marked as misclassified No
Message-id <1268867114.5.0.179678635154.issue7512@psf.upfronthosting.co.za>
In-reply-to
Content
A better approach might be to change the function to:

def copystat(src, dst):
  st = os.stat(src)
  st_dst = os.stat(dst)
  mode = stat.S_IMODE(st.st_mode)
  mode_dst = stat.S_IMODE(st_dst.st_mode)
  if hasattr(os, 'utime'):
    if st.st_atime != st_dst.st_atime or st.st_mtime != st_dst.st_mtime
      os.utime(dst, (st.st_atime, st.st_mtime))
  if hasattr(os, 'chmod'):
    if mode != mode_dst:
      os.chmod(dst, mode)
  if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
    if st.st_flags != st_dst.st_flags:
      os.chflags(dst, st.st_flags)

This avoids the system calls for the (common) case of not having to change anything at all. Given that the flags are normally not set, it also avoids the problem with NFS.
History
Date User Action Args
2010-03-17 23:05:14joergsetrecipients: + joerg, barry, pitrou, jackdied, kcwu
2010-03-17 23:05:14joergsetmessageid: <1268867114.5.0.179678635154.issue7512@psf.upfronthosting.co.za>
2010-03-17 23:05:12joerglinkissue7512 messages
2010-03-17 23:05:12joergcreate