mirror of
https://github.com/borgbackup/borg.git
synced 2026-02-18 18:19:16 -05:00
Merge pull request #9330 from ThomasWaldmann/remove-check-python-master
Remove some checks (master)
This commit is contained in:
commit
feb81cf292
26 changed files with 15 additions and 75 deletions
|
|
@ -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_python, 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
|
||||
|
|
@ -455,10 +455,7 @@ class Archiver(
|
|||
return args
|
||||
|
||||
def prerun_checks(self, logger, is_serve):
|
||||
if not is_serve:
|
||||
# this is the borg *client*, we need to check the python:
|
||||
check_python()
|
||||
check_extension_modules()
|
||||
|
||||
selftest(logger)
|
||||
|
||||
def _setup_implied_logging(self, args):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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: ...
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# cython: language_level=3
|
||||
|
||||
API_VERSION = '1.2_01'
|
||||
|
||||
|
||||
import cython
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -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]: ...
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# cython: language_level=3
|
||||
|
||||
API_VERSION = '1.2_01'
|
||||
|
||||
|
||||
import cython
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
API_VERSION = "1.2_01"
|
||||
|
||||
import os
|
||||
import errno
|
||||
from typing import BinaryIO, Iterator
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
from typing import Iterator, BinaryIO
|
||||
|
||||
API_VERSION = "1.2_01"
|
||||
|
||||
import time
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# cython: language_level=3
|
||||
|
||||
API_VERSION = '1.2_01'
|
||||
|
||||
|
||||
import os
|
||||
import errno
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
from typing import Any, Type, Dict, Tuple
|
||||
|
||||
API_VERSION: str
|
||||
|
||||
def get_compressor(name: str, **kwargs) -> Any: ...
|
||||
|
||||
class CompressionSpec:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
from typing import NamedTuple, Tuple, Type, IO, Iterator, Any
|
||||
|
||||
API_VERSION: str
|
||||
|
||||
PATH_OR_FILE = str | IO
|
||||
|
||||
class ChunkIndexEntry(NamedTuple):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import struct
|
|||
|
||||
from borghash import HashTableNT
|
||||
|
||||
API_VERSION = '1.2_01'
|
||||
|
||||
|
||||
cdef _NoDefault = object()
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import logging
|
|||
from collections import namedtuple
|
||||
|
||||
from ..constants import * # NOQA
|
||||
from .checks import check_extension_modules, check_python
|
||||
|
||||
from .datastruct import StableDict, Buffer, EfficientCollectionQueue
|
||||
from .errors import Error, ErrorWithTraceback, IntegrityError, DecompressionError, CancelledByUser, CommandError
|
||||
from .errors import RTError, modern_ec
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
import os
|
||||
|
||||
from .errors import RTError
|
||||
from ..platformflags import is_win32
|
||||
|
||||
|
||||
def check_python():
|
||||
if is_win32:
|
||||
required_funcs = {os.stat}
|
||||
else:
|
||||
required_funcs = {os.stat, os.utime, os.chown}
|
||||
if not os.supports_follow_symlinks.issuperset(required_funcs):
|
||||
raise RTError("""FATAL: This Python was compiled for a too old (g)libc and lacks required functionality.""")
|
||||
|
||||
|
||||
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)
|
||||
|
|
@ -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: ...
|
||||
|
||||
|
|
|
|||
|
|
@ -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'):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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 *:
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue