summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-12 17:47:58 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-12 17:47:58 +0000
commit2aabcb8f69c1ef4cf170ec9f753eafb29c2e5555 (patch)
tree83a2a944e622246c96d65ce29206ea2a3b4445ae /pym
parent7b91f1411b2c1cfd53e18484c386c045154f5059 (diff)
downloadportage-2aabcb8f69c1ef4cf170ec9f753eafb29c2e5555.tar.gz
portage-2aabcb8f69c1ef4cf170ec9f753eafb29c2e5555.tar.bz2
portage-2aabcb8f69c1ef4cf170ec9f753eafb29c2e5555.zip
Reimplement isjustname() using the Atom class. Thanks to Marat Radchenko
<marat@slonopotamus.org> for the suggestion. svn path=/main/trunk/; revision=14234
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/dep.py21
1 files changed, 8 insertions, 13 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index cf06eca7f..c16b816b6 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -918,28 +918,23 @@ def isvalidatom(atom, allow_blockers=False):
def isjustname(mypkg):
"""
- Checks to see if the depstring is only the package name (no version parts)
+ Checks to see if the atom is only the package name (no version parts).
+ Raises InvalidAtom if the input is invalid.
Example usage:
>>> isjustname('media-libs/test-3.0')
- 0
- >>> isjustname('test')
- 1
+ False
>>> isjustname('media-libs/test')
- 1
+ True
@param mypkg: The package atom to check
- @param mypkg: String
+ @param mypkg: String or Atom
@rtype: Integer
@return: One of the following:
- 1) 0 if the package string is not just the package name
- 2) 1 if it is
+ 1) False if the package string is not just the package name
+ 2) True if it is
"""
- myparts = mypkg.split('-')
- for x in myparts:
- if ververify(x):
- return 0
- return 1
+ return str(mypkg) == str(Atom(mypkg).cp)
iscache = {}