diff options
| author | Donald Stufft <donald@stufft.io> | 2014-11-19 12:39:18 -0500 | 
|---|---|---|
| committer | Donald Stufft <donald@stufft.io> | 2014-11-19 12:39:18 -0500 | 
| commit | 09ecca34b3eeb76d4f231040338e1c68bf770702 (patch) | |
| tree | 54be2e06b0bf378a4a2daa616790fa9bf949bceb /pkg_resources.py | |
| parent | 5e62aa3b59398252faef0d638a0f087d6c682800 (diff) | |
| parent | affa001a6767efee24b4d6bc1a2f04eb7aeea65b (diff) | |
| download | python-setuptools-git-09ecca34b3eeb76d4f231040338e1c68bf770702.tar.gz | |
Merge branch 'master' into use-packaging
Conflicts:
	.hgtags
	CHANGES.txt
	ez_setup.py
	setuptools.egg-info/requires.txt
	setuptools/version.py
Diffstat (limited to 'pkg_resources.py')
| -rw-r--r-- | pkg_resources.py | 19 | 
1 files changed, 16 insertions, 3 deletions
| diff --git a/pkg_resources.py b/pkg_resources.py index 6f21b0bf..daf7732c 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -602,6 +602,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) @@ -635,9 +639,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 | 
