From bb1ac9ea20233ba764e989d36c8e8ea1cfc34cb3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 13 May 2012 02:31:15 -0700 Subject: [PATCH] match_from_list: preserve input in result This fixes an unintended change in behavior from commit f31320b67c9f593a2a8592e1a4e547f5f641943a. --- pym/portage/dep/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 240e2237f..31ec75cf6 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -2006,16 +2006,18 @@ def match_from_list(mydep, candidate_list): elif operator in [">", ">=", "<", "<="]: for x in candidate_list: - if not hasattr(x, 'cp'): + if hasattr(x, 'cp'): + pkg = x + else: try: - x = _pkg_str(remove_slot(x)) + pkg = _pkg_str(remove_slot(x)) except InvalidData: continue - if x.cp != mydep.cp: + if pkg.cp != mydep.cp: continue try: - result = vercmp(x.version, mydep.version) + result = vercmp(pkg.version, mydep.version) except ValueError: # pkgcmp may return ValueError during int() conversion writemsg(_("\nInvalid package name: %s\n") % x, noiselevel=-1) raise -- 2.26.2