EventLoop: name poll constants like glib's
authorZac Medico <zmedico@gentoo.org>
Fri, 10 Feb 2012 00:41:14 +0000 (16:41 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 10 Feb 2012 00:41:14 +0000 (16:41 -0800)
It's conceivable the constants could be implementation dependent, so
use glib's generic IO_* names rather than the POLL* names which are
associated specifically with python's select.poll object.

pym/portage/util/_eventloop/EventLoop.py
pym/portage/util/_eventloop/GlibEventLoop.py

index 21969e695b13e3b4113335001bc97ac363eba261..02c3cec01146c3076bc6bb97d3ea9b0e67e14f87 100644 (file)
@@ -11,7 +11,7 @@ from _emerge.SlotObject import SlotObject
 from _emerge.PollConstants import PollConstants
 from _emerge.PollSelectAdapter import PollSelectAdapter
 
-class EventLoop(PollConstants):
+class EventLoop(object):
 
        supports_multiprocessing = True
 
@@ -37,6 +37,13 @@ class EventLoop(PollConstants):
                self._poll_obj = create_poll_instance()
                self._polling = False
 
+               self.IO_ERR = PollConstants.POLLERR
+               self.IO_HUP = PollConstants.POLLHUP
+               self.IO_IN = PollConstants.POLLIN
+               self.IO_NVAL = PollConstants.POLLNVAL
+               self.IO_OUT = PollConstants.POLLOUT
+               self.IO_PRI = PollConstants.POLLPRI
+
        def _poll(self, timeout=None):
                if self._polling:
                        return
index b35772e7f8670d7d60b988fd58e284e2d86c4b08..1e064eb29d1adcd92209eb64d9ac89c10c728e2e 100644 (file)
@@ -13,6 +13,12 @@ class GlibEventLoop(object):
        supports_multiprocessing = False
 
        def __init__(self):
+               self.IO_ERR = glib.IO_ERR
+               self.IO_HUP = glib.IO_HUP
+               self.IO_IN = glib.IO_IN
+               self.IO_NVAL = glib.IO_NVAL
+               self.IO_OUT = glib.IO_OUT
+               self.IO_PRI = glib.IO_PRI
                self.iteration = glib.main_context_default().iteration
                self.idle_add = glib.idle_add
                self.io_add_watch = glib.io_add_watch