From: Stefan Behnel Date: Tue, 11 Nov 2008 21:04:36 +0000 (+0100) Subject: import fixes for Py2.6 X-Git-Tag: 0.11-beta~263^2~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4b1886f9f2613d8bee389e67d8fc2313e6261cd7;p=cython.git import fixes for Py2.6 --- diff --git a/pyximport/pyximport.py b/pyximport/pyximport.py index e7c12bfc..cdbc435e 100644 --- a/pyximport/pyximport.py +++ b/pyximport/pyximport.py @@ -20,12 +20,17 @@ the documentation. This code was modeled on Quixote's ptl_import. """ import sys, os, shutil -import imp, ihooks, glob, md5 +import imp, ihooks, glob import __builtin__ import pyxbuild from distutils.dep_util import newer from distutils.extension import Extension +try: + import hashlib +except ImportError: + import md5 as hashlib + mod_name = "pyximport" assert sys.hexversion >= 0x20000b1, "need Python 2.0b1 or later" @@ -54,7 +59,7 @@ def _load_pyrex(name, filename): def get_distutils_extension(modname, pyxfilename): - extra = "_" + md5.md5(open(pyxfilename).read()).hexdigest() + extra = "_" + hashlib.md5(open(pyxfilename).read()).hexdigest() # modname = modname + extra extension_mod = handle_special_build(modname, pyxfilename)