[Scons-users] Is a post-build function possible ?

William Deegan bill at baddogconsulting.com
Thu Jun 28 01:20:21 EDT 2012


On 06/26/2012 01:51 PM, Ray Pasco wrote:

> On 2012-06-26 1:35 PM, William Deegan wrote:

>> Ray,

>>

>> On Jun 26, 2012, at 4:00 AM, Ray Pasco wrote:

>>

>>> On 2012-06-25 10:30 PM, William Deegan wrote:

>>>> Ray,

>>>> On Jun 25, 2012, at 6:24 PM, Ray Pasco wrote:

>>>>

>>>>> I understand that execution order is random for Program(),

>>>>> Action(), etc., because [sic]. But, is there a way to execute a

>>>>> post-build command or function which is defined within file

>>>>> SContruct ? (This would be similar to the wxPython method

>>>>> CallAfter(). )

>>>>

>>>> Order is not random. A DAG (directed acyclic graph) is constructed

>>>> based on the dependencies, both explicit and implicit.

>>>>

>>>> You can use the python atexit to have something done at the end of

>>>> the SCons run.

>>>> http://docs.python.org/library/atexit.html

>>>>

>>>> Or you can use AddPostAction() to be run after a target is built.

>>>> (see: http://scons.org/doc/production/HTML/scons-man.html and

>>>> search for AddPostAction() )

>>>>

>>>> -Bill

>>>>

>>>

>>> Thanks, AddPostAction looks like what I need.

>>>

>>> I'm just trying to "black box" just the high-level basics of SCons.

>>> I should have been more specific: If I create a single environment

>>> and then call Environment.Program() twice for two independent

>>> targets, wouldn't the actual execution of the Program calls be

>>> random despite what order they appear in the SConstruct file ?

>>

>> Nope. Shouldn't be random.

>> The algorithm is deterministic as far as I know.

>> If you run -j anything, it may seem random, but that's likely due to

>> variations in the runtime of the many jobs run.

>> If you run SCons 10 times without -j, for a clean build, you should

>> (as far as i know) see it do the same compiles in the same order.

>>

>> -Bill

>

> That's what I have seen, but could I predict _before any runs_ what

> that order would be ?


scons --tree=prune should give you the tree, and then (I believe) you
could determine from that.

-Bill



More information about the Scons-users mailing list