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
, \
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/"):
16 if filename
.startswith("sandbox/"):
20 class TwistedTrial(Trial
):
22 # the Trial in Twisted >=2.1.0 has --recurse on by default, and -to
23 # turned into --reporter=bwverbose .
25 trialMode
= ["--reporter=bwverbose"]
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
35 def __init__(self
, source
):
36 BuildFactory
.__init
__(self
, [source
])
38 class QuickTwistedBuildFactory(TwistedBaseFactory
):
42 def __init__(self
, source
, python
="python"):
43 TwistedBaseFactory
.__init
__(self
, source
)
44 if type(python
) is str:
46 self
.addStep(HLint
, python
=python
[0])
47 self
.addStep(RemovePYCs
)
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
)
61 self
.addStep(ProcessDocs
)
63 if type(python
) == str:
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
=[],
88 TwistedBaseFactory
.__init
__(self
, source
)
90 if type(python
) == str:
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)
109 for reactor
in reactors
:
112 #if reactor in ['c', 'qt', 'win32']:
113 # # these are buggy, so tolerate failures for now
116 self
.addStep(RemovePYCs
) # TODO: why?
117 self
.addStep(TwistedTrial
, name
=reactor
, python
=python
,
118 reactor
=reactor
, flunkOnFailure
=flunkOnFailure
,
119 warnOnFailure
=warnOnFailure
)