[Checkins] SVN: zc.sourcerelease/branches/lgs-distribute-support/src/zc/sourcerelease/__init__.py Add support for distribute by adding a couple of command line args. One for using distribute and the other for setuptools which is the current one. Distribute is the default one

Lorenzo Gil lorenzo.gil.sanchez at gmail.com
Mon Oct 4 12:35:30 EDT 2010


Log message for revision 117220:
  Add support for distribute by adding a couple of command line args. One for using distribute and the other for setuptools which is the current one. Distribute is the default one

Changed:
  U   zc.sourcerelease/branches/lgs-distribute-support/src/zc/sourcerelease/__init__.py

-=-
Modified: zc.sourcerelease/branches/lgs-distribute-support/src/zc/sourcerelease/__init__.py
===================================================================
--- zc.sourcerelease/branches/lgs-distribute-support/src/zc/sourcerelease/__init__.py	2010-10-04 16:06:09 UTC (rev 117219)
+++ zc.sourcerelease/branches/lgs-distribute-support/src/zc/sourcerelease/__init__.py	2010-10-04 16:35:30 UTC (rev 117220)
@@ -57,6 +57,12 @@
     parser = optparse.OptionParser()
     parser.add_option("-n", "--name", dest="filename",
         help="create custom named files", default="None")
+    parser.add_option("-d", "--use-distribute", dest="use_distribute",
+        help="Use distribute to bootstrap the buildout (default)",
+        action="store_true", default=True)
+    parser.add_option("-s", "--use-setuptools", dest="use_distribute",
+        help="Use setuptools to bootstrap the buildout",
+        action="store_false")
 
     # retrieve options
     (options, args) = parser.parse_args(args)
@@ -103,8 +109,12 @@
                 eggs_directory
             sys.exit(0)
 
-        buildout.bootstrap([])
+        bootstrap_args = []
+        if options.use_distribute:
+            bootstrap_args.append('--distribute')
 
+        buildout.bootstrap(bootstrap_args)
+
         buildargs = args[:]+[
             '-Uvc', os.path.join(co1, config),
             'buildout:download-cache='+cache
@@ -114,9 +124,13 @@
 
         os.chdir(here)
 
+        core_dependency = 'setuptools'
+        if options.use_distribute:
+            core_dependency = 'distribute'
+
         env = pkg_resources.Environment([eggs_directory])
         dists = [env[project][0].location
-                 for project in ('zc.buildout', 'setuptools')]
+                 for project in ('zc.buildout', core_dependency)]
 
         eggs = os.path.join(co2, reggs)
         os.mkdir(eggs)



More information about the checkins mailing list