[PATCHES] Generate shorter name for extra python files

Lukas Slebodnik lslebodn at redhat.com
Wed Sep 20 20:44:59 UTC 2017


On (19/09/17 14:30), Petr Viktorin via samba-technical wrote:
>On 09/13/2017 04:06 PM, Lukas Slebodnik wrote:
>> On (29/08/17 10:35), Petr Viktorin via samba-technical wrote:
>> > On 08/27/2017 09:02 AM, Andrew Bartlett wrote:
>> > > On Tue, 2017-08-22 at 11:25 +0200, Petr Viktorin via samba-technical
>> > > wrote:
>> > > > 
>> > > > I'm sorry for missing this thread; my vacation-mode filtering is too eager.
>> > > > 
>> > > > As for the original design, "extra python" allows building two versions
>> > > > of Python by a single `make` invocation. Building for both 2 and 3 at
>> > > > once was a requirement to get the Python3 patches in.
>> > > > To make this work, I've reused the mechanism Python uses to allow binary
>> > > > files for multiple versions to co-exist. The "ABI tag" contains just the
>> > > > information needed to distinguish between ABI-incompatible versions.
>> > > > 
>> > > > Note that "/usr/lib64/pkgconfig/pyldb-util36.pc" does not include all
>> > > > relevant information: the "m" in "cpython-36m-x86_64-linux-gnu" encodes
>> > > > build-time configuration; "dm" would mean a debug build with
>> > > > incompatible ABI.
>> > > > See [PEP 3149] if you want details.
>> > > > 
>> > > > Using the ABI tag as-is essentially puts the burden of distinguishing
>> > > > ABI incompatibilities on Python developers/distributors. It's also quite
>> > > > easy to ask Python for it [0], so, hopefully, buildsystems of packages
>> > > > that depend on the utils can be made to support this.
>> > > > 
>> > > > That said, I'm not familiar with pkg-config or multilib packaging
>> > > > outside of Python, or across distros. This is the Python way to do it;
>> > > > please adjust if it makes sense.
>> > > > 
>> > > > 
>> > > > Another note on the original design intent: generally, the "extra
>> > > > python" needs to be version 3, and the "normal" Python could be either 2
>> > > > *or* a different version of 3. It's never been tested with py3 as the
>> > > > non-extra Python, and I'm sure it doesn't actually work now, but at some
>> > > > point it'll be necessary to make the "non-extra" Python be Python 3,
>> > > > preferably with the relevant name mangling. Please don't assume that
>> > > > "not extra-python" implies Python 2.
>> > > > 
>> > > > 
>> > > > [PEP 3149]: https://www.python.org/dev/peps/pep-3149/
>> > > > [0] import sysconfig; sysconfig.get_config_var('SOABI')
>> > > 
>> > > Thanks for the details.  If you could work with Lumir and Andreas to
>> > > propose something that follows the above and meets Lumir's requirements
>> > > that would be great.  We can't be the first package to have produced a
>> > > python C binding, surely there is some guidance already?
>> > 
>> > Samba is not the first package with a Python binding, but those "_util"
>> > libraries are quite unique.
>> > 
>> > General guidance for providing a C API for Python extension modules is
>> > provided in Python documentation [0]: roughly, put the function pointers (and
>> > a version) in a struct, wrap it in a Capsule object, and provide that as a
>> > Python-level object.
>> > To use this, there's a PyCapsule_Import helper that imports a module, fetches
>> > the attribute, and unwraps it to get the struct.
>> > 
>> > This solves problems with naming/discovery/linking of C-level utilities:
>> > everything is found via the extension module.
>> > But in Samba's case, it would require changes to all code that currently uses
>> > the _util libraries.
>> > 
>> > 
>> > [0] https://docs.python.org/3/extending/extending.html#providing-a-c-api-for-an-extension-module
>> > 
>> 
>> I think LDVERSION (+ fallback to VERSION) should work well in this case
>> and does not contain architecture or platform in the string,
>>   which is fine for dynamic library.
>> 
>>    sh$ python3
>>    Python 3.6.2 (default, Sep  1 2017, 12:03:48)
>>    [GCC 7.1.1 20170802 (Red Hat 7.1.1-7)] on linux
>>    Type "help", "copyright", "credits" or "license" for more information.
>>    >>> import sysconfig; sysconfig.get_config_var('SOABI')
>>    'cpython-36m-x86_64-linux-gnu'
>>    >>> from distutils.sysconfig import get_config_var
>>    >>> get_config_var('LDVERSION') or get_config_var('VERSION')
>>    '3.6m'
>>    sh$ python2
>>    Python 2.7.13 (default, Aug 16 2017, 12:56:26)
>>    [GCC 7.1.1 20170802 (Red Hat 7.1.1-7)] on linux2
>>    Type "help", "copyright", "credits" or "license" for more information.
>>    >>> import sysconfig; sysconfig.get_config_var('SOABI')
>>    >>> from distutils.sysconfig import get_config_var
>>    >>> get_config_var('LDVERSION') or get_config_var('VERSION')
>>    '2.7'
>> 
>> 
>> Sorry that it took me long time to update patches.
>
>This looks reasonable to me, two nitpicks:
>
>The resulting filename is "libpyldb-util36m.so.1", with no separator before
>the tag. Shouldn't there be one?
>If just "-" is used as a separator, the tag can't be a number otherwise the
>buildsystem apparently considers it a version. I suggest adding either "-py"
>in front, or using "-cp" (short for "CPython") to match [PEP 425].
>
Sounds reasonable.

>And, env['PYTHON_SO_ABI_FLAG'] is no longer necessary.
>
>
>[PEP 425]: https://www.python.org/dev/peps/pep-0425/#abi-tag
>

Thank you for comments and review.

>From 15c791b2ceeabab1fc938d6aab85c8c5e2313776 Mon Sep 17 00:00:00 2001
>From: Petr Viktorin <pviktori at redhat.com>
>Date: Tue, 19 Sep 2017 14:00:32 +0200
>Subject: [PATCH 1/2] Separate the Python ABI flag from the rest of the so name
>
>Signed-off-by: Petr Viktorin <pviktori at redhat.com>
>---
I hope you don't mind that I squashed this patch to the 1st one in patchset.

LS
-------------- next part --------------
From 1b440427385af1438105775e3d56ef598a599f46 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 3 Jul 2017 20:38:53 +0200
Subject: [PATCH 1/8] WAF: Generate shorter name for extra python

Generating different name with different architecture and with the same
version of python is not ideal. pkgconfig files should be architecture
independent and libraries for different architectures are stored in
different directories
 e.g. (/usr/lib64, /usr/lib, /usr/lib/x86_64-linux-gnu/ ...)

Additional suffix for extra python consist of string "cp" + LDVERSION
for python if available or fallback to VERSION.

"cp" is short version of "CPython" to match [PEP 425]
https://www.python.org/dev/peps/pep-0425/#abi-tag

Therefore it will be simpler to remove architecture from names
/usr/lib64/pkgconfig/pytalloc-util.cpython-36m-x86_64-linux-gnu.pc
vs.
/usr/lib64/pkgconfig/pytalloc-util-cp36m.pc

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
Signed-off-by: Petr Viktorin <pviktori at redhat.com>
---
 buildtools/wafsamba/samba_python.py      | 11 ++++++-----
 buildtools/wafsamba/wafsamba.py          |  3 ++-
 third_party/waf/wafadmin/Tools/python.py |  1 +
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index f97439c945b4e986bacef39387cf4168d419e158..c523f179433dbda9d0df24a1e2162ad85f8bd77b 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -85,10 +85,11 @@ def _check_python_headers(conf, mandatory):
     if conf.env['PYTHON_VERSION'] > '3':
         abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
         conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % ''
+        python_abi_version = conf.env['PYTHON_LDVERSION'].replace('.', '')
+        conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = '-cp' + python_abi_version
     else:
         conf.env['PYTHON_SO_ABI_FLAG'] = ''
-    conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = (
-        conf.env['PYTHON_SO_ABI_FLAG'].replace('_', '-'))
+        conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = ''
 
     for lib in conf.env['LINKFLAGS_PYEMBED']:
         if lib.startswith('-L'):
