[Buildbot-commits] buildbot/buildbot/steps python.py,1.2,1.3
Brian Warner
warner at users.sourceforge.net
Tue Sep 19 18:46:57 UTC 2006
Update of /cvsroot/buildbot/buildbot/buildbot/steps
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30314/buildbot/steps
Modified Files:
python.py
Log Message:
[project @ improve PyFlakes, add a unit test]
Original author: warner at lothar.com
Date: 2006-09-19 18:07:47
Index: python.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/python.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- python.py 18 Sep 2006 20:35:40 -0000 1.2
+++ python.py 19 Sep 2006 18:46:55 -0000 1.3
@@ -54,53 +54,47 @@
description = ["running", "pyflakes"]
descriptionDone = ["pyflakes"]
flunkOnFailure = False
+ flunkingIssues = ["undefined"] # any pyflakes lines like this cause FAILURE
+
+ MESSAGES = ("unused", "undefined", "redefs", "import*", "misc")
def createSummary(self, log):
- unused_imports = 0
- undefined_names = 0
- redefinition_of_unused = 0
- star_import = 0
- misc = 0
- total = 0
+ counts = {}
+ summaries = {}
+ for m in self.MESSAGES:
+ counts[m] = 0
+ summaries[m] = []
for line in StringIO(log.getText()).readlines():
if "imported but unused" in line:
- unused_imports += 1
+ m = "unused"
+ elif "*' used; unable to detect undefined names" in line:
+ m = "import*"
elif "undefined name" in line:
- undefined_names += 1
+ m = "undefined"
elif "redefinition of unused" in line:
- redefinition_of_unused += 1
- elif "*' used; unable to detect undefined names":
- star_import += 1
+ m = "redefs"
else:
- misc += 1
- total += 1
+ m = "misc"
+ summaries[m].append(line)
+ counts[m] += 1
self.descriptionDone = self.descriptionDone[:]
- if unused_imports:
- self.descriptionDone.append("unused=%d" % unused_imports)
- if undefined_names:
- self.descriptionDone.append("undefined=%s" % undefined_names)
- if redefinition_of_unused:
- self.descriptionDone.append("redefs=%s" % redefinition_of_unused)
- if star_import:
- self.descriptionDone.append("import*=%s" % star_import)
- if misc:
- self.descriptionDone.append("misc=%s" % misc)
- self.num_warnings = total
-
- self.setProperty("pyflakes-unused", unused_imports)
- self.setProperty("pyflakes-undefined", undefined_names)
- self.setProperty("pyflakes-redefinitions", redefinition_of_unused)
- self.setProperty("pyflakes-import*", star_import)
- self.setProperty("pyflakes-misc", misc)
- self.setProperty("pyflakes-total", total)
+ for m in self.MESSAGES:
+ if counts[m]:
+ self.descriptionDone.append("%s=%d" % (m, counts[m]))
+ self.addCompleteLog(m, "".join(summaries[m]))
+ self.setProperty("pyflakes-%s" % m, counts[m])
+ self.setProperty("pyflakes-total", sum(counts.values()))
def evaluateCommand(self, cmd):
if cmd.rc != 0:
return FAILURE
- if self.num_warnings:
+ for m in self.flunkingIssues:
+ if self.getProperty("pyflakes-%s" % m):
+ return FAILURE
+ if self.getProperty("pyflakes-total"):
return WARNINGS
return SUCCESS
More information about the Commits
mailing list