[Scons-users] Customize build decision logic for phony targets, that doesn't involve files

Bill Deegan bill at baddogconsulting.com
Tue Mar 15 22:56:24 EDT 2016


Firstly when trying to figure out why scons is building/rebuilding
something you should run as:

scons --debug=explain

When run with your SConstruct above you get:

python ../hg/scons/src/script/scons.py -f dummy.scons  --debug=explain
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: building `target' because it doesn't exist
action(["target"], ['a'])
Do crazy things
scons: done building targets.

So it's not finding the target as built and thus trying to rebuild..
Curious though that Psuedo() isn't taking care of this.

Anyway if your builder doesn't read or write any files, perhaps you can
explain exactly what it does do?
What causes it to rebuild? What's the contents/source of the abstract value?

That may help to provide a solution.
It may be that the best solution is to have your action create a token file.

-Bil

On Tue, Mar 15, 2016 at 5:35 PM, Andrew Pashkin <andrew.pashkin at gmx.co.uk>
wrote:

> I have a target, that requires some time-expensive actions and depends on
> similar time-expensive targets. It's also a phony target, so it doesn't
> depends on a source files nor it doesn't produces a files. And I want to
> make SCons decide when to build this target or not depending on some
> abstract value. To me it would be ideal to use the capability of SCons,
> described in the manual as
>
> Value(value, [built_value]) , env.Value(value, [built_value])
> ... Value Nodes can be used as dependencies of targets. If the result of
> calling str(value) changes between SCons runs, any targets depending on
> Value(value) will be rebuilt.
>
>
> So I've build this SConstruct to test it:
>
> import random as rnd
>
>
> env = Environment()
>
>
> def action(**_):
>     print('Do crazy things')
>
> input = env.Value('a')
>
> env['BUILDERS']['Custom'] = Builder(action=action)
> env.Custom(target='target', source=input)
> env.Pseudo('target')
>
> And I expected SCons to stop rebuilding the target after the first build,
> since the value of the input Value remains constant between builds. But
> SCons rebuilds it every time.
>
> Is there any way to achieve what I'm talking about?
>
> --
> With kind regards, Andrew Pashkin.
> cell phone - +7 (985) 898 57 59
> Skype - waves_in_fluids
> e-mail - andrew.pashkin at gmx.co.uk
>
>
> _______________________________________________
> 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/20160315/8452e03c/attachment.html>


More information about the Scons-users mailing list