Next: , Previous: Common Parameters, Up: Build Steps

4.11.2 Using Build Properties

Build properties are a generalized way to provide configuration information to build steps; see Build Properties.

Some build properties are inherited from external sources – global properties, schedulers, or buildslaves. Some build properties are set when the build starts, such as the SourceStamp information. Other properties can be set by BuildSteps as they run, for example the various Source steps will set the got_revision property to the source revision that was actually checked out (which can be useful when the SourceStamp in use merely requested the “latest revision”: got_revision will tell you what was actually built).

In custom BuildSteps, you can get and set the build properties with the getProperty/setProperty methods. Each takes a string for the name of the property, and returns or accepts an arbitrary1 object. For example:

     class MakeTarball(ShellCommand):
         def start(self):
             if self.getProperty("os") == "win":
                 self.setCommand([ ... ]) # windows-only command
                 self.setCommand([ ... ]) # equivalent for other systems


[1] Build properties are serialized along with the build results, so they must be serializable. For this reason, the value of any build property should be simple inert data: strings, numbers, lists, tuples, and dictionaries. They should not contain class instances.