Re: Is it normal that changing a construction environment does not trigger a build

Bill Deegan <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAEyG4CGkR=06_8GzOBLfhxp1+K4DFQn8RU=H2D-Mz1_WPNH4ug@mail.gmail.com>
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) <
[email protected]> 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@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
> [email protected]
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.