buildtools: Expose the Python 3 ABI tag
authorPetr Viktorin <pviktori@redhat.com>
Wed, 6 May 2015 10:45:42 +0000 (12:45 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 May 2015 17:28:18 +0000 (19:28 +0200)
Expose the tag in the env to allow using it in pkg-config files

Add a "pyembed_libname" function to correctly form library names.
(This can't be done automatically in SAMBA_LIBRARY because the name
could be used as a dependency for another library)

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
buildtools/wafsamba/samba_python.py

index a371b434a78808664b3f8bb700c34a30a9e18214..b90655d9a2cb6a154776d13fc7dbb774276b85fe 100644 (file)
@@ -23,6 +23,12 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
     else:
         conf.msg("python headers", "using cache")
 
+    if conf.env['PYTHON_VERSION'] > '3':
+        abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
+        conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % ''
+    else:
+        conf.env['PYTHON_SO_ABI_FLAG'] = ''
+
 
 def SAMBA_PYTHON(bld, name,
                  source='',
@@ -69,3 +75,9 @@ def SAMBA_PYTHON(bld, name,
                       enabled=enabled)
 
 Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
+
+
+def pyembed_libname(bld, name, extrapython=False):
+    return name + bld.env['PYTHON_SO_ABI_FLAG']
+
+Build.BuildContext.pyembed_libname = pyembed_libname