diff buttercup/checkout.py @ 31:f6b768417d27

now listing kinda works
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 31 May 2011 07:39:07 -0700
parents a54543838686
children 86c3c0d4d434
line wrap: on
line diff
--- a/buttercup/checkout.py	Tue May 31 07:29:15 2011 -0700
+++ b/buttercup/checkout.py	Tue May 31 07:39:07 2011 -0700
@@ -10,6 +10,7 @@
 # pip install -r foo.txt
 
 import os
+import source
 import sys
 import subprocess
 from buttercup import Buttercup
@@ -56,8 +57,10 @@
 
     # list sources if specified
     if options.list:
-        for source in sources:
-            print '%s: %s' % (source[0], source[1])
+        buttercup = Buttercup(srcdir=None)
+        sources = source.sources(buttercup.sources)
+        for s in sources:
+            print '%s: %s' % (s.directory_name(s.uri), s.uri)
         sys.exit(0)
 
     # setup the src directory in a virtualenv
@@ -68,22 +71,22 @@
     os.chdir(src)
 
     # clone the sources
-    for source in sources:
-        if os.path.exists(source[0]):
+    for s in sources:
+        if os.path.exists(s[0]):
             if options.update:
-                os.chdir(source[0])
+                os.chdir(s[0])
                 subprocess.call(['hg', 'pull'])
                 subprocess.call(['hg', 'update'])
                 os.chdir('..')
             else:
-                print "%s already exists" % source[0]
+                print "%s already exists" % s[0]
         else:
-            subprocess.call(['hg', 'clone', source[1]])
+            subprocess.call(['hg', 'clone', s[1]])
 
     # install the sources
     if options.install:
-        for source in sources:
-            os.chdir(source[0])
+        for s in sources:
+            os.chdir(s[0])
             subprocess.call(['python', 'setup.py', 'develop'])
             os.chdir('..')