remove API_VERSION check

we now have better build tools and these exceptions have
not been seen since long.
This commit is contained in:
Thomas Waldmann 2026-02-14 20:45:09 +01:00
parent 013edcd558
commit 391252476d
No known key found for this signature in database
GPG key ID: 9F88FB52FAF7B393
26 changed files with 14 additions and 60 deletions

View file

@ -40,7 +40,7 @@ try:
from ..helpers import format_file_size
from ..helpers import remove_surrogates, text_to_json
from ..helpers import DatetimeWrapper, replace_placeholders
from ..helpers import check_extension_modules
from ..helpers import is_slow_msgpack, is_supported_msgpack, sysinfo
from ..helpers import signal_handler, raising_signal_handler, SigHup, SigTerm
from ..helpers import ErrorIgnoringTextIOWrapper
@ -456,7 +456,6 @@ class Archiver(
def prerun_checks(self, logger, is_serve):
check_extension_modules()
selftest(logger)
def _setup_implied_logging(self, args):

View file

@ -4,8 +4,6 @@ from .failing import ChunkerFailing
from .fixed import ChunkerFixed
from .reader import * # noqa
API_VERSION = "1.2_01"
def get_chunker(algo, *params, **kw):
key = kw.get("key", None)

View file

@ -2,8 +2,6 @@ from typing import List, Iterator, BinaryIO
from .reader import fmap_entry
API_VERSION: str
def buzhash(data: bytes, seed: int) -> int: ...
def buzhash_update(sum: int, remove: int, add: int, len: int, seed: int) -> int: ...

View file

@ -1,6 +1,6 @@
# cython: language_level=3
API_VERSION = '1.2_01'
import cython
import time

View file

@ -2,8 +2,6 @@ from typing import List, Iterator, BinaryIO
from .reader import fmap_entry
API_VERSION: str
def buzhash64(data: bytes, key: bytes) -> int: ...
def buzhash64_update(sum: int, remove: int, add: int, len: int, key: bytes) -> int: ...
def buzhash64_get_table(key: bytes) -> List[int]: ...

View file

@ -1,6 +1,6 @@
# cython: language_level=3
API_VERSION = '1.2_01'
import cython
import time

View file

@ -1,5 +1,3 @@
API_VERSION = "1.2_01"
import os
import errno
from typing import BinaryIO, Iterator

View file

@ -1,6 +1,5 @@
from typing import Iterator, BinaryIO
API_VERSION = "1.2_01"
import time

View file

@ -1,7 +1,5 @@
from typing import NamedTuple, Tuple, Dict, List, Any, Type, BinaryIO, Iterator
API_VERSION: str
has_seek_hole: bool
class _Chunk(NamedTuple):

View file

@ -1,6 +1,6 @@
# cython: language_level=3
API_VERSION = '1.2_01'
import os
import errno

View file

@ -1,7 +1,5 @@
from typing import Any, Type, Dict, Tuple
API_VERSION: str
def get_compressor(name: str, **kwargs) -> Any: ...
class CompressionSpec:

View file

@ -29,7 +29,7 @@ except ImportError:
from .constants import MAX_DATA_SIZE, ROBJ_FILE_STREAM
from .helpers import Buffer, DecompressionError
API_VERSION = '1.2_02'
cdef extern from "lz4.h":
int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize) nogil

View file

@ -3,8 +3,6 @@
from typing import Optional, Union
API_VERSION: str
# Module-level functions
def num_cipher_blocks(length: int, blocksize: int = 16) -> int:
"""Return the number of cipher blocks required to encrypt/decrypt <length> bytes of data."""

View file

@ -45,7 +45,7 @@ from libc.stdlib cimport malloc, free
from libc.stdint cimport uint8_t, uint32_t, uint64_t
from libc.string cimport memset, memcpy
API_VERSION = '1.3_01'
cdef extern from "openssl/crypto.h":
int CRYPTO_memcmp(const void *a, const void *b, size_t len)

View file

@ -1,7 +1,5 @@
from typing import NamedTuple, Tuple, Type, IO, Iterator, Any
API_VERSION: str
PATH_OR_FILE = str | IO
class ChunkIndexEntry(NamedTuple):

View file

@ -5,7 +5,7 @@ import struct
from borghash import HashTableNT
API_VERSION = '1.2_01'
cdef _NoDefault = object()

View file

@ -10,7 +10,7 @@ import logging
from collections import namedtuple
from ..constants import * # NOQA
from .checks import check_extension_modules
from .datastruct import StableDict, Buffer, EfficientCollectionQueue
from .errors import Error, ErrorWithTraceback, IntegrityError, DecompressionError, CancelledByUser, CommandError
from .errors import RTError, modern_ec

View file

@ -1,19 +0,0 @@
from .errors import RTError
def check_extension_modules():
from .. import platform, compress, crypto, item, hashindex, chunkers
msg = """The Borg binary extension modules do not seem to be properly installed."""
if hashindex.API_VERSION != "1.2_01":
raise RTError(msg)
if chunkers.API_VERSION != "1.2_01":
raise RTError(msg)
if compress.API_VERSION != "1.2_02":
raise RTError(msg)
if crypto.low_level.API_VERSION != "1.3_01":
raise RTError(msg)
if item.API_VERSION != "1.2_01":
raise RTError(msg)
if platform.API_VERSION != platform.OS_API_VERSION or platform.API_VERSION != "1.2_05":
raise RTError(msg)

