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

Left Right olegsivokon at gmail.com
Thu Oct 4 14:27:49 EDT 2012


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


More information about the Scons-dev mailing list