* fix: consider not only the last update but all those friggin' updates

* fix: handle empty sequences in any and every fnxs
This commit is contained in:
Eray Özkural
2006-06-05 20:59:08 +00:00
parent 0956de2f5d
commit 3481d9cf32
2 changed files with 6 additions and 4 deletions
+4 -2
View File
@@ -392,8 +392,10 @@ def upgrade_pkg_names(A = []):
ctx.ui.info(_('Package %s is not available in repositories.') % x, True) ctx.ui.info(_('Package %s is not available in repositories.') % x, True)
continue continue
if security and pkg.history[0].type != 'security': if security: # below is a readable functional code, don't overflow lines!
continue updates = [x for x in pkg.history if Version(x.release) > Version(release)]
if not pisi.util.any(lambda x:x.type == 'security', updates):
continue
if ignore_build or (not build) or (not pkg.build): if ignore_build or (not build) or (not pkg.build):
if Version(release) < Version(pkg.release): if Version(release) < Version(pkg.release):
+2 -2
View File
@@ -74,10 +74,10 @@ class Checks:
######################### #########################
def every(pred, seq): def every(pred, seq):
return reduce(operator.and_, map(pred, seq)) return reduce(operator.and_, map(pred, seq), True)
def any(pred, seq): def any(pred, seq):
return reduce(operator.or_, map(pred, seq)) return reduce(operator.or_, map(pred, seq), False)
def unzip(seq): def unzip(seq):
return zip(*seq) return zip(*seq)