diff options
-rw-r--r-- | pym/portage/dep.py | 5 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_dep_getusedeps.py | 3 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_isvalidatom.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py index aa1057d82..15782f0cb 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -396,7 +396,7 @@ class _use_dep(object): break def __str__(self): - return "".join("[%s]" % x for x in self.tokens) + return "[%s]" % (",".join(x for x in self.tokens),) def evaluate_conditionals(self, use): """ @@ -640,6 +640,9 @@ def dep_getusedeps( depend ): bracket_count = 0 while( open_bracket != -1 ): bracket_count += 1 + if bracket_count > 1: + raise InvalidAtom("USE Dependency with more " + \ + "than one set of brackets: %s" % (depend,)) close_bracket = depend.find(']', open_bracket ) if close_bracket == -1: raise InvalidAtom("USE Dependency with no closing bracket: %s" % depend ) diff --git a/pym/portage/tests/dep/test_dep_getusedeps.py b/pym/portage/tests/dep/test_dep_getusedeps.py index 71b0fe290..99a17b80d 100644 --- a/pym/portage/tests/dep/test_dep_getusedeps.py +++ b/pym/portage/tests/dep/test_dep_getusedeps.py @@ -25,8 +25,7 @@ class DepGetUseDeps(TestCase): if slot: cpv += ":" + slot if isinstance(use, tuple): - for u in use: - cpv = cpv + "[" + u + "]" + cpv += "[%s]" % (",".join(use),) self.assertEqual( dep_getusedeps( cpv ), use ) else: diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 397ce997b..f7cc3b844 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -30,7 +30,7 @@ class IsValidAtom(TestCase): ( "=sys-apps/portage-2.2*:foo[doc!=]", True ), ( "=sys-apps/portage-2.2*:foo[-doc!=]", False ), ( "=sys-apps/portage-2.2*:foo[-doc=]", False ), - ( "=sys-apps/portage-2.2*:foo[bar][-baz][doc?][-build?]", True ), + ( "=sys-apps/portage-2.2*:foo[bar][-baz][doc?][-build?]", False ), ( "=sys-apps/portage-2.2*:foo[bar,-baz,doc?,-build?]", True ), ( "=sys-apps/portage-2.2*:foo[bar,-baz,doc?,-build?,]", False ), ( "=sys-apps/portage-2.2*:foo[,bar,-baz,doc?,-build?]", False ), |