From 869537f3b703119ceb397b85ca38b4dff99b8d6b Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 6 Aug 2010 21:48:09 +0000 Subject: Don't assume python2.5 is being used on successful hashlib import The hashlib module has been backported to earlier versions of python. If we assume that 2.5 is in use, then python will go crazy looking for stuff that doesn't exist in earlier versions. This patch will allow older versions of python installed alongside a standalone hashlib module to work properly. Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@6004 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Tools/rpmtools.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/Client') diff --git a/src/lib/Client/Tools/rpmtools.py b/src/lib/Client/Tools/rpmtools.py index c9385196f..e224a3fb3 100755 --- a/src/lib/Client/Tools/rpmtools.py +++ b/src/lib/Client/Tools/rpmtools.py @@ -21,19 +21,19 @@ __revision__ = '$Revision$' import grp -try: - import hashlib - py24compat = False -except: - # FIXME: Remove when client python dep is 2.5 or greater - py24compat = True - import md5 import optparse import os import pwd import rpm import stat import sys +if sys.version_info >= (2, 5): + import hashlib + py24compat = False +else: + # FIXME: Remove when client python dep is 2.5 or greater + py24compat = True + import md5 # Determine what prelink tools we have available. # The isprelink module is a python extension that examines the ELF headers -- cgit v1.2.3-1-g7c22