View file

@ -2,8 +2,6 @@ from typing import Set, NamedTuple, Tuple, Mapping, Dict, List, Iterator, Callab
from .helpers import StableDict
API_VERSION: str
def want_bytes(v: Any, *, errors: str = ...) -> bytes: ...
def chunks_contents_equal(chunks1: Iterator, chunks2: Iterator) -> bool: ...

View file

@ -17,7 +17,7 @@ cdef extern from "_item.c":
object _optr_to_object(object bytes)
API_VERSION = '1.2_01'
def fix_key(data, key, *, errors='strict'):

View file

@ -8,7 +8,7 @@ from types import ModuleType
from ..platformflags import is_win32, is_linux, is_freebsd, is_netbsd, is_darwin, is_cygwin, is_haiku
from .base import ENOATTR, API_VERSION
from .base import ENOATTR
from .base import SaveFile, sync_dir, fdatasync, safe_fadvise
from .base import get_process_id, fqdn, hostname, hostid, swidth
@ -18,7 +18,6 @@ from . import xattr # noqa: F401
platform_ug: ModuleType | None = None # make mypy happy
if is_linux: # pragma: linux only
from .linux import API_VERSION as OS_API_VERSION
from .linux import listxattr, getxattr, setxattr
from .linux import acl_get, acl_set
from .linux import set_flags, get_flags
@ -28,7 +27,6 @@ if is_linux: # pragma: linux only
from .posix import getosusername
from . import posix_ug as platform_ug
elif is_freebsd: # pragma: freebsd only
from .freebsd import API_VERSION as OS_API_VERSION
from .freebsd import listxattr, getxattr, setxattr
from .freebsd import acl_get, acl_set
from .freebsd import set_flags
@ -39,7 +37,6 @@ elif is_freebsd: # pragma: freebsd only
from .posix import getosusername
from . import posix_ug as platform_ug
elif is_netbsd: # pragma: netbsd only
from .netbsd import API_VERSION as OS_API_VERSION
from .netbsd import listxattr, getxattr, setxattr
from .base import acl_get, acl_set
from .base import set_flags, get_flags
@ -49,7 +46,6 @@ elif is_netbsd: # pragma: netbsd only
from .posix import getosusername
from . import posix_ug as platform_ug
elif is_darwin: # pragma: darwin only
from .darwin import API_VERSION as OS_API_VERSION
from .darwin import listxattr, getxattr, setxattr
from .darwin import acl_get, acl_set
from .darwin import is_darwin_feature_64_bit_inode, _get_birthtime_ns
@ -62,7 +58,6 @@ elif is_darwin: # pragma: darwin only
from . import posix_ug as platform_ug
elif not is_win32: # pragma: posix only
# Generic code for all other POSIX OSes
OS_API_VERSION = API_VERSION
from .base import listxattr, getxattr, setxattr
from .base import acl_get, acl_set
from .base import set_flags, get_flags
@ -73,7 +68,6 @@ elif not is_win32: # pragma: posix only
from . import posix_ug as platform_ug
else: # pragma: win32 only
# Win32-specific stuff
OS_API_VERSION = API_VERSION
from .base import listxattr, getxattr, setxattr
from .base import acl_get, acl_set
from .base import set_flags, get_flags

View file

@ -20,7 +20,6 @@ platform API; in this way, platform APIs provided by the platform-specific suppo
are correctly composed into the base functionality.
"""
API_VERSION = "1.2_05"
fdatasync = getattr(os, "fdatasync", os.fsync)
has_posix_fadvise = hasattr(os, "posix_fadvise")

View file

@ -8,7 +8,7 @@ from . import posix_ug
from ..helpers import safe_decode, safe_encode
from .xattr import _listxattr_inner, _getxattr_inner, _setxattr_inner, split_string0
API_VERSION = '1.2_05'
cdef extern from *:
"""

View file

@ -7,7 +7,7 @@ from .posix import posix_acl_use_stored_uid_gid
from ..helpers import safe_encode, safe_decode
from .xattr import _listxattr_inner, _getxattr_inner, _setxattr_inner, split_lstring
API_VERSION = '1.2_05'
cdef extern from "sys/extattr.h":
ssize_t c_extattr_list_file "extattr_list_file" (const char *path, int attrnamespace, void *data, size_t nbytes)

View file

@ -17,7 +17,7 @@ except ImportError:
from libc cimport errno
API_VERSION = '1.2_05'
cdef extern from "sys/xattr.h":
ssize_t c_listxattr "listxattr" (const char *path, char *list, size_t size)

View file

@ -1,6 +1,6 @@
from .xattr import _listxattr_inner, _getxattr_inner, _setxattr_inner, split_lstring
API_VERSION = '1.2_05'
cdef extern from "sys/extattr.h":
ssize_t c_extattr_list_file "extattr_list_file" (const char *path, int attrnamespace, void *data, size_t nbytes)