aotcompile.py.in: Use hashlib instead of md5 if available.

2009-07-23  Matthias Klose  <doko@ubuntu.com>

        * contrib/aotcompile.py.in: Use hashlib instead of md5 if available.

From-SVN: r150010
This commit is contained in:
Matthias Klose 2009-07-23 14:25:33 +00:00 committed by Matthias Klose
parent e27b834be0
commit fa89660f9a
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2009-07-23 Matthias Klose <doko@ubuntu.com>
* contrib/aotcompile.py.in: Use hashlib instead of md5 if available.
2009-07-17 Joseph Myers <joseph@codesourcery.com> 2009-07-17 Joseph Myers <joseph@codesourcery.com>
PR other/40784 PR other/40784

View File

@ -15,7 +15,11 @@
import classfile import classfile
import copy import copy
import md5 # The md5 module is deprecated in Python 2.5
try:
from hashlib import md5
except ImportError:
from md5 import md5
import operator import operator
import os import os
import sys import sys
@ -182,7 +186,7 @@ class Job:
def addClass(self, bytes, name): def addClass(self, bytes, name):
"""Subclasses call this from their __init__ method for """Subclasses call this from their __init__ method for
every class they find.""" every class they find."""
digest = md5.new(bytes).digest() digest = md5(bytes).digest()
self.classes[digest] = bytes self.classes[digest] = bytes
self.classnames[digest] = name self.classnames[digest] = name