From 465cff7531731929b963085a13ef9a74100858e5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 23 Sep 2010 14:28:02 -0700 Subject: tevent: Add infrastructure for python bindings. --- lib/tevent/wscript | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'lib/tevent/wscript') diff --git a/lib/tevent/wscript b/lib/tevent/wscript index aae0d1ef99..f6d60bdcc0 100644 --- a/lib/tevent/wscript +++ b/lib/tevent/wscript @@ -13,7 +13,7 @@ while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5: srcdir = '../' + srcdir sys.path.insert(0, srcdir + '/buildtools/wafsamba') -import wafsamba, samba_dist +import wafsamba, samba_dist, Options, Logs samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools') @@ -22,6 +22,11 @@ def set_options(opt): opt.BUNDLED_EXTENSION_DEFAULT('tevent', noextension='tevent') opt.RECURSE('lib/replace') opt.RECURSE('lib/talloc') + if opt.IN_LAUNCH_DIR(): + opt.add_option('--disable-python', + help=("disable the pytevent module"), + action="store_true", dest='disable_python', default=False) + def configure(conf): conf.RECURSE('lib/replace') @@ -37,6 +42,17 @@ def configure(conf): if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'): conf.DEFINE('HAVE_EPOLL', 1) + conf.env.disable_python = getattr(Options.options, 'disable_python', False) + + if not conf.env.disable_python: + # also disable if we don't have the python libs installed + conf.check_tool('python') + conf.check_python_version((2,4,2)) + conf.check_python_headers(mandatory=False) + if not conf.env.HAVE_PYTHON_H: + Logs.warn('Disabling pytevent as python devel libs not found') + conf.env.disable_python = True + conf.SAMBA_CONFIG_H() def build(bld): @@ -65,6 +81,13 @@ def build(bld): bld.PKG_CONFIG_FILES('tevent.pc', vnum=VERSION) bld.INSTALL_FILES('${INCLUDEDIR}', 'tevent.h') + bld.SAMBA_PYTHON('pytevent', + 'pytevent.c', + deps='tevent', + enabled=True, + realname='_tevent.so') + + def test(ctx): '''test tevent''' print("The tevent testsuite is part of smbtorture in samba4") -- cgit