tarek  committed 42ce838

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

  • Participants
  • Parent commits 13afb54
  • Branches 0.6-maintenance

Comments (0)

Files changed (2)


         log.warn('Setuptools or Distribute does not seem to be installed.')
     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')


-    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`,
         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:
     def __repr__(self): return "Requirement.parse(%r)" % str(self)
-    def parse(s):
+    def parse(s, replacement=True):
         reqs = list(parse_requirements(s))
         if reqs:
             if len(reqs) == 1:
                 # 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]