--- a/wscript	2015-12-10 06:01:40.000000000 -0500
+++ b/wscript	2016-01-06 15:05:57.013617848 -0500
@@ -5,6 +5,7 @@
 
 blddir = 'bin'
 
+import Logs
 import sys, os
 
 # find the buildtools directory
@@ -13,7 +14,7 @@
     srcdir = srcdir + '/..'
 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
 
-import wafsamba, samba_dist, Utils
+import wafsamba, samba_dist, Utils, Options
 
 samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
                         lib/tdb:lib/tdb lib/tdb:lib/tdb lib/tevent:lib/tevent
@@ -28,8 +29,17 @@
     opt.RECURSE('lib/tevent')
     opt.RECURSE('lib/replace')
     opt.tool_options('python') # options for disabling pyc or pyo compilation
+    if opt.IN_LAUNCH_DIR():
+        opt.add_option('--disable-python',
+        help=("disable the pyldb modules"),
+        action="store_true", dest='disable_python', default=False)
+
 
 def configure(conf):
+    conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
+
+    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
+
     conf.RECURSE('lib/tdb')
     conf.RECURSE('lib/tevent')
 
@@ -44,16 +54,18 @@
     conf.RECURSE('lib/replace')
     conf.find_program('python', var='PYTHON')
     conf.find_program('xsltproc', var='XSLTPROC')
-    conf.check_tool('python')
-    conf.check_python_version((2,4,2))
-    conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
+
+    if not conf.env.disable_python:
+      conf.SAMBA_CHECK_PYTHON(mandatory=False, version=(2,4,2))
+      conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
+      if not conf.env.HAVE_PYTHON_H:
+        Logs.warn('Disabling pyldb-util as python devel libs not found')
+        conf.env.disable_python = True
 
     # where does the default LIBDIR end up? in conf.env somewhere?
     #
     conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
 
-    conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
-
     if not conf.env.standalone_ldb:
         if conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION,
                                      onlyif='talloc tdb tevent',
--- a/lib/talloc/wscript	2015-11-06 08:28:25.000000000 -0500
+++ b/lib/talloc/wscript	2016-01-06 15:07:43.673478788 -0500
@@ -48,7 +48,7 @@
         if conf.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion=VERSION,
                                      implied_deps='replace'):
             conf.define('USING_SYSTEM_TALLOC', 1)
-        if conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
+        if not conf.env.disable_python and conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
                                      implied_deps='talloc replace'):
             conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
 
