diff options
| author | PJ Eby <distutils-sig@python.org> | 2005-08-06 20:54:01 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2005-08-06 20:54:01 +0000 |
| commit | 568f7f51fb0dea510cfae83b178c642a06b801bd (patch) | |
| tree | f745445a4fb71569bafd2e4c2444cc30964fbc8c /pkg_resources.py | |
| parent | 8afe820f59c3b63795bd235f2800b0e1329eb7e1 (diff) | |
| download | python-setuptools-git-568f7f51fb0dea510cfae83b178c642a06b801bd.tar.gz | |
Fix WorkingSet yielding the same distribution more than once if more than
one path entry points to it.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041182
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 6e040d08..ffc31319 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -367,16 +367,6 @@ class WorkingSet(object): - def __iter__(self): - """Yield distributions for non-duplicate projects in the working set - - The yield order is the order in which the items' path entries were - added to the working set. - """ - for item in self.entries: - for key in self.entry_keys[item]: - yield self.by_key[key] - def find(self, req): """Find a distribution matching requirement `req` @@ -408,6 +398,29 @@ class WorkingSet(object): elif name in entries: yield entries[name] + + + + + + + + + + + def __iter__(self): + """Yield distributions for non-duplicate projects in the working set + + The yield order is the order in which the items' path entries were + added to the working set. + """ + seen = {} + for item in self.entries: + for key in self.entry_keys[item]: + if key not in seen: + seen[key]=1 + yield self.by_key[key] + def add(self, dist, entry=None): """Add `dist` to working set, associated with `entry` @@ -431,24 +444,11 @@ class WorkingSet(object): self.by_key[dist.key] = dist keys = self.entry_keys[entry] - if dist.key not in keys: keys.append(dist.key) self._added_new(dist) - - - - - - - - - - - - def resolve(self, requirements, env=None, installer=None): """List all distributions needed to (recursively) meet `requirements` |
