Add version attribute for pytevent.
[mat/samba.git] / lib / tevent / wscript
index 5e32eec48bb9cbbe35a5c9981503de38f9fb6db6..f98253f806b3e4984bc094c80db7f6d3aafbe30b 100644 (file)
@@ -35,9 +35,11 @@ def configure(conf):
     conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
 
     if not conf.env.standalone_tevent:
-        if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION,
+        if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
                                      onlyif='talloc', implied_deps='replace talloc'):
             conf.define('USING_SYSTEM_TEVENT', 1)
+            if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
+                conf.define('USING_SYSTEM_PYTEVENT', 1)
 
     if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
         conf.DEFINE('HAVE_EPOLL', 1)
@@ -56,13 +58,15 @@ def configure(conf):
 
     conf.SAMBA_CONFIG_H()
 
+    conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
+
 def build(bld):
     bld.RECURSE('lib/replace')
     bld.RECURSE('lib/talloc')
 
     SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
              tevent_queue.c tevent_req.c tevent_select.c
-            tevent_poll.c
+         tevent_poll.c
              tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
 
     if bld.CONFIG_SET('HAVE_EPOLL'):
@@ -88,10 +92,18 @@ def build(bld):
                           pc_files='tevent.pc',
                           private_library=private_library)
 
-    bld.SAMBA_PYTHON('pytevent',
-                     'pytevent.c',
-                     deps='tevent',
-                     realname='_tevent.so')
+    if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT'):
+        bld.SAMBA_PYTHON('pytevent',
+                         'pytevent.c',
+                         deps='tevent',
+                         realname='_tevent.so',
+                         cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
+        # install out various python scripts for use by make test
+        bld.SAMBA_SCRIPT('tevent_python',
+                         pattern='tevent.py',
+                         installdir='python')
+
+        bld.INSTALL_WILDCARD('${PYTHONDIR}', 'tevent.py', flat=False)
 
 
 def test(ctx):