2
0
Эх сурвалжийг харах

Merge pull request #6460 from ThomasWaldmann/move-checksums

remove algorithms package, move checksums module to borg package
TW 3 жил өмнө
parent
commit
cb0e4fc2b2

+ 2 - 2
setup.py

@@ -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)

+ 0 - 6
src/borg/algorithms/__init__.py

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

+ 2 - 2
src/borg/archiver.py

@@ -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 = [

+ 2 - 2
src/borg/algorithms/checksums.pyx → src/borg/checksums.pyx

@@ -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

+ 1 - 1
src/borg/crypto/file_integrity.py

@@ -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()
 

+ 1 - 1
src/borg/helpers/parseformat.py

@@ -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

+ 1 - 1
src/borg/remote.py

@@ -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__)

+ 1 - 1
src/borg/repository.py

@@ -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__)

+ 1 - 1
src/borg/testsuite/checksums.py

@@ -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]