view buttercup/buttercup.py @ 37:8d67dbd068cd

add wsgintegrate to required software
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 13 Jun 2011 07:23:26 -0700
parents 2aa78e65d882
children 1744fe69a129
line wrap: on
line source

"""
the flower blooming to k0s.org
"""

import os
import source
try:
    from subprocess import check_call as call
except ImportError:
    from subprocess import call

class Buttercup(object):

    # k0sware software
    HG='http://k0s.org/hg'
    PACKAGES=['bitsyapps',
              'bitsyauth',
              'bitsyblog',
              'bitsytweet',
              'buttercup',
              'clwapp',
              'commentator',
              'contenttransformer',
              'cropresize',
              'decoupage',
              'emaildispatcher',
              'genshi_view',
              'hgpaste',
              'lxmlmiddleware',
              'martINI',
              'montage',
              'pyloader',
              'svgsitemap',
              'webob_view',
              'wordstream',
              'wsgintegrate']

    def __init__(self, srcdir):
        self.srcdir = srcdir
        self.sources = {'hg': ['%s/%s' % (self.HG, package)
                          for package in self.PACKAGES ]}
        self.sources['git'] = ['git://github.com/mozilla/toolbox.git']

    def install(self):
        """install all software needed for this flower"""
        source_objs = source.sources(self.sources, srcdir=self.srcdir)
        for source_obj in source_objs:
            source_obj() # clone/update the software

    def setup(self, source_objs=None):
        """setup python packages for development"""
        if source_objs is None:
            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())

    def deploy(self):
        self.install()
        self.setup()

    __call__ = deploy