@@ -168,9 +169,9 @@ def SAMBA_PYTHON(bld, name,
 Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
 
 
-def pyembed_libname(bld, name, extrapython=False):
-    if bld.env['PYTHON_SO_ABI_FLAG']:
-        return name + bld.env['PYTHON_SO_ABI_FLAG']
+def pyembed_libname(bld, name):
+    if bld.env['PYTHON_LIBNAME_SO_ABI_FLAG']:
+        return name + bld.env['PYTHON_LIBNAME_SO_ABI_FLAG']
     else:
         return name
 
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 23fd3c48342060951b95924abd17f6830c3fa965..85368df5a9b8ac00316b7c0b18fa4850eb66f7ca 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -329,7 +329,8 @@ def SAMBA_LIBRARY(bld, libname, source,
 
     if pc_files is not None and not private_library:
         if pyembed and bld.env['IS_EXTRA_PYTHON']:
-            bld.PKG_CONFIG_FILES(pc_files, vnum=vnum, extra_name=bld.env['PYTHON_SO_ABI_FLAG'])
+            bld.PKG_CONFIG_FILES(pc_files, vnum=vnum,
+                                 extra_name=bld.env['PYTHON_LIBNAME_SO_ABI_FLAG'])
         else:
             bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
 
diff --git a/third_party/waf/wafadmin/Tools/python.py b/third_party/waf/wafadmin/Tools/python.py
index cd96b658185273ef211b2feb4f7039896cfc7688..fca1e6e087da0ad29e45deed03c4a5fcb93d292c 100644
--- a/third_party/waf/wafadmin/Tools/python.py
+++ b/third_party/waf/wafadmin/Tools/python.py
@@ -234,6 +234,7 @@ LDVERSION = %r
 	result = False
 	if not python_LDVERSION:
 		python_LDVERSION = env['PYTHON_VERSION']
+	env['PYTHON_LDVERSION'] = python_LDVERSION
 	name = 'python' + python_LDVERSION
 
 	if python_LIBDIR is not None:
-- 
2.14.1


From 4bd85ddbf2317f092f0886bc7b55fdc37ea9b741 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 3 Jul 2017 21:22:10 +0200
Subject: [PATCH 2/8] talloc: Generate shorter name for extra python

Generating different name with different architecture and with the same
version of python is not ideal. pkgconfig files should be architecture
independent and libraries for different architectures are stored in
different directories
 e.g. (/usr/lib64, /usr/lib, /usr/lib/x86_64-linux-gnu/ ...)

Therefore it will be simpler to remove architecture from names
/usr/lib64/pkgconfig/pytalloc-util.cpython-36m-x86_64-linux-gnu.pc
vs.
/usr/lib64/pkgconfig/pytalloc-util-cp36m.pc

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 lib/talloc/pytalloc-util.pc.in | 2 +-
 lib/talloc/wscript             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/talloc/pytalloc-util.pc.in b/lib/talloc/pytalloc-util.pc.in
index 06f83e26aa43b3eafd0364c1603673742c2de63b..1025ba562fecaec07ce8aa04a2350f638a36be76 100644
--- a/lib/talloc/pytalloc-util.pc.in
+++ b/lib/talloc/pytalloc-util.pc.in
@@ -3,7 +3,7 @@ exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
 
-Name: pytalloc-util at PYTHON_SO_ABI_FLAG@
+Name: pytalloc-util at PYTHON_LIBNAME_SO_ABI_FLAG@
 Description: Utility functions for using talloc objects with Python
 Version: @TALLOC_VERSION@
 Libs: @LIB_RPATH@ -L${libdir} -lpytalloc-util at PYTHON_LIBNAME_SO_ABI_FLAG@
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index ab74e727950d327db6d506986b1c9fe3be1a326a..c733f8b3c49c7b9795142476db91509d266f6af6 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -85,7 +85,7 @@ def configure(conf):
             # 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']
+                name = 'pytalloc-util' + conf.all_envs['extrapython']['PYTHON_LIBNAME_SO_ABI_FLAG']
                 if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
                                                      implied_deps='talloc replace'):
                     using_system_pytalloc_util = False
-- 
2.14.1


From aa7e532b717a992a772bf23cab74d7842ce26439 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 3 Jul 2017 21:27:34 +0200
Subject: [PATCH 3/8] ldb: Generate shorter name for extra python

Generating different name with different architecture and with the same
version of python is not ideal. pkgconfig files should be architecture
independent and libraries for different architectures are stored in
different directories
 e.g. (/usr/lib64, /usr/lib, /usr/lib/x86_64-linux-gnu/ ...)

Therefore it will be simpler to remove architecture from names
/usr/lib64/pkgconfig/pyldb-util.cpython-36m-x86_64-linux-gnu.pc
vs.
/usr/lib64/pkgconfig/pyldb-util-cp36m.pc

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 lib/ldb/pyldb-util.pc.in | 2 +-
 lib/ldb/wscript          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ldb/pyldb-util.pc.in b/lib/ldb/pyldb-util.pc.in
index 60ec7029260237d6ddd36ccea90fbb4444eaad7d..99e0378e98a5e51ca30857dd5863a503c6a7e219 100644
--- a/lib/ldb/pyldb-util.pc.in
+++ b/lib/ldb/pyldb-util.pc.in
@@ -4,7 +4,7 @@ libdir=@libdir@
 includedir=@includedir@
 modulesdir=@LDB_MODULESDIR@
 
-Name: pyldb-util at PYTHON_SO_ABI_FLAG@
+Name: pyldb-util at PYTHON_LIBNAME_SO_ABI_FLAG@
 Description: Python bindings for LDB
 Version: @PACKAGE_VERSION@
 Requires: ldb
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 5ea52317d4d5261607f35e28d4b8395c6daebacb..d01521a839cf9827267aec96c793234f06c3ecb9 100644
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -77,7 +77,7 @@ def configure(conf):
             # 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']
+                name = 'pyldb-util' + conf.all_envs['extrapython']['PYTHON_LIBNAME_SO_ABI_FLAG']
                 if not conf.CHECK_BUNDLED_SYSTEM_PKG(name, minversion=VERSION,
                                                      onlyif='talloc tdb tevent',
                                                      implied_deps='replace talloc tdb tevent ldb'):
-- 
2.14.1


From 43a08f339df8a6810040bc1ae03259b0a817ffb6 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 10 Jul 2017 13:53:14 +0200
Subject: [PATCH 4/8] build:wafsamba: Use same ABI files for different python
 versions

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 buildtools/wafsamba/samba_abi.py | 14 ++++++++++----
 buildtools/wafsamba/wafsamba.py  |  4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 196b468f5b35f096f34dfa6e454f38e00a84ccbe..43d9cd3bd2bd54027913e920631d94cd2cde2880 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -211,7 +211,7 @@ def abi_build_vscript(task):
     for f in task.inputs:
         fname = f.abspath(task.env)
         basename = os.path.basename(fname)
-        version = basename[len(task.env.LIBNAME)+1:-len(".sigs")]
+        version = basename[len(task.env.ABI_FILE_PREFIX)+1:-len(".sigs")]
         versions.append(version)
         abi_process_file(fname, version, symmap)
     f = open(tgt, mode='w')
@@ -222,10 +222,15 @@ def abi_build_vscript(task):
         f.close()
 
 
-def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None):
+def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None,
+                abi_file_prefix=None):
     '''generate a vscript file for our public libraries'''
     if abi_directory:
