changeset 6:e6e80bf0476f

update the way checkout works; maybe should move to pip at some point
author Jeff Hammel <k0scist@gmail.com>
date Mon, 29 Mar 2010 11:57:48 -0700
parents f207357d7ca9
children fa1dfcb2ec6a
files buttercup/__init__.py buttercup/checkout.py buttercup/template/setup.py
diffstat 3 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/buttercup/__init__.py	Mon Mar 29 11:31:14 2010 -0700
+++ b/buttercup/__init__.py	Mon Mar 29 11:57:48 2010 -0700
@@ -1,4 +1,5 @@
 from paste.script import templates
+from checkout import sources
 
 var = templates.var
 
@@ -16,6 +17,9 @@
         """
         called before the template is applied
         """
+        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	Mon Mar 29 11:31:14 2010 -0700
+++ b/buttercup/checkout.py	Mon Mar 29 11:57:48 2010 -0700
@@ -4,6 +4,12 @@
 checks out the source as associated with the buttercup package
 """
 
+# XXX could/should use e.g.
+# pip install --editable hg+https://slinkp@bitbucket.org/slinkp/purplevoter#egg=purplevoter
+# -or -
+# pip install -r foo.txt
+
+import os
 import sys
 import subprocess
 from optparse import OptionParser
@@ -25,22 +31,38 @@
           'webob_view',
           'wordstream']
 
+def sources():
+    return [(package, '%s/%s' % (HG, package))
+            for package in PACKAGES ]
+
 def main(args=sys.argv[1:]):
     parser = OptionParser()
+    parser.add_option('--install', action="store_true", default=False,
+                      help="install the packages")
     parser.add_option('--list', action="store_true", default=False,
                       help="list the source to be installed")
     options, args = parser.parse_args(args)
 
-    sources = ['%s/%s' % (HG, package)
-               for package in PACKAGES ]
-
+    sources = globals()['sources']()
     if options.list:
         for source in sources:
-            print source
+            print source[0], source[1]
         sys.exit(0)
 
+    assert 'VIRTUAL_ENV' in os.environ
+    src = os.path.join(os.environ['VIRTUAL_ENV'], 'src')
+    if not os.path.exists(src):
+        os.mkdir(src)
+    os.chdir(src)
+
     for source in sources:
-        subprocess.call(['hg', 'clone', source])
+        subprocess.call(['hg', 'clone', source[1]])
+
+    if options.install:
+        for source in sources:
+            os.chdir(source[0])
+            subprocess.call(['python', 'setup.py', 'develop'])
+            os.chdir('..')
 
 if __name__ == '__main__':
     main() 
--- a/buttercup/template/setup.py	Mon Mar 29 11:31:14 2010 -0700
+++ b/buttercup/template/setup.py	Mon Mar 29 11:57:48 2010 -0700
@@ -12,18 +12,7 @@
       license="",
       packages=find_packages(exclude=['ez_setup', 'examples', 'tests*']),
       include_package_data=True,
-      install_requires = [ 
-        'PasteScript', 
-        'decoupage',
-        'contenttransformer',
-        'montage',
-        'cropresize',
-        'hgpaste',
-        'wordstream',
-        'bitsyblog',
-        'bitsyauth',
-        'clwapp',
-        ],
+      install_requires = [ ${install_requires} ],
       zip_safe=False,
       entry_points = """
       [paste.paster_create_template]