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
:
69 for line
in StringIO(log
.getText()).readlines():
70 # the first few lines might contain echoed commands from a 'make
71 # pyflakes' step, so don't count these as warnings. Stop ignoring
72 # the initial lines as soon as we see one with a colon.
74 if line
.find(":") != -1:
75 # there's the colon, this is the first real line
77 # fall through and parse the line
79 # skip this line, keep skipping non-colon lines
81 if line
.find("imported but unused") != -1:
83 elif line
.find("*' used; unable to detect undefined names") != -1:
85 elif line
.find("undefined name") != -1:
87 elif line
.find("redefinition of unused") != -1:
91 summaries
[m
].append(line
)
94 self
.descriptionDone
= self
.descriptionDone
[:]
95 for m
in self
.MESSAGES
:
97 self
.descriptionDone
.append("%s=%d" % (m
, counts
[m
]))
98 self
.addCompleteLog(m
, "".join(summaries
[m
]))
99 self
.setProperty("pyflakes-%s" % m
, counts
[m
])
100 self
.setProperty("pyflakes-total", sum(counts
.values()))
103 def evaluateCommand(self
, cmd
):
106 for m
in self
.flunkingIssues
:
107 if self
.getProperty("pyflakes-%s" % m
):
109 if self
.getProperty("pyflakes-total"):