[Scipy-svn] r5321 - trunk/scipy/weave

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Jan 4 07:30:00 EST 2009


Author: stefan
Date: 2009-01-04 06:29:39 -0600 (Sun, 04 Jan 2009)
New Revision: 5321

Added:
   trunk/scipy/weave/md5_load.py
Modified:
   trunk/scipy/weave/accelerate_tools.py
   trunk/scipy/weave/catalog.py
   trunk/scipy/weave/platform_info.py
Log:
Provide a version-agnostic md5 loader.

Modified: trunk/scipy/weave/accelerate_tools.py
===================================================================
--- trunk/scipy/weave/accelerate_tools.py	2009-01-04 11:23:56 UTC (rev 5320)
+++ trunk/scipy/weave/accelerate_tools.py	2009-01-04 12:29:39 UTC (rev 5321)
@@ -11,7 +11,7 @@
 
 from types import InstanceType, XRangeType
 import inspect
-import md5
+import scipy.weave.md5_load as md5
 import scipy.weave as weave
 
 from bytecodecompiler import CXXCoder,Type_Descriptor,Function_Descriptor

Modified: trunk/scipy/weave/catalog.py
===================================================================
--- trunk/scipy/weave/catalog.py	2009-01-04 11:23:56 UTC (rev 5320)
+++ trunk/scipy/weave/catalog.py	2009-01-04 12:29:39 UTC (rev 5321)
@@ -86,7 +86,7 @@
         Something that was a little more human readable would be
         nice, but the computer doesn't seem to care.
     """
-    import md5
+    import scipy.weave.md5_load as md5
     base = 'sc_'
     return base + md5.new(expr).hexdigest()
 

Added: trunk/scipy/weave/md5_load.py
===================================================================
--- trunk/scipy/weave/md5_load.py	2009-01-04 11:23:56 UTC (rev 5320)
+++ trunk/scipy/weave/md5_load.py	2009-01-04 12:29:39 UTC (rev 5321)
@@ -0,0 +1,10 @@
+# Import correct md5, irrespective of the Python version
+#
+# `hashlib` was introduced in 2.5, deprecating `md5`
+
+try:
+    from hashlib import *
+except ImportError:
+    from md5 import *
+
+new = md5

Modified: trunk/scipy/weave/platform_info.py
===================================================================
--- trunk/scipy/weave/platform_info.py	2009-01-04 11:23:56 UTC (rev 5320)
+++ trunk/scipy/weave/platform_info.py	2009-01-04 12:29:39 UTC (rev 5321)
@@ -88,8 +88,7 @@
     return exe_path
 
 def check_sum(file):
-
-    import md5
+    import scipy.weave.md5_load as md5
     try:
         f = open(file,'r')
         bytes = f.read(-1)




More information about the Scipy-svn mailing list