Skip to content

Commit 013edcd

Browse files
cleanup: remove check_python() compatibility shim
The check_python() function verified that the Python runtime supported 'follow_symlinks' for os.stat, os.utime, and os.chown. This check is no longer necessary because: 1. Borg now requires Python >= 3.10. 2. On POSIX systems (Linux, macOS, *BSD, Haiku, OmniOS), support for these operations relies on the *at syscalls (fstatat, etc.), which have been implemented in standard libc for well over a decade (e.g., FreeBSD 8.0+, NetBSD 6.0+, Solaris 11+). 3. On Windows (MSYS2/MinGW), Python has supported follow_symlinks for os.stat since Python 3.2. The removed check specifically inspected only os.stat on Windows, avoiding the problematic os.utime/os.chown checks. Any platform capable of running Python 3.10 will inherently support these standard file operations.
1 parent 40dcfe4 commit 013edcd

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

src/borg/archiver/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
from ..helpers import format_file_size
4141
from ..helpers import remove_surrogates, text_to_json
4242
from ..helpers import DatetimeWrapper, replace_placeholders
43-
from ..helpers import check_python, check_extension_modules
43+
from ..helpers import check_extension_modules
4444
from ..helpers import is_slow_msgpack, is_supported_msgpack, sysinfo
4545
from ..helpers import signal_handler, raising_signal_handler, SigHup, SigTerm
4646
from ..helpers import ErrorIgnoringTextIOWrapper
@@ -455,9 +455,7 @@ def parse_args(self, args=None):
455455
return args
456456

457457
def prerun_checks(self, logger, is_serve):
458-
if not is_serve:
459-
# this is the borg *client*, we need to check the python:
460-
check_python()
458+
461459
check_extension_modules()
462460
selftest(logger)
463461

src/borg/helpers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from collections import namedtuple
1111

1212
from ..constants import * # NOQA
13-
from .checks import check_extension_modules, check_python
13+
from .checks import check_extension_modules
1414
from .datastruct import StableDict, Buffer, EfficientCollectionQueue
1515
from .errors import Error, ErrorWithTraceback, IntegrityError, DecompressionError, CancelledByUser, CommandError
1616
from .errors import RTError, modern_ec

src/borg/helpers/checks.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
1-
import os
2-
31
from .errors import RTError
4-
from ..platformflags import is_win32
5-
6-
7-
def check_python():
8-
if is_win32:
9-
required_funcs = {os.stat}
10-
else:
11-
required_funcs = {os.stat, os.utime, os.chown}
12-
if not os.supports_follow_symlinks.issuperset(required_funcs):
13-
raise RTError("""FATAL: This Python was compiled for a too old (g)libc and lacks required functionality.""")
142

153

164
def check_extension_modules():

0 commit comments

Comments
 (0)