[Scons-users] Question on Depends behavior vs. documentation (src_builders)

Bill Deegan bill at baddogconsulting.com
Fri Sep 30 22:16:10 EDT 2016


That's strange as the example output in the docs are actually automatically
generated by running scons in the doc build process.
I'll have to take a look.

Secondly, if you are creating a builder and want to add a dependency to it,
you should likely do so in an emitter.
Take a read through this:
https://bitbucket.org/scons/scons/wiki/ToolsForFools

On Fri, Sep 30, 2016 at 7:03 PM, Brennen, Jack <jbrennen at qti.qualcomm.com>
wrote:

> I'm confused here by the behavior of the example in Section 6.5 of the
> SCons User Guide 2.1.0.  It deviates from my observed behavior.  I'm seeing
> this:
>
>
> $ cat SConstruct
> hello = Program('hello.c')
> Depends(hello, 'other_file')
> $ scons -Q hello
> gcc -o hello.o -c hello.c
> gcc -o hello hello.o
> $ scons -Q hello
> scons: `hello' is up to date.
> $ echo '#' >> other_file
> $ scons -Q hello
> gcc -o hello hello.o
>
> In particular, it seems to only re-run the link step if "other_file" is
> modified; it doesn't re-run the compile step.
>
>
> This isn't particularly surprising to me, as I understand that there's an
> intermediate node hello.o between hello.c and hello, and I applied the
> dependency to the final program hello, not to hello.o.
>
>
> However, it conflicts directly with the example in Section 6.5 of the user
> guide, which shows that both build steps are re-run after modifying
> "other_file".
>
>
>
> Note that I'm not just complaining about the documentation not matching
> reality.  This comes about because I'm trying to make a builder of the
> "Program" style -- a builder that has src_builders that create intermediate
> nodes -- but I want something like Depends(target, 'other_file') to
> re-execute the entire builder including the src_builders.  I tried basing
> it on Program(), but found that Program() doesn't behave as advertised.  If
> somebody could tell me the magic incantation to get a builder to re-execute
> the src_builders every time a dependency changes, that would help me out a
> lot.
>
>
> All I've been able to come up with so far would be to have the builder
> wrap its _execute() method with one that saves the source Node list before
> calling the real _execute() method, and then add those sources back in to
> each Node returned by _execute() using add_dependency(), something like
> this pseudo-code:
>
>
>    def _execute(self, env, target, source):
>       ret = self.original_execute(env, target, source)
>       for node in ret:
>          node.add_dependency(node,source):
>       return ret
>
> I'm not too thrilled with doing something like that, though -- it looks like a total hack, and also seems like something that should be able to work in a much easier way.
>
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160930/f1da751f/attachment.html>


More information about the Scons-users mailing list