Пример #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
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