[PR PATCH] Try to extrapolate PYTHON_SO_ABI_FLAG from the SOABI Python config variable

Timur I. Bakeyev timur at freebsd.org
Tue Nov 28 00:23:41 UTC 2017

Hi, guys!

We were trying to build Samba 4.7.* on FreeBSD with the Python3 bindings
enabled, but it was failing OOTB
due clash of the build targets for Python2 and Python3 module names.

With the help of Andreas on IRC we figured out that the issue lays in the
is determined by the WAF. For Linux it seems to OK to use value of the "SO"
Python configuration variable
to determine the SO ABI extension. One can be derived from another. FreeBSD
ports compile Python with
different settings and "SO" value is merely ".so", so there is nothing you
can derive from it. But, Python has
a separate variable, "SOABI", which is defined for both OSes and contains
the extension value in way usable
directly. So,
on Linux:
# python3 -c "import sysconfig; print(sysconfig.get_config_var('SO'))"
# python3 -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"

On FreeBSD:
# python3 -c "import sysconfig; print(sysconfig.get_config_var('SO'))"
# python3 -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))"

Of course the easiest way would be to add "SOABI" to the list of extracted
configuration variables in the
wafadmin/Tools/python.py, but as it's a third parity code for Samba we need
to work around it and extract
this value in buildtools/wafsamba/samba_python.py.

Here is the patch that tries to solve this issue for FreeBSD, keeping
compatibility with the original way
of deriving PYTHON_SO_ABI_FLAG. For convenience ability to define this
variable through the ENV
is also added.

Please review this patch and if possible add it or it's derivatives to your
branch as well.

With best regards,
Timur Bakeyev
iXsystems Inc.

On Mon, Nov 27, 2017 at 4:34 AM, Github bot account via samba-technical <
samba-technical at lists.samba.org> wrote:

> There is a new pull request by b-a-t against master on the Samba Samba
> Github repository
> https://github.com/b-a-t/samba python3-freebsd
> https://github.com/samba-team/samba/pull/110
> Try to extrapolate PYTHON_SO_ABI_FLAG  from the SOABI Python config
> variable
> Python3 configuration handling (ab)uses "SO" configuration variable to
> extract SO ABI extension. It happens to work on Linux as this variable
> contains not only binary module extension, but also ABI part, like in
> .cpython-34m.so or in .cpython-35m-x86_64-linux-gnu.so. In FreeBSD this
> variable contains only .so. The SO ABI extension in fact, is stored in
> the "SOABI" variable and should be taken from there directly, without
> relying on the content of SO variable. For Linux it contains
> "cpython-34m" and "cpython-35m-x86_64-linux-gnu" respectively, for
> FreeBSD it is "cpython-36m".
> We are trying to set PYTHON_SO_ABI_FLAG based on the value of SOABI and
> only if it's not available - fall back to the old method of guessing it
> from the SO configuration variable.
> A patch file from https://github.com/samba-team/samba/pull/110.patch is
> attached
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 110.patch
Type: application/octet-stream
Size: 2787 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20171128/0adb4f27/110.obj>

More information about the samba-technical mailing list