diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-09-14 07:02:18 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-09-14 07:02:18 +0000 |
commit | 2302543742e973cc6ac1026ab88a5abec04f6c69 (patch) | |
tree | 2c65ddaf95630846f846888ba0b2cba15babd964 | |
parent | 176fceb15b06598a8bfc32cd3ecc5284212ec739 (diff) | |
download | portage-2302543742e973cc6ac1026ab88a5abec04f6c69.tar.gz portage-2302543742e973cc6ac1026ab88a5abec04f6c69.tar.bz2 portage-2302543742e973cc6ac1026ab88a5abec04f6c69.zip |
Make get_operator() use Atom, and remove unnecessary reflection code from
dep_getkey(). Thanks to Marat Radchenko <marat@slonopotamus.org> for
suggestions.
svn path=/main/trunk/; revision=14256
-rw-r--r-- | pym/portage/dep.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 38a84dc72..929e31dbe 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -710,9 +710,13 @@ def get_operator(mydep): @return: The operator. One of: '~', '=', '>', '<', '=*', '>=', or '<=' """ - operator = getattr(mydep, "operator", False) - if operator is not False: - return operator + try: + return Atom(mydep).operator + except InvalidAtom: + pass + + # Fall back to legacy code for backward compatibility. + operator = None if mydep: mydep = remove_slot(mydep) if not mydep: @@ -988,9 +992,6 @@ def dep_getkey(mydep): @rtype: String @return: The package category/package-version """ - cp = getattr(mydep, "cp", None) - if cp is not None: - return cp try: return Atom(mydep).cp |