Fix tevent python module build as part of samba 4.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 20 Dec 2008 20:19:48 +0000 (21:19 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 20 Dec 2008 20:19:48 +0000 (21:19 +0100)
lib/tevent/config.mk
lib/tevent/pytevent.c
lib/tevent/tests.py

index 5f9508a44f05a516fc576c5a63a8a4ec06ca3a24..7654f78ecc25fce5444eb26cb293642776c0a807 100644 (file)
@@ -47,13 +47,11 @@ PUBLIC_HEADERS += $(addprefix $(libteventsrcdir)/, tevent.h tevent_internal.h)
 
 # TODO: Change python stuff to tevent
 [PYTHON::swig_events]
-LIBRARY_REALNAME = samba/_events.$(SHLIBEXT)
-PRIVATE_DEPENDENCIES = LIBTEVENT LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL
+LIBRARY_REALNAME = tevent.$(SHLIBEXT)
+PRIVATE_DEPENDENCIES = LIBTEVENT PYTALLOC LIBSAMBA-UTIL
 
-swig_events_OBJ_FILES = $(libteventsrcdir)/events_wrap.o
+swig_events_OBJ_FILES = $(libteventsrcdir)/pytevent.o
 
-$(eval $(call python_py_module_template,samba/events.py,$(libteventsrcdir)/events.py))
-
-$(swig_events_OBJ_FILES): CFLAGS+=$(CFLAG_NO_UNUSED_MACROS) $(CFLAG_NO_CAST_QUAL)
+$(swig_events_OBJ_FILES): CFLAGS+=$(CFLAG_NO_CAST_QUAL)
 
 PC_FILES += $(libteventsrcdir)/tevent.pc
index b379911b9c9c739e237d1ae2efb54ec971fb4ab5..02e0db3f843cbf6d10b358848eee5a4b763a0a95 100644 (file)
@@ -103,8 +103,14 @@ void inittevent(void)
 {
     PyObject *m;
 
+    if (PyType_Ready(&PyEventContext) < 0)
+       return;
+
     m = Py_InitModule3("tevent", tevent_methods, "Event management.");
     if (m == NULL)
         return;
+
+    Py_INCREF(&PyEventContext);
+    PyModule_AddObject(m, "EventContext", (PyObject *)&PyEventContext);
 }
 
index b14f7e625087088af8aa091fc97693b7db527f6f..0ec736b359af2c01fbb79cc43ae1293e31a0c777 100644 (file)
@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-import events
+import tevent as events
 import unittest
 
 # Just test the bindings are there and that calling them doesn't crash
@@ -25,7 +25,7 @@ import unittest
 
 class EventTestCase(unittest.TestCase):
     def test_create(self):
-        self.assertTrue(events.event() is not None)
+        self.assertTrue(events.EventContext() is not None)
 
     def test_loop_wait(self):
-        self.assertEquals(0, events.event().loop_wait())
+        self.assertEquals(0, events.EventContext().loop_wait())