[Yum-devel] [PATCH 2/2] avoid the code duplication and just do it once

Seth Vidal skvidal at fedoraproject.org
Fri Aug 28 15:22:31 UTC 2009


fix up to last patch
---
 yum/__init__.py |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/yum/__init__.py b/yum/__init__.py
index b395457..6df305e 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2395,19 +2395,20 @@ class YumBase(depsolve.Depsolve):
         """Pass in a generic [build]require string and this function will 
            pass back the best(or first) package it finds providing that dep."""
         
+        # we get all sorts of randomness here
+        errstring = depstring
+        if type(depstring) not in types.StringTypes:
+            errtring = str(depstring)
+        
         try:
             pkglist = self.returnPackagesByDep(depstring)
         except Errors.YumBaseError:
-            if type(depstring) not in types.StringTypes:
-                depstring = str(depstring)
-            raise Errors.YumBaseError, _('No Package found for %s') % depstring
+            raise Errors.YumBaseError, _('No Package found for %s') % errstring
         
         ps = ListPackageSack(pkglist)
         result = self._bestPackageFromList(ps.returnNewestByNameArch())
         if result is None:
-            if type(depstring) not in types.StringTypes:
-                depstring = str(depstring)
-            raise Errors.YumBaseError, _('No Package found for %s') % depstring
+            raise Errors.YumBaseError, _('No Package found for %s') % errstring
         
         return result
 
-- 
1.6.2.5



More information about the Yum-devel mailing list