[Scons-users] Is it normal that changing a construction environment does not trigger a build
Bill Deegan
bill at baddogconsulting.com
Tue Oct 9 08:48:11 EDT 2018
Also you should probably use:
target = env.MyBuilder('dummy_file.txt',Value('$DATA'))
To make it clear this is the source..
On Tue, Oct 9, 2018 at 8:47 AM Bill Deegan <bill at baddogconsulting.com>
wrote:
> Per the manpage: (search for varlist= in the manpage)
> Use Action()'s varlist argument like this:
>
> # Alternatively, use a keyword argument.
> a = Action(build_it, varlist=['DATA'])
>
>
>
> On Tue, Oct 9, 2018 at 5:02 AM Arevalo Reggeti, Juan Carlos Ramon (CW) <
> exceltic-services.juan.arevalo at hp.com> wrote:
>
>> Hi all,
>>
>>
>>
>> I noticed that in SCons the decider is not called on targets with no
>> dependencies, which I can understand given that the build should entirely
>> depend on the construction env.
>>
>> However, I noticed that if you changed the environment on a target with
>> no dependencies the build is not triggered, but it is when the builder is
>> changed.
>>
>>
>>
>> I put together an example below (and attached the files) where every time
>> the SConstruct file is read the environment changes, but the target gets
>> built only once.
>>
>>
>>
>> My questions are: Shouldn’t a change in the environment trigger a new
>> build? If not, is there a workaround other than including a dummy target to
>> make a custom decider that compares environments?
>>
>>
>>
>> For example take this simple SConstruct:
>>
>>
>>
>> ******************* SCONSTRUCT**************
>>
>> #!python
>>
>>
>>
>> import random
>>
>>
>>
>> print ("-----------NEW EXECUTION-----------")
>>
>> env = Environment(DATA = str(random.randint(0,20)) + "\n")
>>
>>
>>
>> def generate_dummy_file(target, env):
>>
>> with open(str(target), 'w') as f:
>>
>> f.write(env["DATA"])
>>
>>
>>
>> def my_builder(target, source, env):
>>
>> generate_dummy_file(target[0], env)
>>
>>
>>
>> env.Append(BUILDERS = {'MyBuilder' : Builder(action=my_builder)})
>>
>>
>>
>>
>>
>>
>>
>> print ("Environment data: " + env["DATA"])
>>
>> print ("")
>>
>> target = env.MyBuilder('dummy_file.txt',[])
>>
>>
>>
>> *************** EXECUTION LOG *******************
>>
>>
>>
>> [arevalor at vl337 example]$ for INDEX in {1..2}; do scons; done
>>
>> scons: Reading SConscript files ...
>>
>> -----------NEW EXECUTION-----------
>>
>> Environment data: 13
>>
>>
>>
>>
>>
>> scons: done reading SConscript files.
>>
>> scons: Building targets ...
>>
>> my_builder(["dummy_file.txt"], [])
>>
>> scons: done building targets.
>>
>> scons: Reading SConscript files ...
>>
>> -----------NEW EXECUTION-----------
>>
>> Environment data: 7
>>
>>
>>
>>
>>
>> scons: done reading SConscript files.
>>
>> scons: Building targets ...
>>
>> scons: `.' is up to date.
>>
>> scons: done building targets.
>>
>>
>> _______________________________________________
>> 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/20181009/19b89584/attachment.html>
More information about the Scons-users
mailing list