diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-03-11 05:57:35 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-03-11 05:57:35 +0000 |
commit | 15b099239c1f3f0abab67bd689034fe12386adc9 (patch) | |
tree | bdace9a2b178a51be46d2db337e998195ef5cb9f | |
parent | 28355b368a48e1da35921fc347b5347b782a3094 (diff) | |
download | portage-15b099239c1f3f0abab67bd689034fe12386adc9.tar.gz portage-15b099239c1f3f0abab67bd689034fe12386adc9.tar.bz2 portage-15b099239c1f3f0abab67bd689034fe12386adc9.zip |
Make isvalidatom() identify empty slot as invalid (missing slot is valid) and
add a corresponding test case. (trunk r12654)
svn path=/main/branches/2.1.6/; revision=12922
-rw-r--r-- | pym/portage/dep.py | 4 | ||||
-rw-r--r-- | pym/portage/tests/dep/test_isvalidatom.py | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 04817068c..22fa8bf56 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -773,6 +773,10 @@ def isvalidatom(atom, allow_blockers=False): else: atom = atom[1:] + if dep_getslot(atom) == "": + # empty slot is invalid (None is valid) + return 0 + try: use = dep_getusedeps(atom) if use: diff --git a/pym/portage/tests/dep/test_isvalidatom.py b/pym/portage/tests/dep/test_isvalidatom.py index 1364a92a2..5d6b4e73a 100644 --- a/pym/portage/tests/dep/test_isvalidatom.py +++ b/pym/portage/tests/dep/test_isvalidatom.py @@ -25,6 +25,7 @@ class IsValidAtom(TestCase): ( "sys-apps/portage:foo", True ), ( "sys-apps/portage-2.1:foo", False ), ( "sys-apps/portage-2.1:", False ), + ( "sys-apps/portage-2.1:[foo]", False ), ( "=sys-apps/portage-2.2*:foo[bar?,!baz?,!doc=,build=]", True ), ( "=sys-apps/portage-2.2*:foo[doc?]", True ), ( "=sys-apps/portage-2.2*:foo[!doc?]", True ), |