Re: matching source and target's behavior between func and cmd actions
Bill Deegan <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CAEyG4CGeZCtQyPK+uMfa0v8gqzXBudfeY-bRJgmyLZa_tM0LFw@mail.gmail.com> |
Go take a look at : https://scons.org/doc/production/HTML/scons-man.html#builder_objects Search for "generator" Likely that's what you want. Did you take a read through the manpage first? There's lots of useful info there.. :) On Sat, Jun 20, 2020 at 4:05 PM Gary Granger <[email protected]> wrote: > If you want to use different commands or change the string printed when > the command executes, that implies you should use different Builder > instances, with different Actions or cmdstr or both. It sounds like you're > trying to parameterize a build task within a single python function, > instead of using the mechanisms SCons already provides for parameterizing > build tasks, namely Builder and Action. If you really have functionality > in the task() function which you want to share across multiple Builder > instances, then I would break out the shared functionality into other > functions which your Builder tasks then call. But now I'm just guessing, > because I doubt I really understand what you're trying to do from your > example. > On 6/20/20 11:52 AM, daggs wrote: > > Greetings Gary, > > that helps me in this specific case but not in the more general case as I > might want to use .dirname or pass the cmd. > > I thought of using regex replace like this: > def task(source, target, env): > print(env['cmd']) > new_cmd = re.sub("\$TARGET", env['cmd'], 'aaa') > print('['+new_cmd+']') > > but for the following cmd: > ${SOURCE}<=>$SOURCE<=>${SOURCES}<=>$SOURCES<=>${TARGET}<=>$TARGET<=>$SOURCES.dirname<=>${SOURCE}.dirname<=>$TARGET.abspath > I get this output: > [aaa] > > > _______________________________________________ > Scons-users mailing list > [email protected] > https://pairlist4.pair.net/mailman/listinfo/scons-users > _______________________________________________ Scons-users mailing list [email protected] https://pairlist4.pair.net/mailman/listinfo/scons-users