mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 08:16:54 +00:00
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.
This commit is contained in:
parent
99065a4034
commit
9d8d64c5e3
1 changed files with 13 additions and 7 deletions
20
setup.py
20
setup.py
|
@ -11,9 +11,8 @@
|
||||||
multiprocessing = None
|
multiprocessing = None
|
||||||
|
|
||||||
from setuptools.command.build_ext import build_ext
|
from setuptools.command.build_ext import build_ext
|
||||||
from setuptools import setup, find_packages, Extension
|
from setuptools import setup, find_packages, Extension, Command
|
||||||
from setuptools.command.sdist import sdist
|
from setuptools.command.sdist import sdist
|
||||||
from distutils.command.clean import clean
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from Cython.Build import cythonize
|
from Cython.Build import cythonize
|
||||||
|
@ -137,9 +136,16 @@ def rm(file):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Clean(clean):
|
class Clean(Command):
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
super().run()
|
|
||||||
for source in cython_sources:
|
for source in cython_sources:
|
||||||
genc = source.replace('.pyx', '.c')
|
genc = source.replace('.pyx', '.c')
|
||||||
rm(genc)
|
rm(genc)
|
||||||
|
@ -153,7 +159,7 @@ def run(self):
|
||||||
'build_usage': setup_docs.build_usage,
|
'build_usage': setup_docs.build_usage,
|
||||||
'build_man': setup_docs.build_man,
|
'build_man': setup_docs.build_man,
|
||||||
'sdist': Sdist,
|
'sdist': Sdist,
|
||||||
'clean': Clean,
|
'clean2': Clean,
|
||||||
}
|
}
|
||||||
|
|
||||||
ext_modules = []
|
ext_modules = []
|
||||||
|
@ -220,8 +226,8 @@ def members_appended(*ds):
|
||||||
|
|
||||||
# sometimes there's no need to cythonize
|
# sometimes there's no need to cythonize
|
||||||
# this breaks chained commands like 'clean sdist'
|
# this breaks chained commands like 'clean sdist'
|
||||||
cythonizing = len(sys.argv) > 1 and sys.argv[1] not in ('clean', 'egg_info', '--help-commands', '--version') \
|
cythonizing = len(sys.argv) > 1 and sys.argv[1] not in (
|
||||||
and '--help' not in sys.argv[1:]
|
('clean', 'clean2', 'egg_info', '--help-commands', '--version')) and '--help' not in sys.argv[1:]
|
||||||
|
|
||||||
if cythonize and cythonizing:
|
if cythonize and cythonizing:
|
||||||
cython_opts = dict(
|
cython_opts = dict(
|
||||||
|
|
Loading…
Reference in a new issue