From a420bcb6d82aff352301b59c8bb3bbd27d6da1ab Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Wed, 24 Jun 2009 18:50:35 +0700 Subject: [PATCH] libevent: add _version_info() method it provides info about python-event's and libevent's versions and the polling method --- eventlet/hubs/libevent.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/eventlet/hubs/libevent.py b/eventlet/hubs/libevent.py index 8dcded8..3bccbcd 100644 --- a/eventlet/hubs/libevent.py +++ b/eventlet/hubs/libevent.py @@ -196,6 +196,19 @@ class Hub(object): def get_excs(self): return self.excs + def _version_info(self): + baseversion = event.__version__ + try: + from ctypes import CDLL, util, c_char_p + c = CDLL(util.find_library('event')) + c.event_get_version.restype = c_char_p + baseversion += '/libevent=%s' % (c.event_get_version(), ) + c.event_get_method.restype = c_char_p + baseversion += '/method=%s' % (c.event_get_method(), ) + except Exception, ex: + print ex or type(ex).__name__ + return baseversion + def _scheduled_call(event_impl, handle, evtype, arg): cb, args, kwargs = arg