Merge pull request #6460 from ThomasWaldmann/move-checksums

remove algorithms package, move checksums module to borg package
This commit is contained in:
TW 2022-03-17 12:55:43 +01:00 committed by GitHub
commit cb0e4fc2b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 11 additions and 17 deletions

View File

@ -94,7 +94,7 @@ crypto_helpers = 'src/borg/crypto/_crypto_helpers.c'
chunker_source = 'src/borg/chunker.pyx'
hashindex_source = 'src/borg/hashindex.pyx'
item_source = 'src/borg/item.pyx'
checksums_source = 'src/borg/algorithms/checksums.pyx'
checksums_source = 'src/borg/checksums.pyx'
platform_posix_source = 'src/borg/platform/posix.pyx'
platform_linux_source = 'src/borg/platform/linux.pyx'
platform_syncfilerange_source = 'src/borg/platform/syncfilerange.pyx'
@ -207,7 +207,7 @@ if not on_rtd:
Extension('borg.hashindex', [hashindex_source], extra_compile_args=cflags),
Extension('borg.item', [item_source], extra_compile_args=cflags),
Extension('borg.chunker', [chunker_source], extra_compile_args=cflags),
Extension('borg.algorithms.checksums', **checksums_ext_kwargs),
Extension('borg.checksums', **checksums_ext_kwargs),
]
posix_ext = Extension('borg.platform.posix', [platform_posix_source], extra_compile_args=cflags)

View File

@ -1,6 +0,0 @@
"""
borg.algorithms
===============
This package is intended for hash and checksum functions.
"""

View File

@ -36,7 +36,7 @@ try:
import borg
from . import __version__
from . import helpers
from .algorithms.checksums import crc32
from .checksums import crc32
from .archive import Archive, ArchiveChecker, ArchiveRecreater, Statistics, is_special
from .archive import BackupError, BackupOSError, backup_io, OsOpen, stat_update_check
from .archive import FilesystemObjectProcessors, TarfileObjectProcessors, MetadataCollector, ChunksProcessor
@ -563,7 +563,7 @@ class Archiver:
print(f"{spec:<24} {size:<10} {timeit(func, number=100):.3f}s")
import zlib
from borg.algorithms.checksums import crc32, deflate_crc32, xxh64
from borg.checksums import crc32, deflate_crc32, xxh64
print("Non-cryptographic checksums / hashes ===========================")
size = "1GB"
tests = [

View File

@ -1,7 +1,7 @@
import zlib
from ..platformflags import is_darwin
from ..helpers import bin_to_hex
from .platformflags import is_darwin
from .helpers import bin_to_hex
from libc.stdint cimport uint32_t
from cpython.buffer cimport PyBUF_SIMPLE, PyObject_GetBuffer, PyBuffer_Release

View File

@ -6,7 +6,7 @@ from hmac import compare_digest
from ..helpers import IntegrityError
from ..logger import create_logger
from ..algorithms.checksums import StreamingXXH64
from ..checksums import StreamingXXH64
logger = create_logger()

View File

@ -751,7 +751,7 @@ class ItemFormatter(BaseFormatter):
return any(key in cls.KEYS_REQUIRING_CACHE for key in format_keys)
def __init__(self, archive, format, *, json_lines=False):
from ..algorithms.checksums import StreamingXXH64
from ..checksums import StreamingXXH64
self.xxh64 = StreamingXXH64
self.archive = archive
self.json_lines = json_lines

View File

@ -31,7 +31,7 @@ from .logger import create_logger, setup_logging
from .helpers import msgpack
from .repository import Repository
from .version import parse_version, format_version
from .algorithms.checksums import xxh64
from .checksums import xxh64
from .helpers.datastruct import EfficientCollectionQueue
logger = create_logger(__name__)

View File

@ -25,7 +25,7 @@ from .locking import Lock, LockError, LockErrorT
from .logger import create_logger
from .lrucache import LRUCache
from .platform import SaveFile, SyncFile, sync_dir, safe_fadvise
from .algorithms.checksums import crc32
from .checksums import crc32
from .crypto.file_integrity import IntegrityCheckedFile, FileIntegrityError
logger = create_logger(__name__)

View File

@ -4,7 +4,7 @@ from binascii import unhexlify
import pytest
from ..algorithms import checksums
from .. import checksums
from ..helpers import bin_to_hex
crc32_implementations = [checksums.deflate_crc32]