[Scons-users] Define function in SConsctruct, use in SConscript
William Deegan
bill at baddogconsulting.com
Wed Apr 17 14:05:13 EDT 2013
Elliot,
> On 2013-04-17 16:15:05 +0200, Elliott Wolin said:
>
>> Hi,
>> Just started with scons, simple question, I tried various things and
>> nothing worked. Also, I know little about Python (to the credit of both
>> I was able to develop a moderately sophisticated build system anyway!).
>> Problem is, I create a function in SConscript:
>> def modify_environment(env,reqlist) :
>> # process dependency lists
>> list = reqlist.split()
>> for l in list:
>> exec("from load" + l + " import load" +l)
>> exec("load" + l + "(env)")
>> Export('modify_environment')
>
I'd suggest you read the following:
http://www.scons.org/doc/production/HTML/scons-user/c3938.html
AddMethod() is a way to attach some logic to your Environment(), then you just propagate your environment to your SConscripts with the exports arg, and use the Import() in your SConscript.
-Bill
More information about the Scons-users
mailing list