Commit 771be608 authored by tarek's avatar tarek

we need to be able to use these API to detect the real setuptools at bootstrap time

--HG--
branch : distribute
extra : rebase_source : befcf5fc39937e17b8f830b8393fcc6b1bafa17a
parent c4ba0437
...@@ -345,7 +345,8 @@ def fake_setuptools(): ...@@ -345,7 +345,8 @@ def fake_setuptools():
log.warn('Setuptools or Distribute does not seem to be installed.') log.warn('Setuptools or Distribute does not seem to be installed.')
return return
ws = pkg_resources.working_set 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: if setuptools_dist is None:
log.warn('No setuptools distribution found') log.warn('No setuptools distribution found')
return return
......
...@@ -485,7 +485,7 @@ class WorkingSet(object): ...@@ -485,7 +485,7 @@ class WorkingSet(object):
keys2.append(dist.key) keys2.append(dist.key)
self._added_new(dist) 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` """List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`, `requirements` must be a sequence of ``Requirement`` objects. `env`,
...@@ -504,7 +504,7 @@ class WorkingSet(object): ...@@ -504,7 +504,7 @@ class WorkingSet(object):
while requirements: while requirements:
req = requirements.pop(0) # process dependencies breadth-first req = requirements.pop(0) # process dependencies breadth-first
if _override_setuptools(req): if _override_setuptools(req) and replacement:
req = Requirement.parse('distribute') req = Requirement.parse('distribute')
if req in processed: if req in processed:
...@@ -2495,7 +2495,7 @@ class Requirement: ...@@ -2495,7 +2495,7 @@ class Requirement:
def __repr__(self): return "Requirement.parse(%r)" % str(self) def __repr__(self): return "Requirement.parse(%r)" % str(self)
#@staticmethod #@staticmethod
def parse(s): def parse(s, replacement=True):
reqs = list(parse_requirements(s)) reqs = list(parse_requirements(s))
if reqs: if reqs:
if len(reqs) == 1: if len(reqs) == 1:
...@@ -2503,7 +2503,7 @@ class Requirement: ...@@ -2503,7 +2503,7 @@ class Requirement:
# if asked for setuptools distribution # if asked for setuptools distribution
# and if distribute is installed, we want to give # and if distribute is installed, we want to give
# distribute instead # distribute instead
if _override_setuptools(founded_req): if _override_setuptools(founded_req) and replacement:
distribute = list(parse_requirements('distribute')) distribute = list(parse_requirements('distribute'))
if len(distribute) == 1: if len(distribute) == 1:
return distribute[0] return distribute[0]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment