From db50534de461aaa2007376478f0e08680f5756a3 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 13 Mar 2021 01:38:09 +0100 Subject: [PATCH 1/3] setup.py: get rid of distutils, use setuptools distutils is deprecated and gives warnings on py 3.10. rename "clean" to "clean2" to avoid shadowing the "clean" command. --- setup.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/setup.py b/setup.py index 5ca79af2b0..136bb844e9 100644 --- a/setup.py +++ b/setup.py @@ -52,10 +52,8 @@ ], } -from setuptools import setup, find_packages, Extension +from setuptools import setup, find_packages, Extension, Command from setuptools.command.sdist import sdist -from distutils.core import Command -from distutils.command.clean import clean compress_source = 'src/borg/compress.pyx' crypto_ll_source = 'src/borg/crypto/low_level.pyx' @@ -146,7 +144,7 @@ def __init__(self, *args, **kwargs): msgpack_packer_source = msgpack_packer_source.replace('.pyx', '.cpp') msgpack_unpacker_source = msgpack_unpacker_source.replace('.pyx', '.cpp') - from distutils.command.build_ext import build_ext + from setuptools.command.build_ext import build_ext if not on_rtd and not all(os.path.exists(path) for path in [ compress_source, crypto_ll_source, chunker_source, hashindex_source, item_source, checksums_source, platform_posix_source, platform_linux_source, platform_syncfilerange_source, platform_freebsd_source, platform_darwin_source, @@ -767,9 +765,16 @@ def rm(file): pass -class Clean(clean): +class Clean(Command): + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + def run(self): - super().run() for source in cython_c_sources: genc = source.replace('.pyx', '.c') rm(genc) @@ -786,7 +791,7 @@ def run(self): 'build_usage': build_usage, 'build_man': build_man, 'sdist': Sdist, - 'clean': Clean, + 'clean2': Clean, } ext_modules = [] From 1cbdcba5e94773cab20461a1f79d5147a5f0992d Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 1 May 2021 15:20:45 +0200 Subject: [PATCH 2/3] get rid of distutils, use packaging --- setup.py | 4 +++- src/borg/__init__.py | 5 +++-- src/borg/xattr.py | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 136bb844e9..e20ac1afed 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,9 @@ # Are we building on ReadTheDocs? on_rtd = os.environ.get('READTHEDOCS') -install_requires = [] +install_requires = [ + 'packaging', +] # note for package maintainers: if you package borgbackup for distribution, # please add llfuse as a *requirement* on all platforms that have a working diff --git a/src/borg/__init__.py b/src/borg/__init__.py index c2b201860a..4350ebc07d 100644 --- a/src/borg/__init__.py +++ b/src/borg/__init__.py @@ -1,11 +1,12 @@ -from distutils.version import LooseVersion +from packaging.version import parse as parse_version # IMPORTANT keep imports from borg here to a minimum because our testsuite depends on # beeing able to import borg.constants and then monkey patching borg.constants.PBKDF2_ITERATIONS from ._version import version as __version__ -__version_tuple__ = tuple(LooseVersion(__version__).version[:3]) +_v = parse_version(__version__) +__version_tuple__ = _v._version.release # assert that all semver components are integers # this is mainly to show errors when people repackage poorly diff --git a/src/borg/xattr.py b/src/borg/xattr.py index 8cdd189686..a28d6d205a 100644 --- a/src/borg/xattr.py +++ b/src/borg/xattr.py @@ -8,7 +8,7 @@ import tempfile from ctypes import CDLL, create_string_buffer, c_ssize_t, c_size_t, c_char_p, c_int, c_uint32, get_errno from ctypes.util import find_library -from distutils.version import LooseVersion +from packaging.version import parse as parse_version from .helpers import Buffer, prepare_subprocess_env @@ -90,8 +90,8 @@ def get_all(path, follow_symlinks=True): if preload.startswith("libfakeroot"): env = prepare_subprocess_env(system=True) fakeroot_output = subprocess.check_output(['fakeroot', '-v'], env=env) - fakeroot_version = LooseVersion(fakeroot_output.decode('ascii').split()[-1]) - if fakeroot_version >= LooseVersion("1.20.2"): + fakeroot_version = parse_version(fakeroot_output.decode('ascii').split()[-1]) + if fakeroot_version >= parse_version("1.20.2"): # 1.20.2 has been confirmed to have xattr support # 1.18.2 has been confirmed not to have xattr support # Versions in-between are unknown From 547dc674c8b1ee0f54ce4be17009d174480b50fd Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 16 Jun 2021 14:59:07 +0200 Subject: [PATCH 3/3] github CI: test on py310 (again) --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 268ea4b7cd..35caf585e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,9 +66,9 @@ jobs: - os: ubuntu-20.04 python-version: '3.9' toxenv: py39 - #- os: ubuntu-20.04 - # python-version: '3.10-dev' - # toxenv: py310 + - os: ubuntu-20.04 + python-version: '3.10-dev' + toxenv: py310 - os: macos-latest # note: it seems that 3.8 and 3.9 are currently broken, # neverending RuntimeError crashes...