-        source = bld.path.ant_glob('%s/%s-[0-9]*.sigs' % (abi_directory, libname), flat=True)
+        if abi_file_prefix is None:
+            abi_file_prefix = libname
+        pattern = '%s/%s-[0-9]*.sigs' % (abi_directory, abi_file_prefix)
+        source = bld.path.ant_glob(pattern, flat=True)
+
         def abi_file_key(path):
             return version_key(path[:-len(".sigs")].rsplit("-")[-1])
         source = sorted(source.split(), key=abi_file_key)
@@ -247,7 +252,8 @@ def ABI_VSCRIPT(bld, libname, abi_directory, version, vscript, abi_match=None):
     else:
         abi_match = samba_utils.TO_LIST(abi_match)
     t.env.ABI_MATCH = abi_match
+    t.env.ABI_FILE_PREFIX = abi_file_prefix
     t.env.VERSION = version
     t.env.LIBNAME = libname
-    t.vars = ['LIBNAME', 'VERSION', 'ABI_MATCH']
+    t.vars = ['LIBNAME', 'VERSION', 'ABI_MATCH', 'ABI_FILE_PREFIX']
 Build.BuildContext.ABI_VSCRIPT = ABI_VSCRIPT
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 85368df5a9b8ac00316b7c0b18fa4850eb66f7ca..aa0853930ed880af39171d9181ea95e98d863ccb 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -265,8 +265,10 @@ def SAMBA_LIBRARY(bld, libname, source,
         abi_flag = bld.env['PYTHON_SO_ABI_FLAG']
         replacement = '.py%s' % bld.env['PYTHON_VERSION'].split('.')[0]
         version_libname = libname.replace(abi_flag, replacement)
+        abi_file_prefix = libname.replace(bld.env['PYTHON_LIBNAME_SO_ABI_FLAG'], '')
     else:
         version_libname = libname
+        abi_file_prefix = None
 
     vscript = None
     if bld.env.HAVE_LD_VERSION_SCRIPT:
@@ -279,7 +281,7 @@ def SAMBA_LIBRARY(bld, libname, source,
         if version:
             vscript = "%s.vscript" % libname
             bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
-                            abi_match)
+                            abi_match, abi_file_prefix)
             fullname = apply_pattern(bundled_name, bld.env.shlib_PATTERN)
             fullpath = bld.path.find_or_declare(fullname)
             vscriptpath = bld.path.find_or_declare(vscript)
