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)
def test_guard_copes(self): try: with guard('abc'): 1 / 0 except ZeroDivisionError: pass eq_(Message('abc').get(), None)
def test_guard_copes(self): try: with guard("abc"): 1 / 0 except ZeroDivisionError: pass eq_(Message("abc").get(), None)
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)
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)
def test_guard_blocks(self): Message('abc').save(True) with guard('abc') as locked: eq_(locked, True)
def test_guard_deletes(self): with guard('abc'): pass eq_(Message('abc').get(), None)
def test_guard(self): with guard('abc') as locked: eq_(locked, False) eq_(Message('abc').get(), True)
def test_guard_blocks(self): Message("abc").save(True) with guard("abc") as locked: eq_(locked, True)
def test_guard_deletes(self): with guard("abc"): pass eq_(Message("abc").get(), None)
def test_guard(self): with guard("abc") as locked: eq_(locked, False) eq_(Message("abc").get(), True)