diff options
-rw-r--r-- | distribute_setup.py | 3 | ||||
-rw-r--r-- | pkg_resources.py | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/distribute_setup.py b/distribute_setup.py index cf56fb28..0843b3c4 100644 --- a/distribute_setup.py +++ b/distribute_setup.py @@ -345,7 +345,8 @@ def fake_setuptools(): log.warn('Setuptools or Distribute does not seem to be installed.') return ws = pkg_resources.working_set - setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools')) + setuptools_dist = ws.find(pkg_resources.Requirement.parse('setuptools', + replacement=False)) if setuptools_dist is None: log.warn('No setuptools distribution found') return diff --git a/pkg_resources.py b/pkg_resources.py index c0371864..49c26620 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -485,7 +485,7 @@ class WorkingSet(object): keys2.append(dist.key) self._added_new(dist) - def resolve(self, requirements, env=None, installer=None): + def resolve(self, requirements, env=None, installer=None, replacement=True): """List all distributions needed to (recursively) meet `requirements` `requirements` must be a sequence of ``Requirement`` objects. `env`, @@ -504,7 +504,7 @@ class WorkingSet(object): while requirements: req = requirements.pop(0) # process dependencies breadth-first - if _override_setuptools(req): + if _override_setuptools(req) and replacement: req = Requirement.parse('distribute') if req in processed: @@ -2495,7 +2495,7 @@ class Requirement: def __repr__(self): return "Requirement.parse(%r)" % str(self) #@staticmethod - def parse(s): + def parse(s, replacement=True): reqs = list(parse_requirements(s)) if reqs: if len(reqs) == 1: @@ -2503,7 +2503,7 @@ class Requirement: # if asked for setuptools distribution # and if distribute is installed, we want to give # distribute instead - if _override_setuptools(founded_req): + if _override_setuptools(founded_req) and replacement: distribute = list(parse_requirements('distribute')) if len(distribute) == 1: return distribute[0] |