-
Xavier Thompson authored
Replace `pkg_resources.Environment(ws.entries).best_match(req, ws)` with `ws.find(req)`. The first already starts by calling `ws.find(req)` to attempt to find an already activated dist in the working set, but if none is found it then proceeds to scan through the entries of the environment - i.e. the locations of the directly-requested distributions, `ws.entries` - to activate a dist at these locations if one matches. This is problematic when directly-requested distributions are found in a location shared by multiple dists, such as site-packages: this gives that location precedence over the normal order of locations scanned by easy_install, and can result in undesired versions being chosen over versions available in ./eggs or in ./develop-eggs. The random aspect of this is also problematic, as the order of paths considered will depend on the order of the directly-requested distributions and where they are found.
815cdf75