Exemple #1
0
def packager(data, feature_set, **kw):
    """Build an add-on based on input data."""
    log.info("[1@None] Packaging add-on")

    from devhub.views import packager_path

    dest = packager_path(data["slug"])

    with guard(u"devhub.packager.%s" % dest) as locked:
        if locked:
            log.error(u"Packaging in progress: %s" % dest)
            return

        with statsd.timer("devhub.packager"):
            from packager.main import packager

            log.info("Starting packaging: %s" % dest)
            features = set([k for k, v in feature_set.items() if v])
            try:
                packager(data, dest, features)
            except Exception, err:
                log.error(u"Failed to package add-on: %s" % err)
                raise
            if os.path.exists(dest):
                log.info(u"Package saved: %s" % dest)
Exemple #2
0
    def test_guard_copes(self):
        try:
            with guard('abc'):
                1 / 0
        except ZeroDivisionError:
            pass

        eq_(Message('abc').get(), None)
Exemple #3
0
    def test_guard_copes(self):
        try:
            with guard("abc"):
                1 / 0
        except ZeroDivisionError:
            pass

        eq_(Message("abc").get(), None)
Exemple #4
0
def packager(data, feature_set, **kw):
    """Build an add-on based on input data."""
    log.info('[1@None] Packaging add-on')

    from devhub.views import packager_path
    dest = packager_path(data['slug'])

    with guard(u'devhub.packager.%s' % dest) as locked:
        if locked:
            log.error(u'Packaging in progress: %s' % dest)
            return

        with statsd.timer('devhub.packager'):
            from packager.main import packager
            log.info('Starting packaging: %s' % dest)
            features = set([k for k, v in feature_set.items() if v])
            try:
                packager(data, dest, features)
            except Exception, err:
                log.error(u'Failed to package add-on: %s' % err)
                raise
            if storage.exists(dest):
                log.info(u'Package saved: %s' % dest)
Exemple #5
0
def packager(data, feature_set, **kw):
    """Build an add-on based on input data."""
    log.info('[1@None] Packaging add-on')

    from mkt.developers.views import packager_path
    dest = packager_path(data['slug'])

    with guard(u'mkt.developers.packager.%s' % dest) as locked:
        if locked:
            log.error(u'Packaging in progress: %s' % dest)
            return

        with statsd.timer('mkt.developers.packager'):
            from packager.main import packager
            log.info('Starting packaging: %s' % dest)
            features = set([k for k, v in feature_set.items() if v])
            try:
                packager(data, dest, features)
            except Exception, err:
                log.error(u'Failed to package add-on: %s' % err)
                raise
            if os.path.exists(dest):
                log.info(u'Package saved: %s' % dest)
Exemple #6
0
 def test_guard_blocks(self):
     Message('abc').save(True)
     with guard('abc') as locked:
         eq_(locked, True)
Exemple #7
0
 def test_guard_deletes(self):
     with guard('abc'):
         pass
     eq_(Message('abc').get(), None)
Exemple #8
0
 def test_guard(self):
     with guard('abc') as locked:
         eq_(locked, False)
         eq_(Message('abc').get(), True)
Exemple #9
0
 def test_guard_blocks(self):
     Message("abc").save(True)
     with guard("abc") as locked:
         eq_(locked, True)
Exemple #10
0
 def test_guard_deletes(self):
     with guard("abc"):
         pass
     eq_(Message("abc").get(), None)
Exemple #11
0
 def test_guard(self):
     with guard("abc") as locked:
         eq_(locked, False)
         eq_(Message("abc").get(), True)
Exemple #12
0
 def test_guard_deletes(self):
     with guard('abc'):
         pass
     eq_(Message('abc').get(), None)