1111
1212import os
1313import stat
14- import statcache
1514
1615__all__ = ["cmp" ,"dircmp" ,"cmpfiles" ]
1716
@@ -30,25 +29,18 @@ def cmp(f1, f2, shallow=1, use_statcache=0):
3029 shallow -- Just check stat signature (do not read the files).
3130 defaults to 1.
3231
33- use_statcache -- Do not stat() each file directly: go through
34- the statcache module for more efficiency.
32+ use_statcache -- obsolete argument.
3533
3634 Return value:
3735
3836 True if the files are the same, False otherwise.
3937
4038 This function uses a cache for past comparisons and the results,
4139 with a cache invalidation mechanism relying on stale signatures.
42- Of course, if 'use_statcache' is true, this mechanism is defeated,
43- and the cache will never grow stale.
4440
4541 """
46- if use_statcache :
47- stat_function = statcache .stat
48- else :
49- stat_function = os .stat
50- s1 = _sig (stat_function (f1 ))
51- s2 = _sig (stat_function (f2 ))
42+ s1 = _sig (os .stat (f1 ))
43+ s2 = _sig (os .stat (f2 ))
5244 if s1 [0 ] != stat .S_IFREG or s2 [0 ] != stat .S_IFREG :
5345 return False
5446 if shallow and s1 == s2 :
@@ -188,12 +180,12 @@ def phase2(self): # Distinguish files, directories, funnies
188180
189181 ok = 1
190182 try :
191- a_stat = statcache .stat (a_path )
183+ a_stat = os .stat (a_path )
192184 except os .error , why :
193185 # print 'Can\'t stat', a_path, ':', why[1]
194186 ok = 0
195187 try :
196- b_stat = statcache .stat (b_path )
188+ b_stat = os .stat (b_path )
197189 except os .error , why :
198190 # print 'Can\'t stat', b_path, ':', why[1]
199191 ok = 0
@@ -275,7 +267,7 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=0):
275267 a, b -- directory names
276268 common -- list of file names found in both directories
277269 shallow -- if true, do comparison based solely on stat() information
278- use_statcache -- if true, use statcache.stat() instead of os.stat()
270+ use_statcache -- obsolete argument
279271
280272 Returns a tuple of three lists:
281273 files that compare equal
@@ -287,7 +279,7 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=0):
287279 for x in common :
288280 ax = os .path .join (a , x )
289281 bx = os .path .join (b , x )
290- res [_cmp (ax , bx , shallow , use_statcache )].append (x )
282+ res [_cmp (ax , bx , shallow )].append (x )
291283 return res
292284
293285
@@ -297,9 +289,9 @@ def cmpfiles(a, b, common, shallow=1, use_statcache=0):
297289# 1 for different
298290# 2 for funny cases (can't stat, etc.)
299291#
300- def _cmp (a , b , sh , st ):
292+ def _cmp (a , b , sh ):
301293 try :
302- return not abs (cmp (a , b , sh , st ))
294+ return not abs (cmp (a , b , sh ))
303295 except os .error :
304296 return 2
305297
0 commit comments