[Yum-devel] [PATCH] get rid of DeprecationWarning which is cluttering up rpmdb open bugs.

Seth Vidal skvidal at fedoraproject.org
Tue Sep 15 20:29:03 UTC 2009


this is more or less the same as is in sqliteSack - I've checked everywhere
else to make sure it is anywhere else. Once we stop targetting python
2.4 or 2.5 we can just drop this code entirely.
---
 yum/config.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/yum/config.py b/yum/config.py
index 2f057c3..6b3d3ae 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -893,7 +893,13 @@ def _getsysver(installroot, distroverpkg):
         idx = ts.dbMatch('provides', distroverpkg)
     except TypeError, e:
         # This is code for "cannot open rpmdb"
-        raise Errors.YumBaseError("Error: " + e.message)
+        # this is for pep 352 compliance on python 2.6 and above :(
+        if sys.hexversion < 0x02050000:
+            if hasattr(e,'message'):
+                raise Errors.YumBaseError("Error: " + str(e.message))
+            else:
+                raise Errors.YumBaseError("Error: " + str(e))
+        raise Errors.YumBaseError("Error: " + str(e))
     # we're going to take the first one - if there is more than one of these
     # then the user needs a beating
     if idx.count() == 0:
-- 
1.6.2.5



More information about the Yum-devel mailing list