1
0
Fork 0
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:
enkore 2017-05-26 00:47:11 +02:00 committed by GitHub
commit 7548f525c8

View file

@ -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 = []