[Scons-users] Overriding Object to force global dependency
Greg Ward
greg at gerg.ca
Wed Jun 27 13:04:27 EDT 2012
Hi all --
I want to force every single *.o file in my build to artificially
depend on something. (We have a homebrew tool that downloads and
unpacks specific versions of all third-party dependencies -- GCC,
C/C++ libraries, Java libraries, etc. This tool must run first, and
everything else should depend on its output.)
The obvious thing to do is override env.Object(), but I'm not sure how
to do that. I tried it with env.AddMethod, and that only half worked.
Here's my override:
_Object = env.Object
def Object(env, *args, **kwargs):
global _Object, dummy
print('Object override: args=%s' % map(str, args))
obj = _Object(*args, **kwargs)
env.Depends(obj, dummy)
return obj
env.AddMethod(Object, 'Object')
('dummy' is the output of that homebrew dependency tool.)
This works as long as I only ever use one env object. But as soon as I
do
env = env.Clone()
it stops working. The clone has the original Object() method, not
mine. ;-(
Is there a good way to do this?
Thanks --
Greg
More information about the Scons-users
mailing list