I have a python package which contains a C++ extension.
The C++ extension is built within setup.py
using its own Makefile, and the .so files are create in its own subfolder, and then copied in the build folder.
When I call python setup.py clean
, only the build directory is removed, but the cxxextension/build
is not removed, so if I build it again, it is just copied and not recompiled.
How can I instruct setup.py clean
to also remove my cxxextension/build
folder?
The easiest way would probably be to simply process it manually in setup.py. You could add something like this to it before calling distutils.setup:
import sys, shutil
if 'clean' in sys.argv:
shutil.rmtree('cxxextension/build')