[users at bb.net] BuildStep: Set Environment Property

Alan Ray rayalansaul at yahoo.com
Tue Mar 15 20:52:51 UTC 2016

I'm looking to customize an environment variable (0.9.0b7) and I'm looking for advice for the best way to tackle it. Creating the virtualenv itself isn't a problem, e.g.:
steps.ShellCommand(workingdir='foo', command=['virtualenv', 'myvenv']),

Now my goal is to put the current working directory of the shell (e.g. /builderworkingdir/foo/myvenv) into either 
   (a) a property, so that I can set the environment later, or   (b) directly modify the environment. 

The first approach I see is to subclass ShellCommand and override the commandComplete to do something like self.setProperty('myvenv' os.path.join(self.workdir, command[1])). Then on subsequent shell commands, do something like ShellCommand(env={'PYTHONPATH' : Property('myvenv'). 
The second approach is similar to the first, except that I might be able to directly set self.slaveEnvironment['myvenv'] = os.path.join(...)The third approach would be to leverage something like steps.SetPropertyFromCommand("source myvenv", property=PYTHONPATH)
Does that seem like a fair summary of the options? Is one of these approaches notably better than the others? 

On a related note, I've considered typing up couple illustrations of what can be done and submitting them as recipes. Is there a good place to submit recipes? I realize buildbot intentionally avoids including "common" solutions because they aren't common, but it seems like topics like this would be helped by some example scenarios.
Thanks,- Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20160315/fbe0fbf2/attachment.html>

More information about the users mailing list