lib/ldb: Enable use of a python3 pyldb-util system library
authorAndrew Bartlett <abartlet@samba.org>
Mon, 6 Mar 2017 09:23:35 +0000 (22:23 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 Mar 2017 06:31:10 +0000 (07:31 +0100)
To do this, we have to install a .pc file for the python3 pyldb-util

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Incorportaing fixes by Petr Viktorin <pviktori@redhat.com>

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
lib/ldb/pyldb-util.pc.in
lib/ldb/wscript

index 348ae8b95d6814269e0312d2e93b1950201e812b..60ec7029260237d6ddd36ccea90fbb4444eaad7d 100644 (file)
@@ -4,10 +4,10 @@ libdir=@libdir@
 includedir=@includedir@
 modulesdir=@LDB_MODULESDIR@
 
-Name: pyldb-util
+Name: pyldb-util@PYTHON_SO_ABI_FLAG@
 Description: Python bindings for LDB
 Version: @PACKAGE_VERSION@
 Requires: ldb
-Libs: @LIB_RPATH@ -L${libdir} -lpyldb-util
+Libs: @LIB_RPATH@ -L${libdir} -lpyldb-util@PYTHON_LIBNAME_SO_ABI_FLAG@
 Cflags: -I${includedir}
 URL: http://ldb.samba.org/
index 7f05db3992a32b5c7031e6813d7b592fbc2047a0..a12af00f1b9c63b1c085d19261f1cb75435e94ec 100644 (file)
@@ -55,9 +55,22 @@ def configure(conf):
     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',
-                                     implied_deps='replace talloc tdb tevent ldb'):
+        using_system_pyldb_util = True
+        if not conf.CHECK_BUNDLED_SYSTEM_PKG('pyldb-util', minversion=VERSION,
+                                             onlyif='talloc tdb tevent',
+                                             implied_deps='replace talloc tdb tevent ldb'):
+            using_system_pyldb_util = False
+
+        # We need to get a pyldb-util for all the python versions
+        # we are building for
+        if conf.env['EXTRA_PYTHON']:
+            name = 'pyldb-util' + conf.all_envs['extrapython']['PYTHON_SO_ABI_FLAG']
+            if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
+                                                 onlyif='talloc tdb tevent',
+                                                 implied_deps='replace talloc tdb tevent ldb'):
+                using_system_pyldb_util = False
+
+        if using_system_pyldb_util:
             conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
             if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb', minversion=VERSION,
                                          onlyif='talloc tdb tevent pyldb-util',
@@ -112,17 +125,17 @@ def build(bld):
                      internal_module=False,
                      subsystem='ldb')
 
-    # we're not currently linking against the ldap libs, but ldb.pc.in
-    # has @LDAP_LIBS@
-    bld.env.LDAP_LIBS = ''
-
-    if not 'PACKAGE_VERSION' in bld.env:
-        bld.env.PACKAGE_VERSION = VERSION
-        bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
-
     if not bld.env.disable_python:
         if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
             for env in bld.gen_python_environments(['PKGCONFIGDIR']):
+                # we're not currently linking against the ldap libs, but ldb.pc.in
+                # has @LDAP_LIBS@
+                bld.env.LDAP_LIBS = ''
+
+                if not 'PACKAGE_VERSION' in bld.env:
+                    bld.env.PACKAGE_VERSION = VERSION
+                    bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
+
                 name = bld.pyembed_libname('pyldb-util')
                 bld.SAMBA_LIBRARY(name,
                                   deps='ldb',