update docs, factories, and tests to use new buildbot/steps/* definitions
[buildbot.git] / buildbot / process / process_twisted.py
blob05dfe2fca8b6f161ebbbd4695758edc3136ab3b0
1 #! /usr/bin/python
3 # Build classes specific to the Twisted codebase
5 from buildbot.process.base import Build
6 from buildbot.process.factory import BuildFactory
7 from buildbot.steps import shell
8 from buildbot.steps.python_twisted import HLint, ProcessDocs, BuildDebs, \
9 Trial, RemovePYCs
11 class TwistedBuild(Build):
12 workdir = "Twisted" # twisted's bin/trial expects to live in here
13 def isFileImportant(self, filename):
14 if filename.startswith("doc/fun/"):
15 return 0
16 if filename.startswith("sandbox/"):
17 return 0
18 return 1
20 class TwistedTrial(Trial):
21 tests = "twisted"
22 # the Trial in Twisted >=2.1.0 has --recurse on by default, and -to
23 # turned into --reporter=bwverbose .
24 recurse = False
25 trialMode = ["--reporter=bwverbose"]
26 testpath = None
27 trial = "./bin/trial"
29 class TwistedBaseFactory(BuildFactory):
30 buildClass = TwistedBuild
31 # bin/trial expects its parent directory to be named "Twisted": it uses
32 # this to add the local tree to PYTHONPATH during tests
33 workdir = "Twisted"
35 def __init__(self, source):
36 BuildFactory.__init__(self, [source])
38 class QuickTwistedBuildFactory(TwistedBaseFactory):
39 treeStableTimer = 30
40 useProgress = 0
42 def __init__(self, source, python="python"):
43 TwistedBaseFactory.__init__(self, source)
44 if type(python) is str:
45 python = [python]
46 self.addStep(HLint, python=python[0])
47 self.addStep(RemovePYCs)
48 for p in python:
49 cmd = [p, "setup.py", "build_ext", "-i"]
50 self.addStep(shell.Compile, command=cmd, flunkOnFailure=True)
51 self.addStep(TwistedTrial, python=p, testChanges=True)
53 class FullTwistedBuildFactory(TwistedBaseFactory):
54 treeStableTimer = 5*60
56 def __init__(self, source, python="python",
57 processDocs=False, runTestsRandomly=False,
58 compileOpts=[], compileOpts2=[]):
59 TwistedBaseFactory.__init__(self, source)
60 if processDocs:
61 self.addStep(ProcessDocs)
63 if type(python) == str:
64 python = [python]
65 assert isinstance(compileOpts, list)
66 assert isinstance(compileOpts2, list)
67 cmd = (python + compileOpts + ["setup.py", "build_ext"]
68 + compileOpts2 + ["-i"])
70 self.addStep(shell.Compile, command=cmd, flunkOnFailure=True)
71 self.addStep(RemovePYCs)
72 self.addStep(TwistedTrial, python=python, randomly=runTestsRandomly)
74 class TwistedDebsBuildFactory(TwistedBaseFactory):
75 treeStableTimer = 10*60
77 def __init__(self, source, python="python"):
78 TwistedBaseFactory.__init__(self, source)
79 self.addStep(ProcessDocs, haltOnFailure=True)
80 self.addStep(BuildDebs, warnOnWarnings=True)
82 class TwistedReactorsBuildFactory(TwistedBaseFactory):
83 treeStableTimer = 5*60
85 def __init__(self, source,
86 python="python", compileOpts=[], compileOpts2=[],
87 reactors=None):
88 TwistedBaseFactory.__init__(self, source)
90 if type(python) == str:
91 python = [python]
92 assert isinstance(compileOpts, list)
93 assert isinstance(compileOpts2, list)
94 cmd = (python + compileOpts + ["setup.py", "build_ext"]
95 + compileOpts2 + ["-i"])
97 self.addStep(shell.Compile, command=cmd, warnOnFailure=True)
99 if reactors == None:
100 reactors = [
101 'gtk2',
102 'gtk',
103 #'kqueue',
104 'poll',
105 'c',
106 'qt',
107 #'win32',
109 for reactor in reactors:
110 flunkOnFailure = 1
111 warnOnFailure = 0
112 #if reactor in ['c', 'qt', 'win32']:
113 # # these are buggy, so tolerate failures for now
114 # flunkOnFailure = 0
115 # warnOnFailure = 1
116 self.addStep(RemovePYCs) # TODO: why?
117 self.addStep(TwistedTrial, name=reactor, python=python,
118 reactor=reactor, flunkOnFailure=flunkOnFailure,
119 warnOnFailure=warnOnFailure)