2 from buildbot
.status
.builder
import SUCCESS
, FAILURE
, WARNINGS
3 from buildbot
.steps
.shell
import ShellCommand
7 StringIO
= cStringIO
.StringIO
9 from StringIO
import StringIO
12 class BuildEPYDoc(ShellCommand
):
14 command
= ["make", "epydocs"]
15 description
= ["building", "epydocs"]
16 descriptionDone
= ["epydoc"]
18 def createSummary(self
, log
):
23 for line
in StringIO(log
.getText()):
24 if line
.startswith("Error importing "):
26 if line
.find("Warning: ") != -1:
28 if line
.find("Error: ") != -1:
31 self
.descriptionDone
= self
.descriptionDone
[:]
33 self
.descriptionDone
.append("ierr=%d" % import_errors
)
35 self
.descriptionDone
.append("warn=%d" % warnings
)
37 self
.descriptionDone
.append("err=%d" % errors
)
39 self
.import_errors
= import_errors
40 self
.warnings
= warnings
43 def evaluateCommand(self
, cmd
):
46 if self
.warnings
or self
.errors
:
51 class PyFlakes(ShellCommand
):
53 command
= ["make", "pyflakes"]
54 description
= ["running", "pyflakes"]
55 descriptionDone
= ["pyflakes"]
56 flunkOnFailure
= False
57 flunkingIssues
= ["undefined"] # any pyflakes lines like this cause FAILURE
59 MESSAGES
= ("unused", "undefined", "redefs", "import*", "misc")
61 def createSummary(self
, log
):
64 for m
in self
.MESSAGES
:
68 for line
in StringIO(log
.getText()).readlines():
69 if "imported but unused" in line
:
71 elif "*' used; unable to detect undefined names" in line
:
73 elif "undefined name" in line
:
75 elif "redefinition of unused" in line
:
79 summaries
[m
].append(line
)
82 self
.descriptionDone
= self
.descriptionDone
[:]
83 for m
in self
.MESSAGES
:
85 self
.descriptionDone
.append("%s=%d" % (m
, counts
[m
]))
86 self
.addCompleteLog(m
, "".join(summaries
[m
]))
87 self
.setProperty("pyflakes-%s" % m
, counts
[m
])
88 self
.setProperty("pyflakes-total", sum(counts
.values()))
91 def evaluateCommand(self
, cmd
):
94 for m
in self
.flunkingIssues
:
95 if self
.getProperty("pyflakes-%s" % m
):
97 if self
.getProperty("pyflakes-total"):