Commits

Anonymous committed 2cf4b6f

[svn r3728] Look for virtualenv package, for use in boot scripts to find Setuptools

Comments (0)

Files changed (2)

   ``distutils.cfg`` -- this has been causing problems for a lot of
   people, in rather obscure ways.
 
+* If you use a `boot script`_ it will attempt to import ``virtualenv``
+  and find a pre-downloaded Setuptools egg using that.
+
+.. _boot script: `Creating Your Own Bootstrap Scripts`_
+
 1.3.1
 ~~~~~
 
 
 def install_setuptools(py_executable, unzip=False):
     setup_fn = 'setuptools-0.6c9-py%s.egg' % sys.version[:3]
-    for dir in ['.', os.path.dirname(__file__), join(os.path.dirname(__file__), 'support-files')]:
+    search_dirs = ['.', os.path.dirname(__file__), join(os.path.dirname(__file__), 'support-files')]
+    if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
+        # Probably some boot script; just in case virtualenv is installed...
+        try:
+            import virtualenv
+        except ImportError:
+            pass
+        else:
+            search_dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'support-files'))
+    for dir in search_dirs:
         if os.path.exists(join(dir, setup_fn)):
             setup_fn = join(dir, setup_fn)
             break