diff options
author | tarek <none@none> | 2009-10-15 16:16:55 +0200 |
---|---|---|
committer | tarek <none@none> | 2009-10-15 16:16:55 +0200 |
commit | 771be6089a83bb03edf8dc87cdce60d3a4d4e595 (patch) | |
tree | 5f0392b8cd072147dc46a3c95c3f716d15aab439 | |
parent | c4ba04373c08da643c5f1b9a0012857acc8e7262 (diff) | |
download | python-setuptools-git-771be6089a83bb03edf8dc87cdce60d3a4d4e595.tar.gz |
we need to be able to use these API to detect the real setuptools at bootstrap time
--HG--
branch : distribute
extra : rebase_source : befcf5fc39937e17b8f830b8393fcc6b1bafa17a
-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] |