--- a/lib/tdb/wscript	2016-11-30 09:56:00.000000000 -0500
+++ b/lib/tdb/wscript	2017-02-08 16:37:49.160987205 -0500
@@ -77,16 +77,16 @@
     conf.env.standalone_tdb = conf.IN_LAUNCH_DIR()
     conf.env.building_tdb = True
 
+    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
+
     if not conf.env.standalone_tdb:
         if conf.CHECK_BUNDLED_SYSTEM_PKG('tdb', minversion=VERSION,
                                      implied_deps='replace'):
             conf.define('USING_SYSTEM_TDB', 1)
             conf.env.building_tdb = False
-            if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
+            if not conf.env.disable_python and conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
                 conf.define('USING_SYSTEM_PYTDB', 1)
 
-    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
-
     if (conf.CONFIG_SET('HAVE_ROBUST_MUTEXES') and
         conf.env.building_tdb and
         not conf.env.disable_tdb_mutex_locking):
--- a/lib/tevent/wscript	2016-10-07 00:45:35.000000000 -0400
+++ b/lib/tevent/wscript	2017-02-08 16:39:22.478733175 -0500
@@ -34,11 +34,13 @@
 
     conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
 
+    conf.env.disable_python = getattr(Options.options, 'disable_python', False)
+
     if not conf.env.standalone_tevent:
         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):
+            if not conf.env.disable_python and 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'):
@@ -61,8 +63,6 @@
     if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
         conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
 
-    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.find_program('python', var='PYTHON')
