[Checkins] SVN: projectsupport/trunk/src/workspace/develop.py If setuptools are not available, perform bootstrap and development dependency installation in one step.

Nathan Yergler nathan at yergler.net
Mon May 22 11:49:01 EDT 2006


Log message for revision 68243:
  If setuptools are not available, perform bootstrap and development dependency installation in one step.

Changed:
  U   projectsupport/trunk/src/workspace/develop.py

-=-
Modified: projectsupport/trunk/src/workspace/develop.py
===================================================================
--- projectsupport/trunk/src/workspace/develop.py	2006-05-22 15:48:13 UTC (rev 68242)
+++ projectsupport/trunk/src/workspace/develop.py	2006-05-22 15:49:01 UTC (rev 68243)
@@ -26,8 +26,9 @@
 DEV_SECTION = 'development'
 DEV_DEPENDS = 'depends'
 
-def bootstrap(libdir, bindir):
-    """Bootstrap our setuptools installation in the target directory."""
+def bootstrap(libdir, bindir, packages=[]):
+    """Bootstrap our setuptools installation in the target directory
+    and install any additional packages specified."""
 
     # make sure ez_setup is available
     try:
@@ -49,7 +50,7 @@
                                + ":" + libdir)
     ez_setup.main(['--install-dir', libdir,
                    '--script-dir', bindir,
-                   'setuptools'])
+                   '--site-dirs', libdir, ] + packages)
 
 def initSetupCfg(setup_file, template_file='setup.cfg.in'):
     """Check if the setup_file (setup.cfg) exists; if it doesn't, and
@@ -164,18 +165,18 @@
     check_dirs(options.bindir, options.libdir)
     sys.path.insert(0, options.libdir)
 
-    # see if we need to bootstrap setuptools
+    # install the development dependencies
+    deps = load_dev_deps(options.setup_cfg)
     try:
-        import setuptools
+        from setuptools.command.easy_install import main as einstall
+        if deps and len(deps) > 0:
+            einstall(deps)
+
     except ImportError, e:
-        # setuptools not available -- bootstrap into our libdir
-        bootstrap(options.libdir, options.bindir)
+        # setuptools not available -- bootstrap into our libdir 
+        # and allow setuptools to do the installation at the same time
+        bootstrap(options.libdir, options.bindir, packages=deps)
 
-    # install the development dependencies
-    from setuptools.command.easy_install import main as einstall
-    deps = load_dev_deps(options.setup_cfg)
-    if deps and len(deps) > 0:
-        einstall(deps)
     
 if __name__ == '__main__':
     main()



More information about the Checkins mailing list