From 4b1886f9f2613d8bee389e67d8fc2313e6261cd7 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Tue, 11 Nov 2008 22:04:36 +0100 Subject: [PATCH] import fixes for Py2.6 --- pyximport/pyximport.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) -- 2.26.2