[Buildbot-commits] buildbot/buildbot/steps shell.py,1.13,1.14

Brian Warner warner at users.sourceforge.net
Thu Mar 20 23:56:56 UTC 2008


Update of /cvsroot/buildbot/buildbot/buildbot/steps
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15858/buildbot/steps

Modified Files:
	shell.py 
Log Message:
[project @ #115:Move-WithProperties-and-friends.patch]
Patch by Greg Ward <gerg.ward+buildbot at gmail.com>:
Move WithProperties and friends (render(), _BuildPropertyMapping)
from buildbot.steps.shell to buildbot.process.buildstep.

Original author: dustin at v.igoro.us
Date: 2008-03-13 03:11:52+00:00

Index: shell.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/shell.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- shell.py	20 Mar 2008 23:56:49 -0000	1.13
+++ shell.py	20 Mar 2008 23:56:54 -0000	1.14
@@ -2,40 +2,11 @@
 
 import types, re
 from twisted.python import log
-from buildbot import util
-from buildbot.process.buildstep import LoggingBuildStep, RemoteShellCommand
+from buildbot.process.buildstep import LoggingBuildStep, RemoteShellCommand, render
 from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE
 
-class _BuildPropertyMapping:
-    def __init__(self, build):
-        self.build = build
-    def __getitem__(self, name):
-        p = self.build.getProperty(name)
-        if p is None:
-            p = ""
-        return p
-
-class WithProperties(util.ComparableMixin):
-    """This is a marker class, used in ShellCommand's command= argument to
-    indicate that we want to interpolate a build property.
-    """
-
-    compare_attrs = ('fmtstring', 'args')
-
-    def __init__(self, fmtstring, *args):
-        self.fmtstring = fmtstring
-        self.args = args
-
-    def render(self, build):
-        pmap = _BuildPropertyMapping(build)
-        if self.args:
-            strings = []
-            for name in self.args:
-                strings.append(pmap[name])
-            s = self.fmtstring % tuple(strings)
-        else:
-            s = self.fmtstring % pmap
-        return s
+# for existing configurations that import WithProperties from here
+from buildbot.process.buildstep import WithProperties
 
 def render(s, build):
     """Return a string based on s and build that is suitable for use





More information about the Commits mailing list