[cwctl] list will warn about a badly formatted version constraint instead of crashing stable
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Thu, 04 Mar 2010 16:58:40 +0100
branchstable
changeset 4798 d5bd706e9005
parent 4794 81075b09ebf1
child 4801 d3ea940e2b0c
child 4802 fa2297d6542a
[cwctl] list will warn about a badly formatted version constraint instead of crashing
cwctl.py
--- a/cwctl.py	Thu Mar 04 11:45:29 2010 +0100
+++ b/cwctl.py	Thu Mar 04 16:58:40 2010 +0100
@@ -204,7 +204,7 @@
             # simplify constraints
             if versions:
                 for constraint in versions:
-                    op, ver = constraint.split()
+                    op, ver = constraint
                     if oper is None:
                         oper = op
                         version = ver
@@ -238,7 +238,12 @@
             for name, constraint in use.items():
                 self.constraints.setdefault(name,set())
                 if constraint:
-                    self.constraints[name].add(constraint)
+                    try:
+                        oper, version = constraint.split()
+                        self.constraints[name].add( (oper, version) )
+                    except:
+                        self.warnings.append('cube %s depends on %s but constraint badly formatted: %s'
+                                             % (cube, name, constraint))
                 self.reverse_constraints.setdefault(name, set()).add(cube)
 
 class ListCommand(Command):