Author: gnichols
Date: 2010-01-12 16:32:44 +0000 (Tue, 12 Jan 2010)
New Revision: 289
Added:
trunk/v7/hash.py
Modified:
trunk/v7/report.py
Log:
484657 - hts uses code deprecated in python 2.6
Added: trunk/v7/hash.py
===================================================================
--- trunk/v7/hash.py (rev 0)
+++ trunk/v7/hash.py 2010-01-12 16:32:44 UTC (rev 289)
@@ -0,0 +1,45 @@
+# Copyright (c) 2006 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Greg Nichols
+#
+# The Report object packages and/or presents test results in text, rpm, or html form.
+#
+
+hashModule = None
+try:
+ import hashlib
+ hashModule = hashlib
+except:
+ pass
+
+if not hashModule:
+ try:
+ import md5
+ hashModule = md5
+ except:
+ print "Error: could not find hash library"
+
+if __name__ == "__main__":
+ print hashModule
+ content = "Boo"
+ m=hashModule.md5()
+ m.update(content)
+ print content
+
+
+
+
+
+
+
Modified: trunk/v7/report.py
===================================================================
--- trunk/v7/report.py 2010-01-12 16:16:23 UTC (rev 288)
+++ trunk/v7/report.py 2010-01-12 16:32:44 UTC (rev 289)
@@ -16,12 +16,13 @@
# The Report object packages and/or presents test results in text, rpm, or html form.
#
-import os,sys,shutil, hashlib, codecs
+import os,sys,shutil, codecs
import string
from v7.tags import Constants, Tags
from v7.controller import Controller
from v7.command import Command, V7CommandException
+from v7.hash import hashModule
class Report(Controller):
@@ -410,7 +411,7 @@
returnValue = 0
for line in log:
contents += line
- m=hashlib.md5()
+ m=hashModule.md5()
m.update(contents)
sum=int(m.hexdigest(),16)
# YK: write the decimal format result to output.log, not hex