summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@lindenlab.com>2009-06-22 22:36:36 +0000
committerBryan O'Sullivan <bos@lindenlab.com>2009-06-22 22:36:36 +0000
commit5f4c09fa1f4b09126e1a16e78044c64e97828530 (patch)
tree52caaf0b7bf125ba4b4840bd7705b3d3a10bd878 /scripts
parent8ed056fde9fe5fc9755158013a5cb8be73066e2c (diff)
Python 2.4 and 2.6 improvements
The sets module is no longer needed with Python 2.4, and causes a DeprecationWarning with 2.6, so drop it The md5 module causes a DeprecationWarning with 2.6, so try to import hashlib (its replacement) instead, else fall back Reviewed by Poppy.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install.py10
1 files changed, 7 insertions, 3 deletions
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