[Scons-users] strange behavior around env.AddMethod

Rob Deckers Rob.Deckers at vanderlande.com
Wed Oct 23 07:49:44 EDT 2013


Hi,

I am adjusting a part to run tests on a remote target.
We have 2 kinds of files that should be copied to the target.

'normal' test dependency files, which will be copied to env['TESTTARGET_DIR']
And shared libraries, which should be copied to another directory env['LIBTARGET_DIR']

I have created 2 single source builders that use a generator.
One uses this function:
def _libtest_dependency_action_generator(source, target, env, for_signature):
env['SHARED_LIB'] = True
return _test_dependency_action_generator(source, target, env, for_signature)

the other this one:
def _scripttest_dependency_action_generator(source, target, env, for_signature):
env['SHARED_LIB'] = False
return _test_dependency_action_generator(source, target, env, for_signature)

A few function's deeper, where the actually copy takes place, I have something like:
def _copyto_target_dir_action_method(env, source, compress=False, rel_dir=None, **keywords):
if env['SHARED_LIB']:
target = env['LIBTARGET_DIR']
else:
target = env['TESTTARGET_DIR']

The copy function is added to the environment in the generate function with:
env.AddMethod(_copyto_target_dir_action_method, "CopyToTargetDir")

So far, so good.
Now the strange thing:
When I use:
_copyto_target_dir_action_method(env, <other vars>)

env['SHARED_LIB'] still contain's it's value, BUT when I use:
env.CopyToTargetDir(<other vars>)

the if env['SHARED_LIB']: always returns false.

What is going on?

** Disclaimer **

This e-mail, including any attachments, may include proprietary and confidential information of Vanderlande Industries and may only be read by the person or those persons to whom it is addressed.
This document is forwarded to you in such a form (e-mail) that Vanderlande Industries cannot guarantee the completeness and/or correctness of its contents and information.
If you have received this e-mail message in error, please notify us immediately. Please also delete this document from your computer.
This document may not be reproduced, copied, distributed, published, modified, or furnished to third parties, without the prior written consent of Vanderlande Industries.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131023/a763a9d1/attachment-0001.htm


More information about the Scons-users mailing list