views:

154

answers:

2

I have a C++ library that I build using Scons which is eventually linked into (among other things) a Python extension.

Once I have built the library with scons, I have written a standard setup.py script which I call to build and install the extension.

My main problem is that setup.py does not recognize when the library has been rebuilt (only when the extension's code has been changed), so every time I rebuild the library, I have to "clean" the extension before building it again. Also, if I change the directory structure, I would prefer to only need to edit the Scons files. And finally, it's just slightly more convenient to need only call scons instead of having to call scons in addition to setup.py.

Does anyone know of a way to integrate distutils into Scons so that it can take advantage of the knowledge Scons has about which files need to be rebuilt?

+1  A: 

You can do any command line from SCons. See Writing Your Own Builders. Then, you can detect any changes for a given file format by writing a scanner.

Ross Rogers
A: 

I have successfully created SConstruct to compile extensions for Python written in Pyrex. The main idea is to get appropriate C-compiler flags from distutils and then setup your Environment.

Check this pages on scons wiki:

bialix