summaryrefslogtreecommitdiff
path: root/pkg_resources.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-11-16 09:40:21 -0500
committerJason R. Coombs <jaraco@jaraco.com>2014-11-16 09:40:21 -0500
commit4d4dbd3c5c69f63418ca2f22e9d6a3b8185b2e00 (patch)
tree01f6619f3630594bb677a10e4406fd822e9f6c26 /pkg_resources.py
parentc5fa038292a9c7d6fe529c4d8001cec0d3bac9cf (diff)
parent2c33dad04fd11ebd7fc8e15d0017ff2dc617e6a3 (diff)
downloadpython-setuptools-git-4d4dbd3c5c69f63418ca2f22e9d6a3b8185b2e00.tar.gz
Merge with master
--HG-- branch : feature/issue-229
Diffstat (limited to 'pkg_resources.py')
-rw-r--r--pkg_resources.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 517298c9..511068a6 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -590,6 +590,10 @@ class WorkingSet(object):
best = {}
to_activate = []
+ # Mapping of requirement to set of distributions that required it;
+ # useful for reporting info about conflicts.
+ required_by = collections.defaultdict(set)
+
while requirements:
# process dependencies breadth-first
req = requirements.pop(0)
@@ -623,9 +627,18 @@ class WorkingSet(object):
to_activate.append(dist)
if dist not in req:
# Oops, the "best" so far conflicts with a dependency
- # XXX put more info here
- raise VersionConflict(dist, req)
- requirements.extend(dist.requires(req.extras)[::-1])
+ tmpl = "%s is installed but %s is required by %s"
+ args = dist, req, list(required_by.get(req, []))
+ raise VersionConflict(tmpl % args)
+
+ # push the new requirements onto the stack
+ new_requirements = dist.requires(req.extras)[::-1]
+ requirements.extend(new_requirements)
+
+ # Register the new requirements needed by req
+ for new_requirement in new_requirements:
+ required_by[new_requirement].add(req.project_name)
+
processed[req] = True
# return list of distros to activate