[Buildbot-commits] buildbot/buildbot/process factory.py,1.12,1.13 step.py,1.82,1.83 builder.py,1.35,1.36 process_twisted.py,1.42,1.43 step_twisted.py,1.73,1.74

Brian Warner warner at users.sourceforge.net
Mon Apr 17 19:22:36 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/process
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23634/buildbot/process

Modified Files:
	factory.py step.py builder.py process_twisted.py 
	step_twisted.py 
Log Message:
Revision: arch at buildbot.sf.net--2004/buildbot--dev--0--patch-500
Creator:  Brian Warner <warner at lothar.com>

fix process_twisted.py factories, other style changes

	* all: use isinstance() instead of 'type(x) is foo', suggested by
	Neal Norwitz

	* buildbot/process/process_twisted.py (QuickTwistedBuildFactory):
	oops, fix a brain-fade from the other week, when making the
	addStep changes. I changed all the __init__ upcalls to use the
	wrong superclass name.
	(FullTwistedBuildFactory.__init__): same
	(TwistedDebsBuildFactory.__init__): same
	(TwistedReactorsBuildFactory.__init__): same
	(TwistedBuild.isFileImportant): use .startswith for clarity,
	thanks to Neal Norwitz for the suggestions.


Index: builder.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/builder.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- builder.py	12 Mar 2006 11:28:04 -0000	1.35
+++ builder.py	17 Apr 2006 19:22:34 -0000	1.36
@@ -61,7 +61,7 @@
         return self
 
     def _attachFailure(self, why, where):
-        assert type(where) is str
+        assert isinstance(where, str)
         log.msg(where)
         log.err(why)
         return why

Index: factory.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/factory.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- factory.py	7 Apr 2006 04:10:56 -0000	1.12
+++ factory.py	17 Apr 2006 19:22:33 -0000	1.13
@@ -45,7 +45,7 @@
                  configureFlags=[],
                  compile=["make", "all"],
                  test=["make", "check"]):
-        assert type(source) is tuple
+        assert isinstance(source, tuple)
         assert issubclass(source[0], step.BuildStep)
         BuildFactory.__init__(self, [source])
         if configure is not None:
@@ -59,7 +59,7 @@
                 else:
                     command = configure
             else:
-                assert type(configure) in (list, tuple)
+                assert isinstance(configure, (list, tuple))
                 command = configure + configureFlags
             self.addStep(step.Configure, command=command, env=configureEnv)
         if compile is not None:
@@ -69,7 +69,7 @@
 
 class CPAN(BuildFactory):
     def __init__(self, source, perl="perl"):
-        assert type(source) is tuple
+        assert isinstance(source, tuple)
         assert issubclass(source[0], step.BuildStep)
         BuildFactory.__init__(self, [source])
         self.addStep(step.Configure, command=[perl, "Makefile.PL"])
@@ -78,7 +78,7 @@
 
 class Distutils(BuildFactory):
     def __init__(self, source, python="python", test=None):
-        assert type(source) is tuple
+        assert isinstance(source, tuple)
         assert issubclass(source[0], step.BuildStep)
         BuildFactory.__init__(self, [source])
         self.addStep(step.Compile, command=[python, "./setup.py", "build"])
@@ -105,7 +105,7 @@
                  testpath=".", randomly=None, recurse=None,
                  tests=None,  useTestCaseNames=False, env=None):
         BuildFactory.__init__(self, [source])
-        assert type(source) is tuple
+        assert isinstance(source, tuple)
         assert issubclass(source[0], step.BuildStep)
         assert tests or useTestCaseNames, "must use one or the other"
         if trial is not None:

Index: process_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/process_twisted.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- process_twisted.py	7 Apr 2006 04:10:57 -0000	1.42
+++ process_twisted.py	17 Apr 2006 19:22:34 -0000	1.43
@@ -11,9 +11,9 @@
 class TwistedBuild(Build):
     workdir = "Twisted" # twisted's bin/trial expects to live in here
     def isFileImportant(self, filename):
-        if filename.find("doc/fun/") == 0:
+        if filename.startswith("doc/fun/") == 0:
             return 0
-        if filename.find("sandbox/") == 0:
+        if filename.startswith("sandbox/") == 0:
             return 0
         return 1
 
@@ -40,7 +40,7 @@
     useProgress = 0
 
     def __init__(self, source, python="python"):
-        TwistedBuildFactory.__init__(self, source)
+        TwistedBaseFactory.__init__(self, source)
         if type(python) is str:
             python = [python]
         self.addStep(HLint, python=python[0])
@@ -56,14 +56,14 @@
     def __init__(self, source, python="python",
                  processDocs=False, runTestsRandomly=False,
                  compileOpts=[], compileOpts2=[]):
-        TwistedBuildFactory.__init__(self, source)
+        TwistedBaseFactory.__init__(self, source)
         if processDocs:
             self.addStep(ProcessDocs)
 
         if type(python) == str:
             python = [python]
-        assert type(compileOpts) is list
-        assert type(compileOpts2) is list
+        assert isinstance(compileOpts, list)
+        assert isinstance(compileOpts2, list)
         cmd = (python + compileOpts + ["setup.py", "all", "build_ext"]
                + compileOpts2 + ["-i"])
 
@@ -75,7 +75,7 @@
     treeStableTimer = 10*60
 
     def __init__(self, source, python="python"):
-        TwistedBuildFactory.__init__(self, source)
+        TwistedBaseFactory.__init__(self, source)
         self.addStep(ProcessDocs, haltOnFailure=True)
         self.addStep(BuildDebs, warnOnWarnings=True)
 
@@ -85,12 +85,12 @@
     def __init__(self, source,
                  python="python", compileOpts=[], compileOpts2=[],
                  reactors=None):
-        TwistedBuildFactory.__init__(self, source)
+        TwistedBaseFactory.__init__(self, source)
 
         if type(python) == str:
             python = [python]
-        assert type(compileOpts) is list
-        assert type(compileOpts2) is list
+        assert isinstance(compileOpts, list)
+        assert isinstance(compileOpts2, list)
         cmd = (python + compileOpts + ["setup.py", "all", "build_ext"]
                + compileOpts2 + ["-i"])
 

Index: step.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- step.py	16 Apr 2006 23:05:40 -0000	1.82
+++ step.py	17 Apr 2006 19:22:33 -0000	1.83
@@ -1022,7 +1022,7 @@
         assert mode in ("update", "copy", "clobber", "export")
         if retry:
             delay, repeats = retry
-            assert type(repeats) is int
+            assert isinstance(repeats, int)
             assert repeats > 0
         self.args = {'mode': mode,
                      'workdir': workdir,

Index: step_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step_twisted.py,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- step_twisted.py	16 Apr 2006 23:05:40 -0000	1.73
+++ step_twisted.py	17 Apr 2006 19:22:34 -0000	1.74
@@ -323,7 +323,7 @@
             self.testpath = testpath
         if self.testpath is UNSPECIFIED:
             raise ValueError("You must specify testpath= (it can be None)")
-        assert type(self.testpath) is str or self.testpath is None
+        assert isinstance(self.testpath, str) or self.testpath is None
 
         if reactor is not UNSPECIFIED:
             self.reactor = reactor





More information about the Commits mailing list