Commit 6b760cb3 authored by Stefan Behnel's avatar Stefan Behnel

Py2.6/3.0 import fixes

parent 39389bdc
......@@ -10,7 +10,10 @@ from PyrexTypes import py_object_type, typecast
from TypeSlots import method_coexist
from Scanning import SourceDescriptor
from Cython.StringIOTree import StringIOTree
from sets import Set as set
try:
set
except NameError:
from sets import Set as set
class FunctionContext(object):
# Not used for now, perhaps later
......
......@@ -38,7 +38,10 @@ def hash_source_file(path):
# Try to calculate a hash code for the given source file.
# Returns an empty string if the file cannot be accessed.
#print "Hashing", path ###
import md5
try:
from hashlib import md5 as new_md5
except ImportError:
from md5 import new as new_md5
try:
try:
f = open(path, "rU")
......@@ -54,7 +57,7 @@ def hash_source_file(path):
# tabs by a single space.
import re
text = re.sub("[ \t]+", " ", text)
hash = md5.new(text).hexdigest()
hash = new_md5(text).hexdigest()
return hash
def open_pickled_lexicon(expected_hash):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment