[Buildbot-devel] doStepIf function
greg at gerg.ca
Thu May 13 17:51:18 UTC 2010
On Mon, May 10, 2010 at 8:33 AM, robert dugal <rmdugal at hotmail.com> wrote:
> I cannot figure out the syntax for how to use doStepIf with a function so
> that the step is only executed if certain conditions are true. The condition
> needs to have some complex testing of builder properties so I want to write
> this as a function.
> How do I convert something like this below into using a function?
> (lambda(step): step.build.getProperties().has_key("FOO"))
> (lambda(step): step.getProperty("FOO") in fooList)
> ), command='some command'))
Charles Lepple's answer is what you want. Here's what you actually did:
func1 = lambda step: step.build.getProperties().has_key("FOO")
func2 = lambda step: lambda(step): step.getProperty("FOO") in fooList)
func = func1 and func2
Since func1 and func2 are both true values, "func1 and func2"
evaluates to func1. So your func2 is unused.
You *can* do this in a single lambda, but you really don't want to.
Charles' suggestion is the way to go.
More information about the devel