[Scons-users] Define function in SConsctruct, use in SConscript
Philipp Kraus
philipp.kraus at flashpixx.de
Wed Apr 17 10:36:16 EDT 2013
Hi,
I hope I understand your problem correct: You want to export a function to another SConstruct script:
see this part of the documentation: http://www.scons.org/doc/1.2.0/HTML/scons-user/c3096.html
I use something like this:
env.SConscript( <your other builder file>, exports="env myfunction1 myfunction2" )
and in my sub-SConstruct Script I use Import ("*") to get access to the "exported" data.
HTH
Phil
Am 17.04.2013 um 16:15 schrieb Elliott Wolin:
> 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')
>
> but cannot figure out how to use it in SConscript. I tried various Import() statments, none worked. Typical error:
>
> $ scons -c
> scons: Reading SConscript files ...
> NameError: name 'modify_environment' is not defined:
>
> I tried exporting modify_environment in the SConscript() call, but it complained it is not a variable.
>
>
> $ scons -version
> SCons by Steven Knight et al.:
> script: v2.0.1.r5134, 2010/08/16 23:02:40, by bdeegan on cooldog
> engine: v2.0.1.r5134, 2010/08/16 23:02:40, by bdeegan on cooldog
>
> --
>
> Sincerely,
> Elliott
>
>
> ================================================================================
>
>
> Those raised in a morally relative or neutral environment will hold
> no truths to be self-evident.
>
>
> Elliott Wolin
> Staff Physicist, Jefferson Lab
> 12000 Jefferson Ave
> Suite 8 MS 12A1
> Newport News, VA 23606
> 757-269-7365
>
> ================================================================================
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> http://four.pairlist.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130417/c444b016/attachment.htm>
More information about the Scons-users
mailing list