cmpcache
index
/usr/lib/python1.5/cmpcache.py
 

# Module 'cmpcache'
#
# Efficiently compare files, boolean outcome only (equal / not equal).
#
# Tricks (used in this order):
#       - Use the statcache module to avoid statting files more than once
#       - Files with identical type, size & mtime are assumed to be clones
#       - Files with different type or size cannot be identical
#       - We keep a cache of outcomes of earlier comparisons
#       - We don't fork a process to run 'cmp' but read the files ourselves

   
Modules
                        
os
statcache

   
Constants
                        
ST_ATIME = 7
ST_CTIME = 9
ST_DEV = 2
ST_GID = 5
ST_INO = 1
ST_MODE = 0
ST_MTIME = 8
ST_NLINK = 3
ST_SIZE = 6
ST_UID = 4
S_ENFMT = 1024
S_IEXEC = 64
S_IFBLK = 24576
S_IFCHR = 8192
S_IFDIR = 16384
S_IFIFO = 4096
S_IFLNK = 40960
S_IFREG = 32768
S_IFSOCK = 49152
S_IREAD = 256
S_IRGRP = 32
S_IROTH = 4
S_IRUSR = 256
S_IRWXG = 56
S_IRWXO = 7
S_IRWXU = 448
S_ISGID = 1024
S_ISUID = 2048
S_ISVTX = 512
S_IWGRP = 16
S_IWOTH = 2
S_IWRITE = 128
S_IWUSR = 128
S_IXGRP = 8
S_IXOTH = 1
S_IXUSR = 64