diff options
author | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-10-10 11:48:58 -0700 |
---|---|---|
committer | Marc Abramowitz <marc@marc-abramowitz.com> | 2014-10-10 11:48:58 -0700 |
commit | 8f0143925d3178e030704a86f47d07525e193009 (patch) | |
tree | ac4b7a894788865617ca7c5fb70204e973053493 | |
parent | 86a029b36192d47e95321e8c26b4b289b6cd1c86 (diff) | |
download | python-setuptools-bitbucket-8f0143925d3178e030704a86f47d07525e193009.tar.gz |
Make VersionConflict report who is requiring package
fixes issue 268
-rw-r--r-- | pkg_resources.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 517298c9..1ca8dd8e 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -589,6 +589,9 @@ class WorkingSet(object): # key -> dist best = {} to_activate = [] + # key with req -> set of things that required it + # useful for reporting info about conflicts + required_by = collections.defaultdict(set) while requirements: # process dependencies breadth-first @@ -624,8 +627,13 @@ class WorkingSet(object): 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]) + raise VersionConflict( + "%s is installed but %s is required by %s" + % (dist, req, list(required_by.get(req)))) + new_requirements = dist.requires(req.extras)[::-1] + requirements.extend(new_requirements) + for new_requirement in new_requirements: + required_by[new_requirement].add(req.project_name) processed[req] = True # return list of distros to activate |