Re: [Scons-dev] What should I return from generator function?

2012-10-05 Thread Left Right
> The generator should return an Action or something that can be turned
> into an Action.
> See http://www.scons.org/doc/HTML/scons-user/x3755.html

> The only things that can be turned into Actions are a string (which is
> a command to be executed), or a python function (which gets run when
> the action is executed), or lists thereof.

> (see http://www.scons.org/doc/production/HTML/scons-api/index.html if
> you really care.)

> --
> Gary

Thanks for ongoing help, but I'm more puzzled then before :)
_execute function runs from _inside_ the action. And the action that
runs this function expects it to return... another action (this is a
plausible scenario if actions have to be chained, but in my case they
are not)?
I actually could get it working, but in a way, which is probably very
bad... I've overridden the _execute() function in BuilderBase and
removed all mentions of generator and action + all calls that would
cause any reference to either one of these. Now, I'm probably missing
a whole lot of things, if I'm not using action or / and executor, but
I fail to understand how to use them...
One thing I'm concerned with is - it was trying to generate file nodes
from the files, and this went down the drain too... was it important?
How important is it?

So, what are the consequences of not using any of these?
To elaborate: a typical build process of a project is somewhat
involved - you certainly cannot describe it as a single command-line
operation (so action as string is not an option). And I'm having
problems using a function inside the action for two reasons:
- calling the function in this way doesn't let me access associated
builder info (and this is the very important part of the process),
while what it passes into action-function is not important / I could
absolutely do without it.
- I can only prevent the calling action from expecting me to return
another action by weird hack in the BuilderBase. I'm specifically
talking about _do_create_action - this function is called despite my
best effort of avoiding it...
___
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev


Re: [Scons-dev] What should I return from generator function?

2012-10-04 Thread Gary Oberbrunner
On Thu, Oct 4, 2012 at 2:27 PM, Left Right  wrote:
> May come as a bizarre question to you, but I'm clueless :)
> Some observations:
> - if I don't return anything, or return None - I get error "Object
> returned from command generator: %s cannot be used to create an
> Action."
> - if I return an empty string - the generator function is executed
> multiple times (11, or so)
> - if I return anything that would be equivalent to False - same error
> as with returning None

The generator should return an Action or something that can be turned
into an Action.
See http://www.scons.org/doc/HTML/scons-user/x3755.html

The only things that can be turned into Actions are a string (which is
a command to be executed), or a python function (which gets run when
the action is executed), or lists thereof.

(see http://www.scons.org/doc/production/HTML/scons-api/index.html if
you really care.)

-- 
Gary
___
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev


[Scons-dev] What should I return from generator function?

2012-10-04 Thread Left Right
May come as a bizarre question to you, but I'm clueless :)
Some observations:
- if I don't return anything, or return None - I get error "Object
returned from command generator: %s cannot be used to create an
Action."
- if I return an empty string - the generator function is executed
multiple times (11, or so)
- if I return anything that would be equivalent to False - same error
as with returning None

I've looked up the Action._exectute() function - and I don't
understand what should it be :| Why is it necessary to return anything
at all?

Also, I've found this bit of code with the comment:

def _do_create_action(act, kw):
. . .
if isinstance(act, int) or isinstance(act, float):
raise TypeError("Don't know how to create an Action from a
number (%s)"%act)
# Else fail silently (???)
return None

I really wish there was an option to exit this function somehow w/o
creating additional actions... where it says "fail silently" it
actually needs to just exit. If nothing was returned, it means nothing
else left to do :/ And then, in the Action._exectute(), where it
checks:

gen_cmd = Action(ret, **self.gen_kw)
if not gen_cmd:
raise SCons.Errors.UserError("Object returned from command
generator: %s cannot be used to create an Action." % repr(ret))

instead it could just return... What is the purpose of creating an
action, when all job was done already? Is there a special "end all
job" action I can use to make this part of the code happy?

Best.

Oleg
___
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev