Commit 85547fe5 authored by Sidnei da Silva's avatar Sidnei da Silva

- Conditionally import and use hashlib.md5 when it's available instead

  of md5 module, which is deprecated in Python 2.6.
parent 8754a5bf
...@@ -7,6 +7,9 @@ Change History ...@@ -7,6 +7,9 @@ Change History
1.1.2 (Unreleased) 1.1.2 (Unreleased)
================== ==================
- Conditionally import and use hashlib.md5 when it's available instead
of md5 module, which is deprecated in Python 2.6.
- Added Jython support for bootstrap, development bootstrap - Added Jython support for bootstrap, development bootstrap
and zc.buildout support on Jython and zc.buildout support on Jython
......
...@@ -18,7 +18,6 @@ $Id$ ...@@ -18,7 +18,6 @@ $Id$
import distutils.errors import distutils.errors
import logging import logging
import md5
import os import os
import pprint import pprint
import re import re
...@@ -36,6 +35,12 @@ import zc.buildout.easy_install ...@@ -36,6 +35,12 @@ import zc.buildout.easy_install
from rmtree import rmtree from rmtree import rmtree
try:
from hashlib import md5
except ImportError:
# Python 2.4 and older
from md5 import md5
realpath = zc.buildout.easy_install.realpath realpath = zc.buildout.easy_install.realpath
pkg_resources_loc = pkg_resources.working_set.find( pkg_resources_loc = pkg_resources.working_set.find(
...@@ -1202,7 +1207,7 @@ def _open(base, filename, seen): ...@@ -1202,7 +1207,7 @@ def _open(base, filename, seen):
ignore_directories = '.svn', 'CVS' ignore_directories = '.svn', 'CVS'
def _dir_hash(dir): def _dir_hash(dir):
hash = md5.new() hash = md5()
for (dirpath, dirnames, filenames) in os.walk(dir): for (dirpath, dirnames, filenames) in os.walk(dir):
dirnames[:] = [n for n in dirnames if n not in ignore_directories] dirnames[:] = [n for n in dirnames if n not in ignore_directories]
filenames[:] = [f for f in filenames filenames[:] = [f for f in filenames
......
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