2 # Build classes specific to the Twisted codebase
4 from buildbot
.process
.base
import Build
5 from buildbot
.process
.factory
import BuildFactory
6 from buildbot
.steps
import shell
7 from buildbot
.steps
.python_twisted
import HLint
, ProcessDocs
, BuildDebs
, \
10 class TwistedBuild(Build
):
11 workdir
= "Twisted" # twisted's bin/trial expects to live in here
12 def isFileImportant(self
, filename
):
13 if filename
.startswith("doc/fun/"):
15 if filename
.startswith("sandbox/"):
19 class TwistedTrial(Trial
):
21 # the Trial in Twisted >=2.1.0 has --recurse on by default, and -to
22 # turned into --reporter=bwverbose .
24 trialMode
= ["--reporter=bwverbose"]
28 class TwistedBaseFactory(BuildFactory
):
29 buildClass
= TwistedBuild
30 # bin/trial expects its parent directory to be named "Twisted": it uses
31 # this to add the local tree to PYTHONPATH during tests
34 def __init__(self
, source
):
35 BuildFactory
.__init
__(self
, [source
])
37 class QuickTwistedBuildFactory(TwistedBaseFactory
):
41 def __init__(self
, source
, python
="python"):
42 TwistedBaseFactory
.__init
__(self
, source
)
43 if type(python
) is str:
45 self
.addStep(HLint
, python
=python
[0])
46 self
.addStep(RemovePYCs
)
48 cmd
= [p
, "setup.py", "build_ext", "-i"]
49 self
.addStep(shell
.Compile
, command
=cmd
, flunkOnFailure
=True)
50 self
.addStep(TwistedTrial
, python
=p
, testChanges
=True)
52 class FullTwistedBuildFactory(TwistedBaseFactory
):
53 treeStableTimer
= 5*60
55 def __init__(self
, source
, python
="python",
56 processDocs
=False, runTestsRandomly
=False,
57 compileOpts
=[], compileOpts2
=[]):
58 TwistedBaseFactory
.__init
__(self
, source
)
60 self
.addStep(ProcessDocs
)
62 if type(python
) == str:
64 assert isinstance(compileOpts
, list)
65 assert isinstance(compileOpts2
, list)
66 cmd
= (python
+ compileOpts
+ ["setup.py", "build_ext"]
67 + compileOpts2
+ ["-i"])
69 self
.addStep(shell
.Compile
, command
=cmd
, flunkOnFailure
=True)
70 self
.addStep(RemovePYCs
)
71 self
.addStep(TwistedTrial
, python
=python
, randomly
=runTestsRandomly
)
73 class TwistedDebsBuildFactory(TwistedBaseFactory
):
74 treeStableTimer
= 10*60
76 def __init__(self
, source
, python
="python"):
77 TwistedBaseFactory
.__init
__(self
, source
)
78 self
.addStep(ProcessDocs
, haltOnFailure
=True)
79 self
.addStep(BuildDebs
, warnOnWarnings
=True)
81 class TwistedReactorsBuildFactory(TwistedBaseFactory
):
82 treeStableTimer
= 5*60
84 def __init__(self
, source
,
85 python
="python", compileOpts
=[], compileOpts2
=[],
87 TwistedBaseFactory
.__init
__(self
, source
)
89 if type(python
) == str:
91 assert isinstance(compileOpts
, list)
92 assert isinstance(compileOpts2
, list)
93 cmd
= (python
+ compileOpts
+ ["setup.py", "build_ext"]
94 + compileOpts2
+ ["-i"])
96 self
.addStep(shell
.Compile
, command
=cmd
, warnOnFailure
=True)
108 for reactor
in reactors
:
111 #if reactor in ['c', 'qt', 'win32']:
112 # # these are buggy, so tolerate failures for now
115 self
.addStep(RemovePYCs
) # TODO: why?
116 self
.addStep(TwistedTrial
, name
=reactor
, python
=python
,
117 reactor
=reactor
, flunkOnFailure
=flunkOnFailure
,
118 warnOnFailure
=warnOnFailure
)