[Scons-users] Define function in SConsctruct, use in SConscript

Elliott Wolin wolin at jlab.org
Wed Apr 17 10:15:05 EDT 2013


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

================================================================================



More information about the Scons-users mailing list