changeset 32:86c3c0d4d434

drastic rewrite; now use classes == flowers
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 12 Jun 2011 18:22:50 -0700
parents f6b768417d27
children f3878c2f7032
files buttercup/__init__.py buttercup/checkout.py setup.py
diffstat 3 files changed, 14 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/buttercup/__init__.py	Tue May 31 07:39:07 2011 -0700
+++ b/buttercup/__init__.py	Sun Jun 12 18:22:50 2011 -0700
@@ -1,5 +1,4 @@
 from paste.script import templates
-from checkout import sources
 
 var = templates.var
 
@@ -17,9 +16,10 @@
         """
         called before the template is applied
         """
-        src = sources()
-        vars['install_requires'] = '\n'.join([repr(s[0])+','
-                                              for s in src])
+        # XXX broken for now
+        # src = sources()
+        # vars['install_requires'] = '\n'.join([repr(s[0])+','
+        #                                    for s in src])
 
     def post(self, command, output_dir, vars):
         """
--- a/buttercup/checkout.py	Tue May 31 07:39:07 2011 -0700
+++ b/buttercup/checkout.py	Sun Jun 12 18:22:50 2011 -0700
@@ -12,45 +12,15 @@
 import os
 import source
 import sys
-import subprocess
 from buttercup import Buttercup
 from optparse import OptionParser
 
-HG='http://k0s.org/hg'
-PACKAGES=['bitsyapps',
-          'bitsyauth',
-          'bitsyblog',
-          'bitsytweet',
-          'buttercup',
-          'clwapp',
-          'commentator',
-          'contenttransformer',
-          'cropresize',
-          'decoupage',
-          'emaildispatcher',
-          'genshi_view',
-          'hgpaste',
-          'lxmlmiddleware',
-          'martINI',
-          'montage',
-          'webob_view',
-          'wordstream']
-
-def sources():
-    return [(package, '%s/%s' % (HG, package))
-            for package in PACKAGES ]
-
 def main(args=sys.argv[1:]):
 
-    # get source repositories
-    sources = globals()['sources']()
-
     # parse command line options
     parser = OptionParser()
-    parser.add_option('--install', action="store_true", default=False,
+    parser.add_option('--setup', action="store_true", default=False,
                       help="install the packages")
-    parser.add_option('--update', action="store_true", default=False,
-                      help="update the packages")
     parser.add_option('--list', action="store_true", default=False,
                       help="list the source to be installed")
     options, args = parser.parse_args(args)
@@ -68,27 +38,15 @@
     src = os.path.join(os.environ['VIRTUAL_ENV'], 'src')
     if not os.path.exists(src):
         os.mkdir(src)
-    os.chdir(src)
+
+    # grow a flower
+    buttercup = Buttercup(srcdir=src)
 
-    # clone the sources
-    for s in sources:
-        if os.path.exists(s[0]):
-            if options.update:
-                os.chdir(s[0])
-                subprocess.call(['hg', 'pull'])
-                subprocess.call(['hg', 'update'])
-                os.chdir('..')
-            else:
-                print "%s already exists" % s[0]
-        else:
-            subprocess.call(['hg', 'clone', s[1]])
-
-    # install the sources
-    if options.install:
-        for s in sources:
-            os.chdir(s[0])
-            subprocess.call(['python', 'setup.py', 'develop'])
-            os.chdir('..')
+    # clone/update the sources
+    buttercup.install()
+    # install the python
+    if options.setup:        
+        buttercup.setup()
 
 if __name__ == '__main__':
     main() 
--- a/setup.py	Tue May 31 07:39:07 2011 -0700
+++ b/setup.py	Sun Jun 12 18:22:50 2011 -0700
@@ -5,7 +5,7 @@
 except:
     description = ''
 
-version='0.1'
+version='0.2'
 
 setup(name='buttercup',
       version=version,