[Scons-users] Unexpected warning when defining a target twice during reading of SConscripts
Andrew Featherstone
andrew.featherstone at gmail.com
Fri Dec 1 20:54:19 EST 2017
They might be different instances, but they're also equal. Surely something
must be sharing information or we'd see something like
scons: Building targets ...
simple_cmd(["foo.out"], ["foo.in"])
simple_cmd(["foo.out"], ["foo.in"])
scons: done building targets.
In the logs.
Andrew
On 2 Dec 2017 00:26, "Bill Deegan" <bill at baddogconsulting.com> wrote:
Here's my recipe for finding such in the sources:
$ grep -r "Two different environments" src/engine/SCons/
src/engine/SCons/Builder.py: msg = "Two different
environments were specified for target %s,\n\tbut they appear to have the
same action: %s" % (t, action.genstring(tlist, slist, t.env))
Actually it's probably correct.
Each time you call SConscript above, it's creating a new Environment().
SConscripts are evaluated basically by python eval.
There's no shared context between the two evaluations of the same
SConscript in this case.
On Fri, Dec 1, 2017 at 3:37 PM, Andrew Featherstone <
andrew.featherstone at cantab.net> wrote:
> Hi all,
>
> Here's a simple setup using scons 3.0.1
>
> $ ls
> SConscript SConstruct foo.in
> $ cat SConstruct
> env_a = Environment()
> env_b = Environment()
> for env in (env_a, env_b):
> SConscript(
> 'SConscript'
> )
> $ cat SConscript
> import shutil
>
> env_c = Environment()
>
> def simple_cmd(target, source, env):
> shutil.copy(str(source[0]), str(target[0]))
>
> env_c.Command('foo.out', 'foo.in', simple_cmd)
>
> The expected behaviour when running scons is that the foo.out is produced
> once. This does happen, but SCons incorrectly (AFAICT) warns that different
> environments are used to build the target foo.out:
>
> $ scons
> scons: Reading SConscript files ...
>
> scons: warning: Two different environments were specified for target
> foo.out,
> but they appear to have the same action: simple_cmd(target,
> source, env)
> File "C:\Users\Andrew\projects\scons-env\SConscript", line 8, in <module>
> scons: done reading SConscript files.
> scons: Building targets ...
> simple_cmd(["foo.out"], ["foo.in"])
> scons: done building targets.
>
> The output of --taskmastertrace:
>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: Considering node <no_state 0 '.'> and its children:
> Taskmaster: <no_state 0 'foo.in'>
> Taskmaster: <no_state 0 'foo.out'>
> Taskmaster: <no_state 0 'SConscript'>
> Taskmaster: <no_state 0 'SConstruct'>
> Taskmaster: adjusted ref count: <pending 1 '.'>, child 'foo.in'
> Taskmaster: adjusted ref count: <pending 2 '.'>, child 'foo.out'
> Taskmaster: adjusted ref count: <pending 3 '.'>, child
> 'SConscript'
> Taskmaster: adjusted ref count: <pending 4 '.'>, child
> 'SConstruct'
> Taskmaster: Considering node <no_state 0 'foo.in'> and its
> children:
> Taskmaster: Evaluating <pending 0 'foo.in'>
>
> Task.make_ready_current(): node <pending 0 'foo.in'>
> Task.prepare(): node <up_to_date 0 'foo.in'>
> Task.executed_with_callbacks(): node <up_to_date 0 'foo.in'>
> Task.postprocess(): node <up_to_date 0 'foo.in'>
> Task.postprocess(): removing <up_to_date 0 'foo.in'>
> Task.postprocess(): adjusted parent ref count <pending 3 '.'>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: Considering node <no_state 0 'foo.out'> and its
> children:
> Taskmaster: <up_to_date 0 'foo.in'>
> Taskmaster: Evaluating <pending 0 'foo.out'>
>
> Task.make_ready_current(): node <pending 0 'foo.out'>
> Task.prepare(): node <executing 0 'foo.out'>
> Task.execute(): node <executing 0 'foo.out'>
> Task.executed_with_callbacks(): node <executing 0 'foo.out'>
> Task.postprocess(): node <executed 0 'foo.out'>
> Task.postprocess(): removing <executed 0 'foo.out'>
> Task.postprocess(): adjusted parent ref count <pending 2 '.'>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: Considering node <no_state 0 'SConscript'> and its
> children:
> Taskmaster: Evaluating <pending 0 'SConscript'>
>
> Task.make_ready_current(): node <pending 0 'SConscript'>
> Task.prepare(): node <up_to_date 0 'SConscript'>
> Task.executed_with_callbacks(): node <up_to_date 0 'SConscript'>
> Task.postprocess(): node <up_to_date 0 'SConscript'>
> Task.postprocess(): removing <up_to_date 0 'SConscript'>
> Task.postprocess(): adjusted parent ref count <pending 1 '.'>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: Considering node <no_state 0 'SConstruct'> and its
> children:
> Taskmaster: Evaluating <pending 0 'SConstruct'>
>
> Task.make_ready_current(): node <pending 0 'SConstruct'>
> Task.prepare(): node <up_to_date 0 'SConstruct'>
> Task.executed_with_callbacks(): node <up_to_date 0 'SConstruct'>
> Task.postprocess(): node <up_to_date 0 'SConstruct'>
> Task.postprocess(): removing <up_to_date 0 'SConstruct'>
> Task.postprocess(): adjusted parent ref count <pending 0 '.'>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: Considering node <pending 0 '.'> and its children:
> Taskmaster: <up_to_date 0 'foo.in'>
> Taskmaster: <executed 0 'foo.out'>
> Taskmaster: <up_to_date 0 'SConscript'>
> Taskmaster: <up_to_date 0 'SConstruct'>
> Taskmaster: Evaluating <pending 0 '.'>
>
> Task.make_ready_current(): node <pending 0 '.'>
> Task.prepare(): node <executing 0 '.'>
> Task.execute(): node <executing 0 '.'>
> Task.executed_with_callbacks(): node <executing 0 '.'>
> Task.postprocess(): node <executed 0 '.'>
>
> Taskmaster: Looking for a node to evaluate
> Taskmaster: No candidate anymore.
>
> Any ideas on how to debug this further?
>
> Andrew
>
> _______________________________________________
> 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/20171202/8be87689/attachment-0001.html>
More information about the Scons-users
mailing list