diff options
-rw-r--r-- | pym/portage/dep/__init__.py | 9 | ||||
-rw-r--r-- | pym/portage/tests/dep/testAtom.py | 4 |
2 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index c58a83e44..e6f2362b1 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -399,6 +399,8 @@ class _use_dep(object): if "!" == first_char: conditional.disabled.append( self._validate_flag(x, x[1:-1])) + elif first_char in ("-", "=", "?"): + raise InvalidAtom(_("Invalid use dep: '%s'") % (x,)) else: conditional.enabled.append( self._validate_flag(x, x[:-1])) @@ -407,13 +409,20 @@ class _use_dep(object): if "!" == first_char: conditional.not_equal.append( self._validate_flag(x, x[1:-1])) + elif first_char in ("-", "=", "?"): + raise InvalidAtom(_("Invalid use dep: '%s'") % (x,)) else: conditional.equal.append( self._validate_flag(x, x[:-1])) + elif last_char in ("!", "-"): + raise InvalidAtom(_("Invalid use dep: '%s'") % (x,)) + else: if "-" == first_char: disabled_flags.append(self._validate_flag(x, x[1:])) + elif first_char in ("!", "=", "?"): + raise InvalidAtom(_("Invalid use dep: '%s'") % (x,)) else: enabled_flags.append(self._validate_flag(x, x)) diff --git a/pym/portage/tests/dep/testAtom.py b/pym/portage/tests/dep/testAtom.py index 7457babb7..091cef3a2 100644 --- a/pym/portage/tests/dep/testAtom.py +++ b/pym/portage/tests/dep/testAtom.py @@ -32,14 +32,14 @@ class TestAtom(TestCase): tests_xfail = [ ( "cat/pkg[a!]", False ), - #( "cat/pkg[a-]", False ), + ( "cat/pkg[a-]", False ), ( "cat/pkg[!a]", False ), ( "cat/pkg[!a!]", False ), ( "cat/pkg[!a-]", False ), ( "cat/pkg[-a=]", False ), ( "cat/pkg[-a?]", False ), ( "cat/pkg[-a!]", False ), - #( "cat/pkg[-a-]", False ), + ( "cat/pkg[-a-]", False ), ( "cat/pkg[=a]", False ), ( "cat/pkg[=a=]", False ), ( "cat/pkg[=a?]", False ), |