-- 
2.14.1


From a7b35b00f9c79d44b32868ccb2ad6fba45c484cb Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Tue, 11 Jul 2017 10:11:33 +0200
Subject: [PATCH 5/8] build:wafsamba: Remove unused version_libname

Patch is almost a revert of commit 9ef47d25317947248b0796059e6f0a851ba3cb07
Revert "buildtools: Ignore exact Python version for ABI checking"

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 buildtools/wafsamba/samba_abi.py | 3 +--
 buildtools/wafsamba/wafsamba.py  | 9 ++-------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
index 43d9cd3bd2bd54027913e920631d94cd2cde2880..f92686b8757a6ba3144ceca0ddb59031f25348ce 100644
--- a/buildtools/wafsamba/samba_abi.py
+++ b/buildtools/wafsamba/samba_abi.py
@@ -137,8 +137,7 @@ 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.version_libname,
-                                  self.vnum)
+    abi_file = "%s/%s-%s.sigs" % (self.abi_directory, self.name, self.vnum)
 
     tsk = self.create_task('abi_check', self.link_task.outputs[0])
     tsk.ABI_FILE = abi_file
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index aa0853930ed880af39171d9181ea95e98d863ccb..2378f768431736144dc49bce5416697a42328980 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -261,13 +261,9 @@ def SAMBA_LIBRARY(bld, libname, source,
 
     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)
+        # Remove the Python VERSION
         abi_file_prefix = libname.replace(bld.env['PYTHON_LIBNAME_SO_ABI_FLAG'], '')
     else:
-        version_libname = libname
         abi_file_prefix = None
 
     vscript = None
