summaryrefslogtreecommitdiff
path: root/deps/v8/tools/presubmit.py
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/tools/presubmit.py')
-rwxr-xr-xdeps/v8/tools/presubmit.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/deps/v8/tools/presubmit.py b/deps/v8/tools/presubmit.py
index 04952e0b4a..e69c9a85ac 100755
--- a/deps/v8/tools/presubmit.py
+++ b/deps/v8/tools/presubmit.py
@@ -27,8 +27,14 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+try:
+ import hashlib
+ md5er = hashlib.md5
+except ImportError, e:
+ import md5
+ md5er = md5.new
+
-import md5
import optparse
import os
from os.path import abspath, join, dirname, basename, exists
@@ -126,7 +132,7 @@ class FileContentsCache(object):
for file in files:
try:
handle = open(file, "r")
- file_sum = md5.new(handle.read()).digest()
+ file_sum = md5er(handle.read()).digest()
if not file in self.sums or self.sums[file] != file_sum:
changed_or_new.append(file)
self.sums[file] = file_sum