Anonymous avatar Anonymous committed 42ce838

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

Comments (0)

Files changed (2)

distribute_setup.py

         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
             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`,
 
         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)
 
     #@staticmethod
-    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]
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.