Commit d0ec374e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

Factorise _compute_part_hash().

parent f210c1d2
...@@ -928,6 +928,12 @@ class Buildout(DictMixin): ...@@ -928,6 +928,12 @@ class Buildout(DictMixin):
self._logger.warning( self._logger.warning(
"Unexpected entry, %r, in develop-eggs directory.", f) "Unexpected entry, %r, in develop-eggs directory.", f)
def _compute_part_hash(self, part):
m = md5()
for k, v in sorted(self.get(part).items()):
m.update(('%r: %r' % (k, v)).encode())
return m.hexdigest()
def _compute_part_signatures(self, parts): def _compute_part_signatures(self, parts):
# Compute recipe signature and add to options # Compute recipe signature and add to options
for part in parts: for part in parts:
...@@ -938,10 +944,7 @@ class Buildout(DictMixin): ...@@ -938,10 +944,7 @@ class Buildout(DictMixin):
req = pkg_resources.Requirement.parse(recipe) req = pkg_resources.Requirement.parse(recipe)
sig = sorted(set(_dists_sig(pkg_resources.working_set.resolve([req])))) sig = sorted(set(_dists_sig(pkg_resources.working_set.resolve([req]))))
for dependency in sorted(getattr(options, '_dependency', [])): for dependency in sorted(getattr(options, '_dependency', [])):
m = md5() dependency_hash = self._compute_part_hash(dependency)
for k, v in sorted(self.get(dependency).items()):
m.update(('%r: %r' % (k, v)).encode())
dependency_hash = m.hexdigest()
sig.append('%s:%s' % (dependency, dependency_hash)) sig.append('%s:%s' % (dependency, dependency_hash))
options['__buildout_signature__'] = ' '.join(sig) options['__buildout_signature__'] = ' '.join(sig)
......
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