1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-01-03 05:35:58 +00:00

Merge pull request #2633 from enkore/precise-pangolin

borg.algorithms definition
This commit is contained in:
enkore 2017-06-08 00:19:38 +02:00 committed by GitHub
commit b0e4c432a5
8 changed files with 23 additions and 12 deletions

2
.gitignore vendored
View file

@ -8,7 +8,7 @@ src/borg/compress.c
src/borg/crypto/low_level.c src/borg/crypto/low_level.c
src/borg/hashindex.c src/borg/hashindex.c
src/borg/item.c src/borg/item.c
src/borg/algorithms/chunker.c src/borg/chunker.c
src/borg/algorithms/checksums.c src/borg/algorithms/checksums.c
src/borg/platform/darwin.c src/borg/platform/darwin.c
src/borg/platform/freebsd.c src/borg/platform/freebsd.c

View file

@ -52,7 +52,7 @@
compress_source = 'src/borg/compress.pyx' compress_source = 'src/borg/compress.pyx'
crypto_ll_source = 'src/borg/crypto/low_level.pyx' crypto_ll_source = 'src/borg/crypto/low_level.pyx'
chunker_source = 'src/borg/algorithms/chunker.pyx' chunker_source = 'src/borg/chunker.pyx'
hashindex_source = 'src/borg/hashindex.pyx' hashindex_source = 'src/borg/hashindex.pyx'
item_source = 'src/borg/item.pyx' item_source = 'src/borg/item.pyx'
checksums_source = 'src/borg/algorithms/checksums.pyx' checksums_source = 'src/borg/algorithms/checksums.pyx'
@ -89,7 +89,7 @@ def make_distribution(self):
self.filelist.extend([ self.filelist.extend([
'src/borg/compress.c', 'src/borg/compress.c',
'src/borg/crypto/low_level.c', 'src/borg/crypto/low_level.c',
'src/borg/algorithms/chunker.c', 'src/borg/algorithms/buzhash.c', 'src/borg/chunker.c', 'src/borg/_chunker.c',
'src/borg/hashindex.c', 'src/borg/_hashindex.c', 'src/borg/hashindex.c', 'src/borg/_hashindex.c',
'src/borg/item.c', 'src/borg/item.c',
'src/borg/algorithms/checksums.c', 'src/borg/algorithms/checksums.c',
@ -623,8 +623,9 @@ def run(self):
Extension('borg.crypto.low_level', [crypto_ll_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros), Extension('borg.crypto.low_level', [crypto_ll_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros),
Extension('borg.hashindex', [hashindex_source]), Extension('borg.hashindex', [hashindex_source]),
Extension('borg.item', [item_source]), Extension('borg.item', [item_source]),
Extension('borg.algorithms.chunker', [chunker_source]), Extension('borg.chunker', [chunker_source]),
Extension('borg.algorithms.checksums', [checksums_source]), Extension('borg.algorithms.checksums', [checksums_source]),
] ]
if not sys.platform.startswith(('win32', )): if not sys.platform.startswith(('win32', )):
ext_modules.append(Extension('borg.platform.posix', [platform_posix_source])) ext_modules.append(Extension('borg.platform.posix', [platform_posix_source]))

View file

@ -0,0 +1,11 @@
"""
borg.algorithms
===============
This package is intended for hash and checksum functions.
Ideally these would be sourced from existing libraries,
but are frequently not available yet (blake2), are
available but in poor form (crc32) or don't really
make sense as a library (xxHash).
"""

View file

@ -20,7 +20,7 @@
logger = create_logger() logger = create_logger()
from . import xattr from . import xattr
from .algorithms.chunker import Chunker from .chunker import Chunker
from .cache import ChunkListEntry from .cache import ChunkListEntry
from .crypto.key import key_factory from .crypto.key import key_factory
from .compress import Compressor, CompressionSpec from .compress import Compressor, CompressionSpec

View file

@ -4,7 +4,7 @@ API_VERSION = '1.1_01'
from libc.stdlib cimport free from libc.stdlib cimport free
cdef extern from "buzhash.c": cdef extern from "_chunker.c":
ctypedef int uint32_t ctypedef int uint32_t
ctypedef struct _Chunker "Chunker": ctypedef struct _Chunker "Chunker":
pass pass

View file

@ -1,11 +1,11 @@
import argparse import argparse
import collections
import contextlib import contextlib
import collections
import grp import grp
import hashlib import hashlib
import logging
import io import io
import json import json
import logging
import os import os
import os.path import os.path
import platform import platform
@ -27,21 +27,20 @@
from functools import partial, lru_cache from functools import partial, lru_cache
from itertools import islice from itertools import islice
from operator import attrgetter from operator import attrgetter
from shutil import get_terminal_size
from string import Formatter from string import Formatter
from shutil import get_terminal_size
import msgpack import msgpack
import msgpack.fallback import msgpack.fallback
from .logger import create_logger from .logger import create_logger
logger = create_logger() logger = create_logger()
import borg.crypto.low_level import borg.crypto.low_level
from . import __version__ as borg_version from . import __version__ as borg_version
from . import __version_tuple__ as borg_version_tuple from . import __version_tuple__ as borg_version_tuple
from . import chunker
from . import hashindex from . import hashindex
from .algorithms import chunker
from .constants import * # NOQA from .constants import * # NOQA

View file

@ -1,6 +1,6 @@
from io import BytesIO from io import BytesIO
from ..algorithms.chunker import Chunker, buzhash, buzhash_update from ..chunker import Chunker, buzhash, buzhash_update
from ..constants import * # NOQA from ..constants import * # NOQA
from . import BaseTestCase from . import BaseTestCase