From: Zac Medico Date: Mon, 14 Sep 2009 07:02:18 +0000 (-0000) Subject: Make get_operator() use Atom, and remove unnecessary reflection code from X-Git-Tag: v2.2_rc41~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2302543742e973cc6ac1026ab88a5abec04f6c69;p=portage.git Make get_operator() use Atom, and remove unnecessary reflection code from dep_getkey(). Thanks to Marat Radchenko for suggestions. svn path=/main/trunk/; revision=14256 --- 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