From db50534de461aaa2007376478f0e08680f5756a3 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 13 Mar 2021 01:38:09 +0100 Subject: [PATCH] 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 5ca79af2b..136bb844e 100644 --- a/setup.py +++ b/setup.py @@ -52,10 +52,8 @@ extras_require = { ], } -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 @@ except ImportError: 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 @@ cmdclass = { 'build_usage': build_usage, 'build_man': build_man, 'sdist': Sdist, - 'clean': Clean, + 'clean2': Clean, } ext_modules = []