[Scons-users] Tech question
Bill Deegan
bill at baddogconsulting.com
Thu Jan 24 18:19:50 EST 2013
Daniel,
On Thu, Jan 24, 2013 at 3:16 PM, <nileiqi at optusnet.com.au> wrote:
> Thanks Bill,
>
> 1. Scons 1.3.0
>
Any reason you don't move forward to SCons 2.2.0?
> 2. I will take a good reading of manpage, thanks very much.
>
No problemo.
SCons tries to do a good job at documenting the system.
If you find anything which is confusing, please don't hesitate to ask for
clarification.
Hope that helps!
-Bill
> Daniel
>
>
> ----- Original Message -----
> From:
> "SCons users mailing list" <scons-users at scons.org>
>
> To:
> "SCons users mailing list" <scons-users at scons.org>
> Cc:
>
> Sent:
> Thu, 24 Jan 2013 15:07:10 -0800
> Subject:
> Re: [Scons-users] Tech question
>
>
>
> Daniel,
>
> On Thu, Jan 24, 2013 at 2:14 PM, <nileiqi at optusnet.com.au> wrote:
>
>> Hi,
>>
>>
>> I am new to Scons and Python, and currently spend quite amount time to
>> learn other people's code and Scons user guide. Please allow me ask some
>> general and tech quesitons.
>>
>> Tech question
>> (1) Whta is the main difference between generator and action ? For
>> example, I have two pieces of code
>>
>> ****************** piece 1****************************
>> bld=Builder(action = Action(function_name))
>> env.Append(Builders= { 'foo':bld})
>> *********************************************************
>> ****************** piece 2****************************
>> bld=Builder(generator = function_name)
>> env.Append(Builders= { 'foo':bld})
>> **********************************************************
>> when run them, what is the different ?
>>
>
> I'd advise you do a thorough read of the manpage. It delves more into the
> depths than the users guide.
> http://www.scons.org/doc/production/HTML/scons-man.html
>
> From the manpage:
>
> generator
>
> A function that returns a list of actions that will be executed to build
> the target(s) from the source(s). The returned action(s) may be an Action
> object, or anything that can be converted into an Action object (see the
> next section).
>
> The generator function takes four arguments: *source* - a list of source
> nodes, *target* - a list of target nodes, *env* - the construction
> environment,*for_signature* - a Boolean value that specifies whether the
> generator is being called for generating a build signature (as opposed to
> actually executing the command). Example:
>
>
> def g(source, target, env, for_signature):
> return [["gcc", "-c", "-o"] + target + source]
>
> b = Builder(generator=g)
>
>
>
> The *generator* and *action* arguments must not both be used for the same
> Builder.
>
>
>
> A function that returns a list of actions that will be executed to build
> the target(s) from the source(s). The returned action(s) may be an Action
> object, or anything that can be converted into an Action object (see the
> next section).
>
> The generator function takes four arguments: *source* - a list of source
> nodes, *target* - a list of target nodes, *env* - the construction
> environment,*for_signature* - a Boolean value that specifies whether the
> generator is being called for generating a build signature (as opposed to
> actually executing the command). Example:
>
>
> def g(source, target, env, for_signature):
> return [["gcc", "-c", "-o"] + target + source]
>
> b = Builder(generator=g)
>
>
>
> The *generator* and *action* arguments must not both be used for the same
> Builder.
>
>
>
>
>> (2) For above piece 1 code, I realize it never execute until at the end
>> of the code, when function Default() is called, why is that ?
>>
>
> SCons builds up information about the dependencies and what to do with
> them from the SConstruct/SConscripts (and any other logic you may be
> pulling in).
> Then it will scan the source tree, figure out the dependencies, and then
> execute the builders logic.
>
> Hope that helps!
> -Bill
>
> ------------------------------
> Email sent using Optus Webmail
>
> _______________________________________________
> 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/20130124/07c873d1/attachment.html>
More information about the Scons-users
mailing list