@@ -280,7 +276,7 @@ def SAMBA_LIBRARY(bld, libname, source,
             version = None
         if version:
             vscript = "%s.vscript" % libname
-            bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
+            bld.ABI_VSCRIPT(libname, abi_directory, version, vscript,
                             abi_match, abi_file_prefix)
             fullname = apply_pattern(bundled_name, bld.env.shlib_PATTERN)
             fullpath = bld.path.find_or_declare(fullname)
@@ -306,7 +302,6 @@ 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,
-- 
2.14.1


From 1c3fcea34966332a62bdf097b21dd4e16e16a543 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 10 Jul 2017 14:04:15 +0200
Subject: [PATCH 6/8] talloc: Remove duplicate pytalloc-util ABI files

All versions of python will the same files for generation of
version script.

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 lib/talloc/ABI/pytalloc-util.py3-2.1.5.sigs |  5 -----
 lib/talloc/ABI/pytalloc-util.py3-2.1.6.sigs | 12 ------------
 lib/talloc/ABI/pytalloc-util.py3-2.1.7.sigs | 12 ------------
 lib/talloc/ABI/pytalloc-util.py3-2.1.8.sigs | 12 ------------
 lib/talloc/ABI/pytalloc-util.py3-2.1.9.sigs | 15 ---------------
 5 files changed, 56 deletions(-)
 delete mode 100644 lib/talloc/ABI/pytalloc-util.py3-2.1.5.sigs
 delete mode 100644 lib/talloc/ABI/pytalloc-util.py3-2.1.6.sigs
 delete mode 100644 lib/talloc/ABI/pytalloc-util.py3-2.1.7.sigs
 delete mode 100644 lib/talloc/ABI/pytalloc-util.py3-2.1.8.sigs
 delete mode 100644 lib/talloc/ABI/pytalloc-util.py3-2.1.9.sigs

diff --git a/lib/talloc/ABI/pytalloc-util.py3-2.1.5.sigs b/lib/talloc/ABI/pytalloc-util.py3-2.1.5.sigs
deleted file mode 100644
index 0807eb329657f7540b5aaa652e0441dbac1a3abe..0000000000000000000000000000000000000000
--- a/lib/talloc/ABI/pytalloc-util.py3-2.1.5.sigs
+++ /dev/null
@@ -1,5 +0,0 @@
-pytalloc_Check: int (PyObject *)
-pytalloc_GetObjectType: PyTypeObject *(void)
-pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-pytalloc_steal: PyObject *(PyTypeObject *, void *)
-pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
diff --git a/lib/talloc/ABI/pytalloc-util.py3-2.1.6.sigs b/lib/talloc/ABI/pytalloc-util.py3-2.1.6.sigs
deleted file mode 100644
index 4410f110cb299ef5eaaeac54d43c5712d6beeb98..0000000000000000000000000000000000000000
--- a/lib/talloc/ABI/pytalloc-util.py3-2.1.6.sigs
+++ /dev/null
@@ -1,12 +0,0 @@
-_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
-_pytalloc_get_ptr: void *(PyObject *)
-_pytalloc_get_type: void *(PyObject *, const char *)
-pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
-pytalloc_BaseObject_check: int (PyObject *)
-pytalloc_BaseObject_size: size_t (void)
-pytalloc_Check: int (PyObject *)
-pytalloc_GetBaseObjectType: PyTypeObject *(void)
-pytalloc_GetObjectType: PyTypeObject *(void)
-pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-pytalloc_steal: PyObject *(PyTypeObject *, void *)
-pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
diff --git a/lib/talloc/ABI/pytalloc-util.py3-2.1.7.sigs b/lib/talloc/ABI/pytalloc-util.py3-2.1.7.sigs
deleted file mode 100644
index 4410f110cb299ef5eaaeac54d43c5712d6beeb98..0000000000000000000000000000000000000000
--- a/lib/talloc/ABI/pytalloc-util.py3-2.1.7.sigs
+++ /dev/null
@@ -1,12 +0,0 @@
-_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
-_pytalloc_get_ptr: void *(PyObject *)
-_pytalloc_get_type: void *(PyObject *, const char *)
-pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
-pytalloc_BaseObject_check: int (PyObject *)
-pytalloc_BaseObject_size: size_t (void)
-pytalloc_Check: int (PyObject *)
-pytalloc_GetBaseObjectType: PyTypeObject *(void)
-pytalloc_GetObjectType: PyTypeObject *(void)
-pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-pytalloc_steal: PyObject *(PyTypeObject *, void *)
-pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
diff --git a/lib/talloc/ABI/pytalloc-util.py3-2.1.8.sigs b/lib/talloc/ABI/pytalloc-util.py3-2.1.8.sigs
deleted file mode 100644
index 4410f110cb299ef5eaaeac54d43c5712d6beeb98..0000000000000000000000000000000000000000
--- a/lib/talloc/ABI/pytalloc-util.py3-2.1.8.sigs
+++ /dev/null
@@ -1,12 +0,0 @@
-_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
-_pytalloc_get_ptr: void *(PyObject *)
-_pytalloc_get_type: void *(PyObject *, const char *)
-pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
-pytalloc_BaseObject_check: int (PyObject *)
-pytalloc_BaseObject_size: size_t (void)
-pytalloc_Check: int (PyObject *)
-pytalloc_GetBaseObjectType: PyTypeObject *(void)
-pytalloc_GetObjectType: PyTypeObject *(void)
-pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-pytalloc_steal: PyObject *(PyTypeObject *, void *)
-pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
diff --git a/lib/talloc/ABI/pytalloc-util.py3-2.1.9.sigs b/lib/talloc/ABI/pytalloc-util.py3-2.1.9.sigs
deleted file mode 100644
index 62f066f7d5f5f8e4139c5a56926ed141500bbc0b..0000000000000000000000000000000000000000
--- a/lib/talloc/ABI/pytalloc-util.py3-2.1.9.sigs
+++ /dev/null
@@ -1,15 +0,0 @@
-_pytalloc_check_type: int (PyObject *, const char *)
-_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
-_pytalloc_get_ptr: void *(PyObject *)
-_pytalloc_get_type: void *(PyObject *, const char *)
-pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
-pytalloc_BaseObject_check: int (PyObject *)
-pytalloc_BaseObject_size: size_t (void)
-pytalloc_Check: int (PyObject *)
-pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *)
-pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *)
-pytalloc_GetBaseObjectType: PyTypeObject *(void)
-pytalloc_GetObjectType: PyTypeObject *(void)
-pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-pytalloc_steal: PyObject *(PyTypeObject *, void *)
-pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
-- 
2.14.1


