pythonscons

How can I call Scons from a Python program as a library?


I have a Python program, whose workflow over a set of files that could be nicely expressed using "build" dependencies with Scons as follows:

Is it possible to eliminate the creation of SConstruct file and calling scons on it, and do that directly from my Python program? After all, SConstruct is a Python program, just that it's called by scons in a special fashion.


Solution

  • Possible, yes.

    Recommended, very much not so. It was never designed with that type of usage and so doing so will be very complicated, and it is not a supported usage by the SCons maintainers.

    See Mats comment above for some of the details why.

    I'd keep using the flow you've got working now. You won't simplify anything by embedding SCons.