diff options
| -rw-r--r-- | indra/lib/python/indra/base/lluuid.py | 10 | ||||
| -rwxr-xr-x | scripts/install.py | 10 | 
2 files changed, 15 insertions, 5 deletions
| diff --git a/indra/lib/python/indra/base/lluuid.py b/indra/lib/python/indra/base/lluuid.py index aceea29cd2..1cdd8e915b 100644 --- a/indra/lib/python/indra/base/lluuid.py +++ b/indra/lib/python/indra/base/lluuid.py @@ -26,8 +26,14 @@ THE SOFTWARE.  $/LicenseInfo$  """ -import md5, random, socket, string, time, re +import random, socket, string, time, re  import uuid +try: +    # Python 2.6 +    from hashlib import md5 +except ImportError: +    # Python 2.5 and earlier +    from md5 import new as md5  def _int2binstr(i,l):      s='' @@ -196,7 +202,7 @@ class UUID(object):          from c++ implementation for portability reasons.          Returns self.          """ -        m = md5.new() +        m = md5()          m.update(uuid.uuid1().bytes)          self._bits = m.digest()          return self diff --git a/scripts/install.py b/scripts/install.py index 6278fba16c..78b8880b95 100755 --- a/scripts/install.py +++ b/scripts/install.py @@ -64,7 +64,6 @@ def add_indra_lib_path():  base_dir = add_indra_lib_path()  import copy -import md5  import optparse  import os  import platform @@ -75,7 +74,12 @@ import tempfile  import urllib2  import urlparse -from sets import Set as set, ImmutableSet as frozenset +try: +    # Python 2.6 +    from hashlib import md5 +except ImportError: +    # Python 2.5 and earlier +    from md5 import new as md5  from indra.base import llsd  from indra.util import helpformatter @@ -106,7 +110,7 @@ class InstallFile(object):          return "ifile{%s:%s}" % (self.pkgname, self.url)      def _is_md5sum_match(self): -        hasher = md5.new(file(self.filename, 'rb').read()) +        hasher = md5(file(self.filename, 'rb').read())          if hasher.hexdigest() == self.md5sum:              return  True          return False | 
