コード例 #1
0
def dircmp(a, b):  # Compare whether two directories are the same
    # To make this as fast as possible, it uses the statcache
    print "  dircmp", a, b
    a_list = dircache.listdir(a)
    b_list = dircache.listdir(b)
    for x in a_list:
        if skipthis(x):
            pass
        elif x not in b_list:
            return 0
        else:
            ax = os.path.join(a, x)
            bx = os.path.join(b, x)
            if statcache.isdir(ax) and statcache.isdir(bx):
                if not dircmp(ax, bx):
                    return 0
            else:
                try:
                    if not cmpcache.cmp(ax, bx):
                        return 0
                except (RuntimeError, os.error):
                    return 0
    for x in b_list:
        if skipthis(x):
            pass
        elif x not in a_list:
            return 0
    return 1
コード例 #2
0
def dircmp(a, b): # Compare whether two directories are the same
	# To make this as fast as possible, it uses the statcache
	print '  dircmp', a, b
	a_list = dircache.listdir(a)
	b_list = dircache.listdir(b)
	for x in a_list:
		if skipthis(x):
			pass
		elif x not in b_list:
			return 0
		else:
			ax = os.path.join(a, x)
			bx = os.path.join(b, x)
			if statcache.isdir(ax) and statcache.isdir(bx):
				if not dircmp(ax, bx): return 0
			else:
				try:
					if not cmpcache.cmp(ax, bx): return 0
				except (RuntimeError, os.error):
					return 0
	for x in b_list:
		if skipthis(x):
			pass
		elif x not in a_list:
			return 0
	return 1
コード例 #3
0
ファイル: wdiff.py プロジェクト: th-rpy/python-0.9.1
def dircmp(a, b): # Compare whether two directories are the same
	# To make this as fast as possible, it uses the statcache
	print '  dircmp', a, b
	a_list = dircache.listdir(a)
	b_list = dircache.listdir(b)
	for x in a_list:
		if x in skiplist:
			pass
		elif x not in b_list:
			return 0
		else:
			ax = path.cat(a, x)
			bx = path.cat(b, x)
			if statcache.isdir(ax) and statcache.isdir(bx):
				if not dircmp(ax, bx): return 0
			else:
				try:
					if not cmpcache.cmp(ax, bx): return 0
				except posix.error:
					return 0
	for x in b_list:
		if x in skiplist:
			pass
		elif x not in a_list:
			return 0
	return 1