Search code examples
pythonenvironment-variablesbuildbot

How do I append to the PATH environment variable for a BuildBot ShellCommand


I need to alter the build environment variable for a build step. However the current environment parameter only replaces existing environment variables.

Does anybody know how I can get buildbot to append to the PATH environment variable rather than replace:

my_return.addStep(ShellCommand(command=["qmake", "{0}.pro".format(pro_name)],
                               env={'PATH': qt_path}))

Solution

  • You can extend/append to the PATH environment variable by putting $PATH at the end of the existing value. Something like:

    my_return.addStep(ShellCommand(command=["qmake", "{0}.pro".format(pro_name)],
                                   env={'PATH': [qt_path, "${PATH}"]}))
    

    More details at the buildbot documentation.