summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-10-04 13:38:25 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-10-04 13:52:09 +0200
commite604532b495a82da09f3a5dea5fc2a0aa59590f7 (patch)
treeeae7ce0409881169d977c1d639d0bc43e49b3853 /buildtools/wafsamba
parent6cd722d9507200a90b7c99dcb6749187aa757f87 (diff)
downloadsamba-e604532b495a82da09f3a5dea5fc2a0aa59590f7.tar.gz
samba-e604532b495a82da09f3a5dea5fc2a0aa59590f7.tar.bz2
samba-e604532b495a82da09f3a5dea5fc2a0aa59590f7.zip
waf: Add function for checking for system python modules.
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba_bundled.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
index c8d49672e2..27e5409b45 100644
--- a/buildtools/wafsamba/samba_bundled.py
+++ b/buildtools/wafsamba/samba_bundled.py
@@ -139,6 +139,38 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
sys.exit(1)
return False
+
+@runonce
+@conf
+def CHECK_BUNDLED_SYSTEM_PYTHON(conf, libname, modulename, minversion='0.0.0'):
+ '''check if a python module is available on the system and
+ has the specified minimum version.
+ '''
+ if conf.LIB_MUST_BE_BUNDLED(libname):
+ return False
+
+ # see if the library should only use a system version if another dependent
+ # system version is found. That prevents possible use of mixed library
+ # versions
+ minversion = minimum_library_version(conf, libname, minversion)
+
+ try:
+ m = __import__(modulename)
+ except ImportError:
+ found = False
+ else:
+ try:
+ version = m.__version__
+ except AttributeError:
+ found = False
+ else:
+ found = tuple(minversion.split(".")) >= tuple(version.split("."))
+ if not found and not conf.LIB_MAY_BE_BUNDLED(libname):
+ Logs.error('ERROR: Python module %s of version %s not found, and bundling disabled' % (libname, minversion))
+ sys.exit(1)
+ return found
+
+
def NONSHARED_BINARY(bld, name):
'''return True if a binary should be built without non-system shared libs'''
if bld.env.DISABLE_SHARED: