diff --git a/setup.py b/setup.py index e2998c8e0..5dfcbb306 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,7 @@ compress_source = 'src/borg/compress.pyx' crypto_source = 'src/borg/crypto.pyx' chunker_source = 'src/borg/chunker.pyx' hashindex_source = 'src/borg/hashindex.pyx' +item_source = 'src/borg/item.pyx' platform_posix_source = 'src/borg/platform/posix.pyx' platform_linux_source = 'src/borg/platform/linux.pyx' platform_darwin_source = 'src/borg/platform/darwin.pyx' @@ -60,6 +61,7 @@ cython_sources = [ crypto_source, chunker_source, hashindex_source, + item_source, platform_posix_source, platform_linux_source, @@ -83,6 +85,7 @@ try: 'src/borg/crypto.c', 'src/borg/chunker.c', 'src/borg/_chunker.c', 'src/borg/hashindex.c', 'src/borg/_hashindex.c', + 'src/borg/item.c', 'src/borg/platform/posix.c', 'src/borg/platform/linux.c', 'src/borg/platform/freebsd.c', @@ -99,6 +102,7 @@ except ImportError: crypto_source = crypto_source.replace('.pyx', '.c') chunker_source = chunker_source.replace('.pyx', '.c') hashindex_source = hashindex_source.replace('.pyx', '.c') + item_source = item_source.replace('.pyx', '.c') platform_posix_source = platform_posix_source.replace('.pyx', '.c') platform_linux_source = platform_linux_source.replace('.pyx', '.c') platform_freebsd_source = platform_freebsd_source.replace('.pyx', '.c') @@ -358,7 +362,8 @@ if not on_rtd: Extension('borg.compress', [compress_source], libraries=['lz4'], include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros), Extension('borg.crypto', [crypto_source], libraries=crypto_libraries, include_dirs=include_dirs, library_dirs=library_dirs, define_macros=define_macros), Extension('borg.chunker', [chunker_source]), - Extension('borg.hashindex', [hashindex_source]) + Extension('borg.hashindex', [hashindex_source]), + Extension('borg.item', [item_source]), ] if sys.platform.startswith(('linux', 'freebsd', 'darwin')): ext_modules.append(Extension('borg.platform.posix', [platform_posix_source])) diff --git a/src/borg/helpers.py b/src/borg/helpers.py index a1624f1ad..0b2e016b5 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -86,7 +86,7 @@ class PlaceholderError(Error): def check_extension_modules(): - from . import platform, compress + from . import platform, compress, item if hashindex.API_VERSION != 4: raise ExtensionModuleError if chunker.API_VERSION != 2: @@ -97,6 +97,8 @@ def check_extension_modules(): raise ExtensionModuleError if platform.API_VERSION != platform.OS_API_VERSION != 5: raise ExtensionModuleError + if item.API_VERSION != 1: + raise ExtensionModuleError ArchiveInfo = namedtuple('ArchiveInfo', 'name id ts') diff --git a/src/borg/item.py b/src/borg/item.pyx similarity index 99% rename from src/borg/item.py rename to src/borg/item.pyx index e44e4367b..755f96be8 100644 --- a/src/borg/item.py +++ b/src/borg/item.pyx @@ -3,6 +3,8 @@ from .helpers import safe_encode, safe_decode from .helpers import bigint_to_int, int_to_bigint from .helpers import StableDict +API_VERSION = 1 + class PropDict: """