| OLD | NEW |
| (Empty) |
| 1 | |
| 2 # Build classes specific to the Twisted codebase | |
| 3 | |
| 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, \ | |
| 8 Trial, RemovePYCs | |
| 9 | |
| 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/"): | |
| 14 return 0 | |
| 15 if filename.startswith("sandbox/"): | |
| 16 return 0 | |
| 17 return 1 | |
| 18 | |
| 19 class TwistedTrial(Trial): | |
| 20 tests = "twisted" | |
| 21 # the Trial in Twisted >=2.1.0 has --recurse on by default, and -to | |
| 22 # turned into --reporter=bwverbose . | |
| 23 recurse = False | |
| 24 trialMode = ["--reporter=bwverbose"] | |
| 25 testpath = None | |
| 26 trial = "./bin/trial" | |
| 27 | |
| 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 | |
| 32 workdir = "Twisted" | |
| 33 | |
| 34 def __init__(self, source): | |
| 35 BuildFactory.__init__(self, [source]) | |
| 36 | |
| 37 class QuickTwistedBuildFactory(TwistedBaseFactory): | |
| 38 treeStableTimer = 30 | |
| 39 useProgress = 0 | |
| 40 | |
| 41 def __init__(self, source, python="python"): | |
| 42 TwistedBaseFactory.__init__(self, source) | |
| 43 if type(python) is str: | |
| 44 python = [python] | |
| 45 self.addStep(HLint, python=python[0]) | |
| 46 self.addStep(RemovePYCs) | |
| 47 for p in python: | |
| 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) | |
| 51 | |
| 52 class FullTwistedBuildFactory(TwistedBaseFactory): | |
| 53 treeStableTimer = 5*60 | |
| 54 | |
| 55 def __init__(self, source, python="python", | |
| 56 processDocs=False, runTestsRandomly=False, | |
| 57 compileOpts=[], compileOpts2=[]): | |
| 58 TwistedBaseFactory.__init__(self, source) | |
| 59 if processDocs: | |
| 60 self.addStep(ProcessDocs) | |
| 61 | |
| 62 if type(python) == str: | |
| 63 python = [python] | |
| 64 assert isinstance(compileOpts, list) | |
| 65 assert isinstance(compileOpts2, list) | |
| 66 cmd = (python + compileOpts + ["setup.py", "build_ext"] | |
| 67 + compileOpts2 + ["-i"]) | |
| 68 | |
| 69 self.addStep(shell.Compile, command=cmd, flunkOnFailure=True) | |
| 70 self.addStep(RemovePYCs) | |
| 71 self.addStep(TwistedTrial, python=python, randomly=runTestsRandomly) | |
| 72 | |
| 73 class TwistedDebsBuildFactory(TwistedBaseFactory): | |
| 74 treeStableTimer = 10*60 | |
| 75 | |
| 76 def __init__(self, source, python="python"): | |
| 77 TwistedBaseFactory.__init__(self, source) | |
| 78 self.addStep(ProcessDocs, haltOnFailure=True) | |
| 79 self.addStep(BuildDebs, warnOnWarnings=True) | |
| 80 | |
| 81 class TwistedReactorsBuildFactory(TwistedBaseFactory): | |
| 82 treeStableTimer = 5*60 | |
| 83 | |
| 84 def __init__(self, source, | |
| 85 python="python", compileOpts=[], compileOpts2=[], | |
| 86 reactors=None): | |
| 87 TwistedBaseFactory.__init__(self, source) | |
| 88 | |
| 89 if type(python) == str: | |
| 90 python = [python] | |
| 91 assert isinstance(compileOpts, list) | |
| 92 assert isinstance(compileOpts2, list) | |
| 93 cmd = (python + compileOpts + ["setup.py", "build_ext"] | |
| 94 + compileOpts2 + ["-i"]) | |
| 95 | |
| 96 self.addStep(shell.Compile, command=cmd, warnOnFailure=True) | |
| 97 | |
| 98 if reactors == None: | |
| 99 reactors = [ | |
| 100 'gtk2', | |
| 101 'gtk', | |
| 102 #'kqueue', | |
| 103 'poll', | |
| 104 'c', | |
| 105 'qt', | |
| 106 #'win32', | |
| 107 ] | |
| 108 for reactor in reactors: | |
| 109 flunkOnFailure = 1 | |
| 110 warnOnFailure = 0 | |
| 111 #if reactor in ['c', 'qt', 'win32']: | |
| 112 # # these are buggy, so tolerate failures for now | |
| 113 # flunkOnFailure = 0 | |
| 114 # warnOnFailure = 1 | |
| 115 self.addStep(RemovePYCs) # TODO: why? | |
| 116 self.addStep(TwistedTrial, name=reactor, python=python, | |
| 117 reactor=reactor, flunkOnFailure=flunkOnFailure, | |
| 118 warnOnFailure=warnOnFailure) | |
| OLD | NEW |