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

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Wed Mar 16 09:54:03 EDT 2016


Pseudo just says 'this doesn't produce a target so it's not an error to not find it after the build', should you have turned on the 'warn if the target isn't produced' warning.

It doesn't change that if you haven't produced the expected target, there'll be a lot of rebuilds. It was intended for 'this is just a handle on something I'm going to do anyway and it doesn't create a file as a result' actions, much like the .PHONY target in gnu make.

If it was going to do what Bill suggested, it'd have to then mark the action as something that couldn't be used by any other client in a build, which would be tricky.


From: scons-users at scons.org At: Mar 16 2016 02:56:39
To: scons-users at scons.org
Subject: Re: [Scons-users] Customize build decision logic for phony targets, that doesn't involve files

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


         _______________________________________________
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/20160316/258613a2/attachment.html>


More information about the Scons-users mailing list