Exemplo n.º 1
0
def compare_binary_files(file1, file2, source=None):
    try:
        with xxd(file1.path) as xxd1, xxd(file2.path) as xxd2:
            return Difference.from_raw_readers(xxd1, xxd2, file1.name, file2.name, source)
    except RequiredToolNotFound:
        hexdump1 = hexdump_fallback(file1.path)
        hexdump2 = hexdump_fallback(file2.path)
        comment = 'xxd not available in path. Falling back to Python hexlify.\n'
        return Difference.from_text(hexdump1, hexdump2, file1.name, file2.name, source, comment)