mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 01:06:50 +00:00
Merge pull request #2569 from enkore/f/setup-cclean
setup.py clean to remove compiled files
This commit is contained in:
commit
7548f525c8
1 changed files with 21 additions and 1 deletions
22
setup.py
22
setup.py
|
@ -48,6 +48,7 @@
|
||||||
|
|
||||||
from setuptools import setup, find_packages, Extension
|
from setuptools import setup, find_packages, Extension
|
||||||
from setuptools.command.sdist import sdist
|
from setuptools.command.sdist import sdist
|
||||||
|
from distutils.command.clean import clean
|
||||||
|
|
||||||
compress_source = 'src/borg/compress.pyx'
|
compress_source = 'src/borg/compress.pyx'
|
||||||
crypto_ll_source = 'src/borg/crypto/low_level.pyx'
|
crypto_ll_source = 'src/borg/crypto/low_level.pyx'
|
||||||
|
@ -567,11 +568,30 @@ def is_positional_group(group):
|
||||||
write(option.ljust(padding), desc)
|
write(option.ljust(padding), desc)
|
||||||
|
|
||||||
|
|
||||||
|
class Clean(clean):
|
||||||
|
def run(self):
|
||||||
|
super().run()
|
||||||
|
for source in cython_sources:
|
||||||
|
genc = source.replace('.pyx', '.c')
|
||||||
|
try:
|
||||||
|
os.unlink(genc)
|
||||||
|
print('rm', genc)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
compiled_glob = source.replace('.pyx', '.cpython*')
|
||||||
|
for compiled in glob(compiled_glob):
|
||||||
|
try:
|
||||||
|
os.unlink(compiled)
|
||||||
|
print('rm', compiled)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
'build_ext': build_ext,
|
'build_ext': build_ext,
|
||||||
'build_usage': build_usage,
|
'build_usage': build_usage,
|
||||||
'build_man': build_man,
|
'build_man': build_man,
|
||||||
'sdist': Sdist
|
'sdist': Sdist,
|
||||||
|
'clean': Clean,
|
||||||
}
|
}
|
||||||
|
|
||||||
ext_modules = []
|
ext_modules = []
|
||||||
|
|
Loading…
Reference in a new issue