[Buildbot-devel] More Property confusion

Benoît Allard benoit at aeteurope.nl
Mon Aug 6 07:59:40 UTC 2012



> -----Original Message-----
> From: Alexander Sack [mailto:pisymbol at gmail.com]
> Sent: Sunday, August 05, 2012 5:44 PM
> To: buildbot-devel at lists.sourceforge.net
> Subject: [Buildbot-devel] More Property confusion
>
> Hi Folks:
>
> So I want to write a custom BuildStep that as an argument to its ctor
> has a filename.  This filename can be either a simple string or
> hopefully a WithProperties instance to be interpolated by the time
> start() runs.
>
> e.g.
>
> class FooFile(BuildStep):

      renderables = ['filename']

>     def __init__(self, filename, **kwargs):
>         BuildStep.__init__(self, **kwargs)
>         self.filename = filename
>         self.addFactoryArguments(filename = filename)
>
>     def start(self):
>         """ Do something with self.filename """
>
> But self.filename is a WithProperties() instance.  When start() funs,
> self.filename is still a WithProperties instance, not the string (so
> my open() fails).

See above, I fixed it for you, you have to explicitely say to the buildstep that 
your filename rendering has to be delayed through the 'renderables' array.

>
> How do use WithProperties() within a custom buildstep?  I was groking
> for a concrete example but so far haven't found any.

Pretty much all the steps use that, but I agree that it's not clear from the 
source that this 'renderables' is the part you were looking for.

>
> Do I really have to check the type, a la:
>
> if isinstance(value, WithProperties):
>       self.build.getProperties().render(value)
>

No.

> Cheers,
>
> -aps
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6467 bytes
Desc: not available
URL: <http://buildbot.net/pipermail/devel/attachments/20120806/d87fbaf0/attachment.bin>


More information about the devel mailing list