[Scons-users] Pass custom arguments to a builder

William Deegan bill at baddogconsulting.com
Sun Jan 19 19:40:02 EST 2014


Deblert,
On Jan 19, 2014, at 4:32 PM, delbert dev <delbertum at gmail.com> wrote:


> I have this builder which uses global variables:

>

>

> def my_action(source, target, env):

> with zipfile.ZipFile(gtestOutputFile , "r") as z:

> z.extractall(outdir)

> print "Extracted : " + source[0].abspath + " too: " + target[1].abspath

> print "a " + target[0].abspath

> print "a " + target[1].abspath

> print "a " + target[2].abspath

> print "s " + source[0].abspath

> print "o " + outdir

>

> my_cmd_builder = Builder(action=my_action)

> env.Append( BUILDERS = {'MyCmd' : my_cmd_builder } )

> my_cmd = env.MyCmd(["asdad", "asdasdads123123", "eee"], os.popen('which bash').read().strip())

>

> I would like to reuse the above builder and therefore it should take the input/output files as arguments. But how do I do that? I have tried to pass them as target, source lists but it does not work.


Pass them through Environment() variables as such:

env.myBuilder(a,b,MYBUILDER_ARG_1=True)

Is one way to do this.

-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140119/12e0a05b/attachment.htm


More information about the Scons-users mailing list