changeset 48:c99fbe84c3c2

STUB: buttercup/buttercup.py
author Jeff Hammel <k0scist@gmail.com>
date Sat, 25 Jan 2014 17:17:26 -0800
parents 0274d9d9fcd4
children e3770a2530ff
files buttercup/buttercup.py
diffstat 1 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/buttercup/buttercup.py	Tue Nov 12 10:29:30 2013 -0800
+++ b/buttercup/buttercup.py	Sat Jan 25 17:17:26 2014 -0800
@@ -4,10 +4,24 @@
 
 import os
 import source
-try:
-    from subprocess import check_call as call
-except ImportError:
-    from subprocess import call
+from subprocess import check_call as call
+
+
+__all__ = ['Buttercup', 'SetupError']
+
+
+class SetupError(Exception):
+    """error during setup"""
+
+    def __init__(self, message, directory, uri=None):
+        self.directory = os.path.abspath(directory)
+        self.uri = uri
+        _message = "Error setting up '{}'".format(directory)
+        if uri:
+            _message += " (from {})".format(uri)
+        _message += "\n  {}".format(message)
+        Exception.__init__(self, _message)
+
 
 class Buttercup(object):
 
@@ -50,8 +64,6 @@
                                for package in self.PACKAGES ]}
         self.sources['git'] = ['git://github.com/mozilla/toolbox.git']
 
-        # extra tools
-        self.sources['hg'].append('http://k0s.org/mozilla/hg/licenser')
 
     def install(self):
         """install all software needed for this flower"""
@@ -65,7 +77,11 @@
             source_objs = source.sources(self.sources, srcdir=self.srcdir)
         for source_obj in source_objs:
             if os.path.exists(os.path.join(source_obj.directory(), 'setup.py')):
-                call(['python', 'setup.py', 'develop'], cwd=source_obj.directory())
+                try:
+                    call(['python', 'setup.py', 'develop'], cwd=source_obj.directory())
+                except Exception as e:
+                    import pdb; pdb.set_trace()
+                    raise SetupError(str(e))
 
     def deploy(self):
         self.install()