[Scons-users] Builder object being called a large number of times and ge
TOM TANNER (BLOOMBERG/ LONDON)
ttanner2 at bloomberg.net
Thu Aug 16 05:19:32 EDT 2012
*sigh* the 'mport itertools' line is a copy/paste error and shouldn't be there at all, sorry.
----- Original Message -----
From:
To: scons-users at scons.org
At: 8/16 09:59:13
OK, here's the SConstruct file:
env = Environment()
Export('env')
SConscript('tim/SConscript')
And tim/SConscript:
mport itertools
Import('*')
def _generate_actions(source, target, env, for_signature):
print '1:', for_signature, str(source[0]), Glob('#/etc/*.mlst', strings = True)
return [
Copy('$TARGET', '$SOURCE'),
]
bld = Builder(
generator = _generate_actions,
)
env['BUILDERS']['FooBar'] = bld
env.FooBar('tim.que.tim.tested', 'tim.que')
this produces 7 lines of output, with the first being somewhat different to the subsequent 6.
Running from /my/stuff:
scons: Reading SConscript files ...
1: tim.que 1 ['/my/stuff/etc/thing1.mlst, '/my/stuff/etc/thing2.mlst']
scons: done reading SConscript files.
scons: Building targets ...
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
scons: `.' is up to date.
scons: done building targets.
If I use a repository (this gets an error because I'm not doing it quite right, but you can see the same issue)
scons -Y .. -f ../SConstruct
scons: Reading SConscript files ...
1: tim.que 1 ['/my/stuff/solaris/etc/thing1.mlst, '/my/stuff/solaris/etc/thing2.mlst']
scons: done reading SConscript files.
scons: Building targets ...
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
1: solaris/tim/tim.que 1 ['etc/thing1.mlst', 'etc/thing2.mlst']
scons: *** [solaris/tim/tim.que.tim.tested] Source `solaris/tim/tim.que' not found, needed by target `solaris/tim/tim.que.tim.tested'.
scons: building terminated because of errors.
Note that on the first pass, the names found by Glob() are completely wrong, but they're fine on the 2nd and subsequent passes
So there's 2 issues:
1) Why is Glob returning the wrong name.
I'm working round this by use of rstr on the node, but this includes the repository name in it, which might be an issue for other people using my cache as I want to stick the generated list in the command line.
2) Why is my generator being called so many times? and apparently always with for_signature set to 1.
----- Original Message -----
From: garyo at oberbrunner.com
To: scons-users at scons.org, TOM TANNER (BLOOMBERG/ LONDON)
At: 8/15 19:01:21
On Wed, Aug 15, 2012 at 12:17 PM, TOM TANNER (BLOOMBERG/ LONDON)
<ttanner2 at bloomberg.net> wrote:
> I was trying to fiddle with one of my builders in a SConscript file, and I added some trace to it.
>
> It's called (a bit hackily) like this
>
> Import('*')
>
> (gets a Cloned environment)
>
> def _generator(...):
> print for_signature, Glob('stuff/*.mlst', string=True)
> return [ ... ]
>
> bld = Builder(generator = _generator)
>
> env['BUILDERS']['FooBar'] = bld
> env.FooBar([target1, target2], [ source1, source2 ])
>
> The builder gets called *eight* times each with for_signature set to 1.
>
> The first time it gets caled, Glob() behaves very strangely, returning me a list of files that exist in the repository BUT with the path to the version where the build targets would exist.
>
> Thus in the repository (path /my/source), there is a file called stuff/fred.mlst
>
> I build in /my/source/aix/64/stuff/fred.mlst
>
> the first time my function gets called, it prints /my/source/aix/64. The other 7 times, it prints stuff/fred.mlst
Hi Tom, not sure what's happening here. Can you send a complete
example so someone can try it out?
--
Gary
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
More information about the Scons-users
mailing list