Commits

Lynn Rees committed aa130a6

- update fab file

Comments (0)

Files changed (3)

callchain/mixins/call.py

 # -*- coding: utf-8 -*-
 '''callchain call mixins'''
 
+from stuf import frozenstuf
 from appspace.builders import Appspace
-from stuf import frozenstuf, orderedstuf
-from stuf.utils import either, lazy, lazy_class
+from stuf.utils import OrderedDict, either, lazy, lazy_class
 
 from callchain.keys.base import NoServiceError
 
     def commit(self):
         '''consume call chain'''
         with self.ctx3():
-            self._xtend(
+            return self._xtend(
                 c() for c in self.iterexcept(self._chain.popleft, IndexError)
             )
-            return self
 
     class Meta:
         pass
         fire = self.fire
         try:
             # 1. "before" event 2. "work" event
-            self.trigger('before', 'work')
+            fire('before', 'work')
             # everything else
             super(EventCallMixin, self).commit()
             # 3. "change" event 4. "any" event 5. "after" event
             fire('problem')
         finally:
             # 7. event that runs "anyway"
-            fire('anyway')
-        return self
+            return fire('anyway')
 
     def fire(self, *events):
         '''
 
         @param *events: event labels
         '''
-        with self.ctx1(workq='_util'):
-            self._xtend(self._events(*events))
-        with self.ctx3(inq='_util', clearout=False):
-            for c in self._iterable:
-                foo = c
-                foo()
+        with self.ctx1(workq='_work'):
+            self.exhaustcall(
+                lambda x: x(), self._xtend(self._events(*events))._iterable,
+            )
             return self
 
     def queues(self, *events):
 
         @param *events: event labels
         '''
-        return orderedstuf((e, self._eventq(e)) for e in events)
+        return OrderedDict((e, self._eventq(e)) for e in events)

callchain/tests/event.py

         self.qclass.on('anyway', fsum, [1.1, 1.1, 1.1]).on('anyway', sqrt, 5)
         self.qclass.commit()
         queues = self.qclass.queues('before', 'work', 'any', 'after', 'anyway')
-        outgoing = deque(queues['before'])
+        foo = queues['before']
+        outgoing = deque(foo)
         self.assertEqual(outgoing.popleft(), 1.0)
         self.assertEqual(outgoing.popleft(), 3.3000000000000003)
         self.assertEqual(outgoing.popleft(), 1.0)
         )
         qclass.commit()
         queues = qclass.queues('before', 'work', 'any', 'after', 'anyway')
-        outgoing = deque(queues['before'])
+        foo = queues['before']
+        outgoing = foo.outgoing
         self.assertEqual(outgoing.popleft(), 1.0)
         self.assertEqual(outgoing.popleft(), 3.3000000000000003)
         self.assertEqual(outgoing.popleft(), 1.0)
         local('hg push ssh://hg@bitbucket.org/lcrees/callchain')
         local('hg push git+ssh://git@github.com:kwarterthieves/callchain.git')
     local('./setup.py register sdist --format=bztar,gztar,zip upload')
+    local('rm -rf dist')
+
+
+def release_next():
+    '''release callchain from next branch'''
+    local('hg update maint')
+    local('hg merge default; hg ci -m automerge')
+    local('hg update default')
+    local('hg merge next; hg ci -m automerge')
+    local('hg update next')
+    local('hg merge default; hg ci -m automerge')
+    prompt('Enter tag: ', 'tag')
+    with settings(warn_only=True):
+        local('hg tag "%(tag)s"' % env)
+        local('hg push ssh://hg@bitbucket.org/lcrees/callchain')
+        local('hg push git+ssh://git@github.com:kwarterthieves/callchain.git')
+    local('./setup.py register sdist --format=bztar,gztar,zip upload')
+    local('rm -rf dist')