talloc: version 2.1.15
[samba.git] / lib / talloc / wscript
index 90839ad8f69a587051bc9cb75dcb4ca7eb837314..f254e55654b93e0b6127f8b20d0d76cd514bc496 100644 (file)
@@ -1,30 +1,29 @@
 #!/usr/bin/env python
 
 APPNAME = 'talloc'
-VERSION = '2.1.9'
+VERSION = '2.1.15'
 
-
-blddir = 'bin'
-
-import Logs
-import os, sys
+import os
+import sys
 
 # find the buildtools directory
-srcdir = '.'
-while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
-    srcdir = srcdir + '/..'
-sys.path.insert(0, srcdir + '/buildtools/wafsamba')
+top = '.'
+while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5:
+    top = top + '/..'
+sys.path.insert(0, top + '/buildtools/wafsamba')
 
-import sys
-sys.path.insert(0, srcdir+"/buildtools/wafsamba")
-import wafsamba, samba_dist, Options
+out = 'bin'
+
+import wafsamba
+from wafsamba import samba_dist, samba_utils
+from waflib import Logs, Options, Context
 
 # setup what directories to put in a tarball
 samba_dist.DIST_DIRS("""lib/talloc:. lib/replace:lib/replace
 buildtools:buildtools third_party/waf:third_party/waf""")
 
 
-def set_options(opt):
+def options(opt):
     opt.BUILTIN_DEFAULT('replace')
     opt.PRIVATE_EXTENSION_DEFAULT('talloc', noextension='talloc')
     opt.RECURSE('lib/replace')
@@ -74,18 +73,21 @@ def configure(conf):
                                      implied_deps='replace'):
             conf.define('USING_SYSTEM_TALLOC', 1)
 
-        using_system_pytalloc_util = True
-        if not conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
-                                             implied_deps='talloc replace'):
+        if conf.env.disable_python:
             using_system_pytalloc_util = False
-
-        # We need to get a pytalloc-util for all the python versions
-        # we are building for
-        if conf.env['EXTRA_PYTHON']:
-            name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG']
+        else:
+            using_system_pytalloc_util = True
+            name = 'pytalloc-util' + conf.all_envs['default']['PYTHON_SO_ABI_FLAG']
             if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
                                                  implied_deps='talloc replace'):
                 using_system_pytalloc_util = False
+            # We need to get a pytalloc-util for all the python versions
+            # we are building for
+            if conf.env['EXTRA_PYTHON']:
+                name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG']
+                if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
+                                                     implied_deps='talloc replace'):
+                    using_system_pytalloc_util = False
 
         if using_system_pytalloc_util:
             conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
@@ -162,7 +164,7 @@ def build(bld):
 
             bld.SAMBA_PYTHON('test_pytalloc',
                             'test_pytalloc.c',
-                            deps='pytalloc',
+                            deps=name,
                             enabled=bld.PYTHON_BUILD_IS_ENABLED(),
                             realname='_test_pytalloc.so',
                             install=False)
@@ -170,17 +172,19 @@ def build(bld):
 
 def test(ctx):
     '''run talloc testsuite'''
-    import Utils, samba_utils
+    import samba_utils
 
     samba_utils.ADD_LD_LIBRARY_PATH('bin/shared')
     samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private')
 
-    cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
+    cmd = os.path.join(Context.g_module.out, 'talloc_testsuite')
     ret = samba_utils.RUN_COMMAND(cmd)
     print("testsuite returned %d" % ret)
-    magic_helper_cmd = os.path.join(Utils.g_module.blddir, 'talloc_test_magic_differs_helper')
-    magic_cmd = os.path.join(srcdir, 'lib', 'talloc',
+    magic_helper_cmd = os.path.join(Context.g_module.out, 'talloc_test_magic_differs_helper')
+    magic_cmd = os.path.join(Context.g_module.top, 'lib', 'talloc',
                              'test_magic_differs.sh')
+    if not os.path.exists(magic_cmd):
+        magic_cmd = os.path.join(Context.g_module.top, 'test_magic_differs.sh')
 
     magic_ret = samba_utils.RUN_COMMAND(magic_cmd + " " +  magic_helper_cmd)
     print("magic differs test returned %d" % magic_ret)
@@ -194,7 +198,6 @@ def dist():
 
 def reconfigure(ctx):
     '''reconfigure if config scripts have changed'''
-    import samba_utils
     samba_utils.reconfigure(ctx)