src/modules/misc.py
changeset 1516 8c950a3b4171
parent 1507 b956ea23d3a6
child 1782 147f5a8cfd69
--- a/src/modules/misc.py	Fri Nov 20 12:05:54 2009 -0800
+++ b/src/modules/misc.py	Mon Nov 30 13:01:40 2009 -0800
@@ -1,4 +1,4 @@
-#!/usr/bin/python2.4
+#!/usr/bin/python
 #
 # CDDL HEADER START
 #
@@ -27,6 +27,7 @@
 import cStringIO
 import datetime
 import errno
+import hashlib
 import httplib
 import locale
 import OpenSSL.crypto as osc
@@ -37,7 +38,6 @@
 import pkg.urlhelpers as urlhelpers
 import platform
 import re
-import sha
 import shutil
 import socket
 import stat
@@ -302,7 +302,7 @@
         if flag & FHCRC:
                 gz.read(2)
 
-        shasum = sha.new()
+        shasum = hashlib.sha1()
         dcobj = zlib.decompressobj(-zlib.MAX_WBITS)
 
         while True:
@@ -322,7 +322,7 @@
         """ Pipe exception. """
 
         def __init__(self, args=None):
-                self.args = args
+                self._args = args
 
 def msg(*text):
         """ Emit a message. """
@@ -563,7 +563,7 @@
         # Read the data in chunks and compute the SHA1 hash as it comes in.  A
         # large read on some platforms (e.g. Windows XP) may fail.
         content = cStringIO.StringIO()
-        fhash = sha.new()
+        fhash = hashlib.sha1()
         while length > 0:
                 data = f.read(min(bufsz, length))
                 if return_content:
@@ -622,7 +622,7 @@
 class CfgCacheError(Exception):
         """Thrown when there are errors with the cfg cache."""
         def __init__(self, args=None):
-                self.args = args
+                self._args = args
 
 # ImmutableDict and EmptyI for argument defaults
 EmptyI = tuple()