[Scons-users] Overriding Object to force global dependency

Kyle J Strand Kyle.Strand at beckman.com
Thu Jun 28 11:03:42 EDT 2012


The env.AddMethod() method isn't actually what you want; try this:

env['BUILDERS']['Object'] = Object

I tested this by printing env.Dump('BUILDERS') before and after this
command, cloning the environment to env2, and printing
env2.Dump('BUILDERS'), and looks like it works exactly as intended.

-----------------------------------------------------------------------
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036

scons-users-bounces at scons.org wrote on 06/27/2012 11:04:27 AM:


> Greg Ward <greg at gerg.ca>

> Sent by: scons-users-bounces at scons.org

>

> 06/27/2012 11:04 AM

>

> Please respond to

> SCons users mailing list <scons-users at scons.org>

>

> To

>

> scons-users at scons.org

>

> cc

>

> Subject

>

> [Scons-users] Overriding Object to force global dependency

>

> 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

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users


The server made the following annotations

---------------------------------------------------------------------------------

This message contains information that may be privileged or confidential and is the property of Beckman Coulter, Inc. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

---------------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120628/1bbdbc1f/attachment-0001.html>


More information about the Scons-users mailing list