[Scons-users] Is it normal that changing a construction environment does not trigger a build

Arevalo Reggeti, Juan Carlos Ramon (CW) exceltic-services.juan.arevalo at hp.com
Tue Oct 9 05:02:47 EDT 2018


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20181009/40f7cd6d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SConstruct.py
Type: application/octet-stream
Size: 514 bytes
Desc: SConstruct.py
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20181009/40f7cd6d/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ExecutionLog.txt
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20181009/40f7cd6d/attachment.txt>


More information about the Scons-users mailing list