Commit b536de62 authored by Robert Bradshaw's avatar Robert Bradshaw

Python 3 fix.

parent d4daf977
...@@ -9,7 +9,6 @@ cython.declare(os=object, re=object, operator=object, ...@@ -9,7 +9,6 @@ cython.declare(os=object, re=object, operator=object,
Utils=object, SourceDescriptor=object, StringIOTree=object, Utils=object, SourceDescriptor=object, StringIOTree=object,
DebugFlags=object, basestring=object) DebugFlags=object, basestring=object)
from md5 import md5
import os import os
import re import re
import sys import sys
...@@ -17,6 +16,11 @@ from string import Template ...@@ -17,6 +16,11 @@ from string import Template
import operator import operator
import textwrap import textwrap
try:
import hashlib
except ImportError:
import md5 as hashlib
import Naming import Naming
import Options import Options
import StringEncoding import StringEncoding
...@@ -1527,7 +1531,7 @@ class CCodeWriter(object): ...@@ -1527,7 +1531,7 @@ class CCodeWriter(object):
def put_or_include(self, code, name): def put_or_include(self, code, name):
if code: if code:
if self.globalstate.common_utility_include_dir and len(code) > 1042: if self.globalstate.common_utility_include_dir and len(code) > 1042:
include_file = "%s_%s.h" % (name, md5(code).hexdigest()) include_file = "%s_%s.h" % (name, hashlib.md5(code).hexdigest())
path = os.path.join(self.globalstate.common_utility_include_dir, include_file) path = os.path.join(self.globalstate.common_utility_include_dir, include_file)
if not os.path.exists(path): if not os.path.exists(path):
tmp_path = '%s.tmp%s' % (path, os.getpid()) tmp_path = '%s.tmp%s' % (path, os.getpid())
......
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