summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-09-19 23:05:24 +0000
committerZac Medico <zmedico@gentoo.org>2009-09-19 23:05:24 +0000
commita1b0e97ef724a6decc439b193fdff94f933d0743 (patch)
tree4ec0a44b447fa960fd131dd64ab2f2502321ae71
parentbc400181e511105e34678c7106e05ca8f93e2437 (diff)
downloadportage-a1b0e97ef724a6decc439b193fdff94f933d0743.tar.gz
portage-a1b0e97ef724a6decc439b193fdff94f933d0743.tar.bz2
portage-a1b0e97ef724a6decc439b193fdff94f933d0743.zip
Add isinstance(mydep, Atom) checks to the dep_* functions since we don't use av2.2_rc41
metaclass to do that anymore (due to performance). svn path=/main/trunk/; revision=14286
-rw-r--r--pym/portage/dep.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py
index bd576b768..66557c0c6 100644
--- a/pym/portage/dep.py
+++ b/pym/portage/dep.py
@@ -683,6 +683,8 @@ def get_operator(mydep):
@return: The operator. One of:
'~', '=', '>', '<', '=*', '>=', or '<='
"""
+ if isinstance(mydep, Atom):
+ return mydep.operator
try:
return Atom(mydep).operator
except InvalidAtom:
@@ -724,7 +726,8 @@ def dep_getcpv(mydep):
@rtype: String
@return: The depstring with the operator removed
"""
-
+ if isinstance(mydep, Atom):
+ return mydep.cpv
try:
return Atom(mydep).cpv
except InvalidAtom:
@@ -885,7 +888,8 @@ def isvalidatom(atom, allow_blockers=False):
2) True if the atom is valid
"""
try:
- atom = Atom(atom)
+ if not isinstance(atom, Atom):
+ atom = Atom(atom)
if not allow_blockers and atom.blocker:
return False
return True
@@ -910,7 +914,9 @@ def isjustname(mypkg):
2) True if it is
"""
try:
- return mypkg == Atom(mypkg).cp
+ if not isinstance(mypkg, Atom):
+ mypkg = Atom(mypkg)
+ return mypkg == mypkg.cp
except InvalidAtom:
pass
@@ -938,7 +944,9 @@ def isspecific(mypkg):
2) True if it is
"""
try:
- return mypkg != Atom(mypkg).cp
+ if not isinstance(mypkg, Atom):
+ mypkg = Atom(mypkg)
+ return mypkg != mypkg.cp
except InvalidAtom:
pass
@@ -956,9 +964,10 @@ def dep_getkey(mydep):
@param mydep: The depstring to retrieve the category/package-name of
@type mydep: String
@rtype: String
- @return: The package category/package-version
+ @return: The package category/package-name
"""
-
+ if isinstance(mydep, Atom):
+ return mydep.cp
try:
return Atom(mydep).cp
except InvalidAtom: