From ed905b99c72936785d73ceff1162d299244af6b4 Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Fri, 6 Jan 2012 13:27:29 +0100 Subject: [PATCH] Made is_valid and dontinvalidate properties in Excuse Use the is_valid in "html"-method to determine whether to write "Valid candidate" or not. This avoids the occasional: * Valid candidate * Invalidated by dependency * Not considered Signed-off-by: Niels Thykier --- britney.py | 9 +++++---- excuse.py | 21 ++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/britney.py b/britney.py index e3c94a5..f3dac30 100755 --- a/britney.py +++ b/britney.py @@ -1110,7 +1110,7 @@ class Britney: self.excuses.append(excuse) return False - excuse.addhtml("Valid candidate") + excuse.is_valid = True self.excuses.append(excuse) return True @@ -1216,7 +1216,7 @@ class Britney: # if there is nothing wrong and there is something worth doing, this is a valid candidate if not anywrongver and anyworthdoing: - excuse.addhtml("Valid candidate") + excuse.is_valid = True self.excuses.append(excuse) return True # else if there is something worth doing (but something wrong, too) this package won't be considered @@ -1458,7 +1458,7 @@ class Britney: # check if there is a `force' hint for this package, which allows it to go in even if it is not updateable forces = [ x for x in self.hints.search('force', package=src) if self.same_source(source_u[VERSION], x.version) ] if forces: - excuse.dontinvalidate = 1 + excuse.dontinvalidate = True if not update_candidate and forces: excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user)) update_candidate = True @@ -1474,7 +1474,7 @@ class Britney: # if the package can be updated, it is a valid candidate if update_candidate: - excuse.addhtml("Valid candidate") + excuse.is_valid = True # else it won't be considered else: excuse.addhtml("Not considered") @@ -1535,6 +1535,7 @@ class Britney: invalid.append(valid.pop(p)) exclookup[x].addhtml("Invalidated by dependency") exclookup[x].addhtml("Not considered") + exclookup[x].is_valid = False i = i + 1 def write_excuses(self): diff --git a/excuse.py b/excuse.py index 52178f5..e208191 100644 --- a/excuse.py +++ b/excuse.py @@ -50,7 +50,8 @@ class Excuse: self.daysold = None self.mindays = None self.section = None - self.dontinvalidate = 0 + self._is_valid = False + self._dontinvalidate = False self.invalid_deps = [] self.deps = {} @@ -60,6 +61,22 @@ class Excuse: self.bugs = [] self.htmlline = [] + @property + def is_valid(self): + return self._is_valid + + @is_valid.setter + def is_valid(self, value): + self._is_valid = value + + @property + def dontinvalidate(self): + return self._dontinvalidate + + @dontinvalidate.setter + def dontinvalidate(self, value): + self._dontinvalidate = value + def set_vers(self, tver, uver): """Set the testing and unstable versions""" if tver: self.ver = (tver, self.ver[1]) @@ -141,5 +158,7 @@ class Excuse: for (n,a) in self.break_deps: if n not in self.deps: res += "
  • Ignoring %s depends: %s\n" % (a, n, n) + if self.is_valid: + res += "
  • Valid candidate
  • \n" res = res + "\n" return res