Fix ProviderIndex.update(), which didn't remove stale providers.

This commit is contained in:
Todd Gamblin 2015-07-16 01:40:43 -07:00
parent e097696390
commit 19123b4c48

View File

@ -81,7 +81,16 @@ def update(self, spec):
provider_map[provided_spec] = set()
if self.restrict:
provider_map[provided_spec].add(spec)
provider_set = provider_map[provided_spec]
# If this package existed in the index before,
# need to take the old versions out, as they're
# now more constrained.
old = set([s for s in provider_set if s.name == spec.name])
provider_set.difference_update(old)
# Now add the new version.
provider_set.add(spec)
else:
# Before putting the spec in the map, constrain it so that