buildtools: Ignore exact Python version for ABI checking
authorPetr Viktorin <pviktori@redhat.com>
Fri, 14 Aug 2015 10:17:48 +0000 (12:17 +0200)
committerStefan Metzmacher <metze@samba.org>
Sun, 1 Nov 2015 00:09:06 +0000 (01:09 +0100)
Utilities for Python libraries are built for a specific Python
version. Starting with Python 3, the Python version is recorded
in the shared library filename as an ABI tag, e.g. "pytalloc.cpython-34m.so.
The exact version doesn't matter for Samba's ABI check.
Replace the ABI tag with a simpler one that just records the major
version of Python.

Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sun Nov  1 01:09:06 CET 2015 on sn-devel-104

buildtools/wafsamba/samba_abi.py
buildtools/wafsamba/wafsamba.py

index 3ff6d77811c413d72bd6993b8305a43ec9c91a3f..82205945ce05d9098e3b480c9f0d12bc318dffb4 100644 (file)
@@ -137,7 +137,8 @@ def abi_check(self):
     topsrc = self.bld.srcnode.abspath()
     abi_gen = os.path.join(topsrc, 'buildtools/scripts/abi_gen.sh')
 
-    abi_file = "%s/%s-%s.sigs" % (self.abi_directory, self.name, self.vnum)
+    abi_file = "%s/%s-%s.sigs" % (self.abi_directory, self.version_libname,
+                                  self.vnum)
 
     tsk = self.create_task('abi_check', self.link_task.outputs[0])
     tsk.ABI_FILE = abi_file
index fdd0371b63c0c24163b069d874459aab7faedb7b..318dabf44e110b758d67e36aff8ef2e104dac659 100644 (file)
@@ -253,6 +253,15 @@ def SAMBA_LIBRARY(bld, libname, source,
     if abi_directory:
         features += ' abi_check'
 
+    if pyembed and bld.env['PYTHON_SO_ABI_FLAG']:
+        # For ABI checking, we don't care about the exact Python version.
+        # Replace the Python ABI tag (e.g. ".cpython-35m") by a generic ".py3"
+        abi_flag = bld.env['PYTHON_SO_ABI_FLAG']
+        replacement = '.py%s' % bld.env['PYTHON_VERSION'].split('.')[0]
+        version_libname = libname.replace(abi_flag, replacement)
+    else:
+        version_libname = libname
+
     vscript = None
     if bld.env.HAVE_LD_VERSION_SCRIPT:
         if private_library:
@@ -263,7 +272,7 @@ def SAMBA_LIBRARY(bld, libname, source,
             version = None
         if version:
             vscript = "%s.vscript" % libname
-            bld.ABI_VSCRIPT(libname, abi_directory, version, vscript,
+            bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
                             abi_match)
             fullname = apply_pattern(bundled_name, bld.env.shlib_PATTERN)
             fullpath = bld.path.find_or_declare(fullname)
@@ -289,6 +298,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         samba_deps      = deps,
         samba_includes  = includes,
         version_script  = vscript,
+        version_libname = version_libname,
         local_include   = local_include,
         global_include  = global_include,
         vnum            = vnum,