Disable the multi-bracket USE deps syntax, so only the comma separated syntax
authorZac Medico <zmedico@gentoo.org>
Mon, 28 Jul 2008 06:43:29 +0000 (06:43 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 28 Jul 2008 06:43:29 +0000 (06:43 -0000)
is now valid.

svn path=/main/trunk/; revision=11232

pym/portage/dep.py
pym/portage/tests/dep/test_dep_getusedeps.py
pym/portage/tests/dep/test_isvalidatom.py

index aa1057d82e914bcd7c917e2a4f6c5f48a6555760..15782f0cb25aa046bb9d72b19f6712db1d9a29f0 100644 (file)
@@ -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 )
index 71b0fe290100809a39bf24138fc9d5db3948ae12..99a17b80de765cd54198e85f247b48c4de9a8269 100644 (file)
@@ -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:
index 397ce997b6b1d17fa4fc36b5a960c1e9dd3490ea..f7cc3b844e8533751372a328c3fd7a1f1c39813a 100644 (file)
@@ -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 ),