[Scons-users] Custom builder

William Roberts bill.c.roberts at gmail.com
Fri Sep 7 05:00:58 EDT 2012


I am having issues wrapping a custom builder in a custom class.

Suppose I have the following SConstruct file that calls a SConscript file:

#Miniat is my custom wrapper for building
miniat = MiniatBuilder(rootdir, libdir, exedir, env, q)
SConscript(script, variant_dir=q, duplicate=1, exports=[ 'miniat' ] )

Then in the SConscript file, I do something like:

f = miniat.flex('src/lex.yy.c', 'src/0x1_assembler.lex')

In the MiniatBuilder constructor I do:

self._env = env
bld = self._env.Builder(action = 'flex -i -o $TARGET $SOURCE',
src_suffix = '.lex')
self._env['BUILDERS']['Flex'] = bld

I get the following output:

flex -i -o
flex: option `o' requires an argument
Try `flex --help' for more information.

But if I take that same code, and append to the enviroment in the
SConscript file, it works:

Import('miniat')

env = miniat._env
bld = Builder(action = 'flex -i -o $TARGET $SOURCE',
src_suffix = '.flex')
env.Append(BUILDERS = {'Flex' : bld})

f = env.Flex('src/lex.yy.c', 'src/0x1_assembler.lex')

Can someone please shed some light?

--
Respectfully,

William C Roberts


More information about the Scons-users mailing list