Commit a8cbb422 authored by Hanno Schlichting's avatar Hanno Schlichting

Backport of c120884 from trunk

parent e335fcc7
......@@ -4,6 +4,8 @@ Change History
1.4.5 (unreleased)
==================
- Introduce a cache for the expensive `buildout._dir_hash` function.
- Remove duplicate path from script's sys.path setup.
Bugs fixed:
......
......@@ -1371,7 +1371,11 @@ def _open(base, filename, seen, dl_options, override):
ignore_directories = '.svn', 'CVS'
_dir_hashes = {}
def _dir_hash(dir):
dir_hash = _dir_hashes.get(dir, None)
if dir_hash is not None:
return dir_hash
hash = md5()
for (dirpath, dirnames, filenames) in os.walk(dir):
dirnames[:] = [n for n in dirnames if n not in ignore_directories]
......@@ -1383,7 +1387,8 @@ def _dir_hash(dir):
hash.update(' '.join(filenames))
for name in filenames:
hash.update(open(os.path.join(dirpath, name)).read())
return hash.digest().encode('base64').strip()
_dir_hashes[dir] = dir_hash = hash.digest().encode('base64').strip()
return dir_hash
def _dists_sig(dists):
result = []
......
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