From 82e7bef4aeb557e9161bce71e0fdb9a2d5329570 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 10 Jul 2017 14:07:33 +0200
Subject: [PATCH 7/8] ldb: Remove duplicate pyldb-util ABI files

All versions of python will the same files for generation of
version script.

Signed-off-by: Lukas Slebodnik <lslebodn at redhat.com>
---
 lib/ldb/ABI/pyldb-util.py3-1.1.23.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.24.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.25.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.26.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.27.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.28.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.30.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.1.31.sigs | 2 --
 lib/ldb/ABI/pyldb-util.py3-1.2.0.sigs  | 2 --
 10 files changed, 20 deletions(-)
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.23.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.24.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.25.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.26.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.27.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.28.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.30.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.1.31.sigs
 delete mode 100644 lib/ldb/ABI/pyldb-util.py3-1.2.0.sigs

diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.23.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.23.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.23.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.24.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.24.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.24.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.25.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.25.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.25.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.26.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.26.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.26.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.27.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.27.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.27.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.28.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.28.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.28.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.29.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.30.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.30.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.30.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.1.31.sigs b/lib/ldb/ABI/pyldb-util.py3-1.1.31.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.1.31.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
diff --git a/lib/ldb/ABI/pyldb-util.py3-1.2.0.sigs b/lib/ldb/ABI/pyldb-util.py3-1.2.0.sigs
deleted file mode 100644
index 74d6719d2bc566cef73f4dd79e5f8b73f3193eaa..0000000000000000000000000000000000000000
--- a/lib/ldb/ABI/pyldb-util.py3-1.2.0.sigs
+++ /dev/null
@@ -1,2 +0,0 @@
-pyldb_Dn_FromDn: PyObject *(struct ldb_dn *)
-pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **)
-- 
2.14.1


From 2f59543f8bac2cde64e82ca7c23e4087b2d2ec0a Mon Sep 17 00:00:00 2001
From: Petr Viktorin <pviktori at redhat.com>
Date: Tue, 19 Sep 2017 14:03:13 +0200
Subject: [PATCH 8/8] wafsamba: Remove PYTHON_SO_ABI_FLAG

Signed-off-by: Petr Viktorin <pviktori at redhat.com>
---
 buildtools/wafsamba/samba_python.py | 2 --
 buildtools/wafsamba/wafsamba.py     | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
index c523f179433dbda9d0df24a1e2162ad85f8bd77b..20fbcc004c7df2b8bbec3025be9fe84e7b0ed1e6 100644
--- a/buildtools/wafsamba/samba_python.py
+++ b/buildtools/wafsamba/samba_python.py
@@ -84,11 +84,9 @@ def _check_python_headers(conf, mandatory):
 
     if conf.env['PYTHON_VERSION'] > '3':
         abi_pattern = os.path.splitext(conf.env['pyext_PATTERN'])[0]
-        conf.env['PYTHON_SO_ABI_FLAG'] = abi_pattern % ''
         python_abi_version = conf.env['PYTHON_LDVERSION'].replace('.', '')
         conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = '-cp' + python_abi_version
     else:
-        conf.env['PYTHON_SO_ABI_FLAG'] = ''
         conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = ''
 
     for lib in conf.env['LINKFLAGS_PYEMBED']:
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 2378f768431736144dc49bce5416697a42328980..25e7c922164c6f6ea30fc0fc72c895d0b666f0ed 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -259,7 +259,7 @@ def SAMBA_LIBRARY(bld, libname, source,
     if abi_directory:
         features += ' abi_check'
 
-    if pyembed and bld.env['PYTHON_SO_ABI_FLAG']:
+    if pyembed and bld.env['PYTHON_LIBNAME_SO_ABI_FLAG']:
         # For ABI checking, we don't care about the exact Python version.
         # Remove the Python VERSION
         abi_file_prefix = libname.replace(bld.env['PYTHON_LIBNAME_SO_ABI_FLAG'], '')
-- 
2.14.1



More information about the samba-technical mailing list